我正在尝试将 glassfish-maven-plugin ( https://maven-glassfish-plugin.dev.java.net/ ) 与 GlassFish v3 一起使用(我在 Mac 上使用 Eclipse),但我似乎无法部署我的 Web 应用程序。我不断遇到:
The Master Password is required to start the domain. No console, no prompting possible. You should either create the domain with --savemasterpassword=true or provide a password file with the --passwordfile option.
这是我的 POM 文件的相关部分。
<profiles>
<profile>
<id>development</id>
<activation>
<property>
<name>phase</name>
<value>development</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.2-SNAPSHOT</version>
<configuration>
<glassfishDirectory>${glassfish.directory}</glassfishDirectory>
<user>${glassfish.user}</user>
<passFile>${glassfish.directory}/domains/${project.artifactId}/config/domain-passwords</passFile>
<domain>
<name>${project.artifactId}</name>
</domain>
<components>
<component>
<name>${project.artifactId}</name>
<artifact>${project.build.directory}/artifacts/${project.artifactId}.war</artifact>
</component>
</components>
</configuration>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>ocean</id>
<url>http://maven.ocean.net.au/snapshot</url>
<releases>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
这是 Maven 正在执行的启动域命令。
asadmin --host localhost --port 4848 --user admin --passwordfile /var/folders/sk/skcc8rAVGSynOBBaOwWN3U+++TI/-Tmp-/mgfp5377058868244877698.tmp --interactive=false --echo=true --terse=true start-domain --debug=false --domaindir /Applications/GlassFish/v3/glassfish/domains --help=false --upgrade=false --verbose=false mvnrepo
--passwordfile 使用的是临时文件,所以我猜这就是问题所在。由于某种原因,passFile 参数不起作用。
有什么想法吗?我的假设错了吗?
最佳答案
在Fairly Complete Configuration Example , 确实有对 <passFile> 的引用元素,但各种目标的文档未提及此元素并引用 <passwordFile>相反(参见例如 glassfish:start-domain 或 glassfish:deploy )。因此,尝试相应地更新配置文件中的插件配置:
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.2-SNAPSHOT</version>
<configuration>
<glassfishDirectory>${glassfish.directory}</glassfishDirectory>
<user>${glassfish.user}</user>
<passwordFile>${glassfish.directory}/domains/${project.artifactId}/config/domain-passwords</passwordFile>
<domain>
<name>${project.artifactId}</name>
</domain>
<components>
<component>
<name>${project.artifactId}</name>
<artifact>${project.build.directory}/artifacts/${project.artifactId}.war</artifact>
</component>
</components>
</configuration>
</plugin>
作为旁注,我推荐 maven-embedded-glassfish-plugin它允许使用其嵌入式 API 在单个 JVM 中运行 Glassfish。非常好。参见 Using maven plugin for v3 embedded glassfish 了解更多详情。
更新:我做了一些进一步的测试,但实际上无法在我的机器上重现您的问题(叹息)。
首先,我通过执行以下命令(来自 <glassfish_home>/bin)创建了一个新域:
$ ./asadmin create-domain --savemasterpassword=true maven-glassfish-testcase
然后,我使用 maven 的 webapp 原型(prototype)创建了一个新的 webapp:
$ mvn archetype:create -DgroupId=com.mycompany.app \
-DartifactId=maven-glassfish-testcase \
-DarchetypeArtifactId=maven-archetype-webapp
并更新了pom.xml新创建的 webapp 如下:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>maven-glassfish-testcase</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>maven-glassfish-testcase Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<glassfish.home>/home/pascal/opt/glassfishv3/glassfish</glassfish.home>
<domain.username>admin</domain.username>
</properties>
<pluginRepositories>
<pluginRepository>
<id>ocean</id>
<url>http://maven.ocean.net.au/snapshot</url>
<releases>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>maven-glassfish-testcase</finalName>
<plugins>
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.2-SNAPSHOT</version>
<configuration>
<glassfishDirectory>${glassfish.home}</glassfishDirectory>
<user>${domain.username}</user>
<passwordFile>${glassfish.home}/domains/${project.artifactId}/master-password</passwordFile>
<debug>true</debug>
<echo>true</echo>
<domain>
<name>${project.artifactId}</name>
<adminPort>4848</adminPort> <!-- mandatory for mvn glassfish:deploy -->
</domain>
<components>
<component>
<name>${project.artifactId}</name>
<artifact>${project.build.directory}/${project.build.finalName}.war</artifact>
</component>
</components>
</configuration>
</plugin>
</plugins>
</build>
</project>
使用此设置,运行 mvn glassfish:start-domain产生以下输出:
$ mvn glassfish:start-domain
[INFO] Scanning for projects...
[INFO] snapshot org.glassfish.maven.plugin:maven-glassfish-plugin:2.2-SNAPSHOT: checking for updates from ocean
[INFO] ------------------------------------------------------------------------
[INFO] Building maven-glassfish-testcase Maven Webapp
[INFO] task-segment: [glassfish:start-domain]
[INFO] ------------------------------------------------------------------------
[INFO] [glassfish:start-domain {execution: default-cli}]
[INFO] asadmin --host localhost --port 4848 --user admin --passwordfile /home/pascal/opt/glassfishv3/glassfish/domains/maven-glassfish-testcase/master-password --interactive=false --echo=true --terse=true start-domain --debug=true --domaindir /home/pascal/opt/glassfishv3/glassfish/domains --help=false --upgrade=false --verbose=false maven-glassfish-testcase
[INFO] Started domain: maven-glassfish-testcase
[INFO] Domain location: /home/pascal/opt/glassfishv3/glassfish/domains/maven-glassfish-testcase
[INFO] Log file: /home/pascal/opt/glassfishv3/glassfish/domains/maven-glassfish-testcase/logs/server.log
[INFO] Admin port for the domain: 4848
[INFO] Debug port for the domain: 9009
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27 seconds
[INFO] Finished at: Mon Dec 21 20:16:17 CET 2009
[INFO] Final Memory: 4M/53M
[INFO] ------------------------------------------------------------------------
如您所见,--passwordfile使用 POM 中指定的文件正确传递选项。换句话说,事情正在按预期进行。也许尝试使用密码文件的硬编码路径来调试此设置,它应该可以正常工作!
关于java - GlassFish v3 和 glassfish-maven-plugin (Mac),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1935137/
我真的很习惯使用Ruby编写以下代码:my_hash={}my_hash['test']=1Java中对应的数据结构是什么? 最佳答案 HashMapmap=newHashMap();map.put("test",1);我假设? 关于java-等价于Java中的RubyHash,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/22737685/
我想将我的MacSnowLeopardruby从1.8.7升级到1.9.1版本,有人知道轻松且最好的升级方法吗?因为我读了一些论坛/帖子/博客/讨论说覆盖苹果发布的ruby不好将Rails从版本2.2.2升级到2.3.8的最佳方法是什么?因为我找到的所有信息都仅适用于豹/老虎,而且很少有关于雪豹的复杂文章。他们还说覆盖apple提供的rails不好吗。谁能帮帮我?谢谢。 最佳答案 DanBenjamin有一些greatinstructionsforcompilingandinstallingRuby,RubyGemsandRai
我正在尝试使用boilerpipe来自JRuby。我看过guide从JRuby调用Java,并成功地将它与另一个Java包一起使用,但无法弄清楚为什么同样的东西不能用于boilerpipe。我正在尝试基本上从JRuby中执行与此Java等效的操作:URLurl=newURL("http://www.example.com/some-location/index.html");Stringtext=ArticleExtractor.INSTANCE.getText(url);在JRuby中试过这个:require'java'url=java.net.URL.new("http://www
我最近决定从我的系统中卸载RVM。在thispage提出的一些论点说服我:实际上,我的决定是,我根本不想担心Ruby的多个版本。我只想使用1.9.2-p290版本而不用担心其他任何事情。但是,当我在我的Mac上运行ruby--version时,它告诉我我的版本是1.8.7。我四处寻找如何简单地从我的Mac上卸载这个Ruby,但奇怪的是我没有找到任何东西。似乎唯一想卸载Ruby的人运行linux,而使用Mac的每个人都推荐RVM。如何从我的Mac上卸载Ruby1.8.7?我想升级到1.9.2-p290版本,并且我希望我的系统上只有一个版本。 最佳答案
我只想对我一直在思考的这个问题有其他意见,例如我有classuser_controller和classuserclassUserattr_accessor:name,:usernameendclassUserController//dosomethingaboutanythingaboutusersend问题是我的User类中是否应该有逻辑user=User.newuser.do_something(user1)oritshouldbeuser_controller=UserController.newuser_controller.do_something(user1,user2)我
什么是ruby的rack或python的Java的wsgi?还有一个路由库。 最佳答案 来自Python标准PEP333:Bycontrast,althoughJavahasjustasmanywebapplicationframeworksavailable,Java's"servlet"APImakesitpossibleforapplicationswrittenwithanyJavawebapplicationframeworktoruninanywebserverthatsupportstheservletAPI.ht
这篇文章是继上一篇文章“Observability:从零开始创建Java微服务并监控它(一)”的续篇。在上一篇文章中,我们讲述了如何创建一个Javaweb应用,并使用Filebeat来收集应用所生成的日志。在今天的文章中,我来详述如何收集应用的指标,使用APM来监控应用并监督web服务的在线情况。源码可以在地址 https://github.com/liu-xiao-guo/java_observability 进行下载。摄入指标指标被视为可以随时更改的时间点值。当前请求的数量可以改变任何毫秒。你可能有1000个请求的峰值,然后一切都回到一个请求。这也意味着这些指标可能不准确,你还想提取最小/
HashMap中为什么引入红黑树,而不是AVL树呢1.概述开始学习这个知识点之前我们需要知道,在JDK1.8以及之前,针对HashMap有什么不同。JDK1.7的时候,HashMap的底层实现是数组+链表JDK1.8的时候,HashMap的底层实现是数组+链表+红黑树我们要思考一个问题,为什么要从链表转为红黑树呢。首先先让我们了解下链表有什么不好???2.链表上述的截图其实就是链表的结构,我们来看下链表的增删改查的时间复杂度增:因为链表不是线性结构,所以每次添加的时候,只需要移动一个节点,所以可以理解为复杂度是N(1)删:算法时间复杂度跟增保持一致查:既然是非线性结构,所以查询某一个节点的时候
遍历文件夹我们通常是使用递归进行操作,这种方式比较简单,也比较容易理解。本文为大家介绍另一种不使用递归的方式,由于没有使用递归,只用到了循环和集合,所以效率更高一些!一、使用递归遍历文件夹整体思路1、使用File封装初始目录,2、打印这个目录3、获取这个目录下所有的子文件和子目录的数组。4、遍历这个数组,取出每个File对象4-1、如果File是否是一个文件,打印4-2、否则就是一个目录,递归调用代码实现publicclassSearchFile{publicstaticvoidmain(String[]args){//初始目录Filedir=newFile("d:/Dev");Datebeg
我基本上来自Java背景并且努力理解Ruby中的模运算。(5%3)(-5%3)(5%-3)(-5%-3)Java中的上述操作产生,2个-22个-2但在Ruby中,相同的表达式会产生21个-1-2.Ruby在逻辑上有多擅长这个?模块操作在Ruby中是如何实现的?如果将同一个操作定义为一个web服务,两个服务如何匹配逻辑。 最佳答案 在Java中,模运算的结果与被除数的符号相同。在Ruby中,它与除数的符号相同。remainder()在Ruby中与被除数的符号相同。您可能还想引用modulooperation.