这是我第一次使用Maven在Glassfish服务器上部署Web应用程序。
我一步一步地执行以下maven目标:
mvn glassfish:create-domain -P glassfish
mvn glassfish:start-domain -P glassfish
mvn glassfish:deploy -P glassfish
在第三步(glassfish:deploy
)和错误消息
[ERROR] remote failure: Error occurred during deployment: Exception while deploying the app [herald-web-services] : There is no web component by the name of default here.. Please see server.log for more details.
[ERROR] Deployment of /Users/Ray/workspace/herald-web-services/target/herald-web-services-1.1-SNAPSHOT.war failed.
[ERROR] For more detail on what might be causing the problem try running maven with the --debug option
[ERROR] or setting the maven-glassfish-plugin "echo" property to "true".
而且,这是pom.xml
的一部分:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
<configuration>
<glassfishDirectory>${glassfish.home}</glassfishDirectory>
<user>${domain.user}</user>
<adminPassword>${domain.password}</adminPassword>
<passwordFile>${glassfish.home}/domains/${project.artifactId}/config/domain-passwords</passwordFile>
<autoCreate>true</autoCreate>
<debug>true</debug>
<echo>true</echo>
<skip>${test.int.skip}</skip>
<domain>
<name>${project.artifactId}</name>
<adminPort>4848</adminPort>
<httpPort>8080</httpPort>
<httpsPort>8443</httpsPort>
<iiopPort>3700</iiopPort>
<jmsPort>7676</jmsPort>
</domain>
<components>
<component>
<name>${project.artifactId}</name>
<artifact>${project.build.directory}/${project.build.finalName}.war</artifact>
</component>
</components>
</configuration>
</plugin>
</plugins>
</build>
...
</project>
和settings.xml
,
<profile>
<id>glassfish</id>
<properties>
<glassfish.home>/Users/Ray/glassfish3</glassfish.home>
<domain.user>admin</domain.user>
<domain.password>changeit</domain.password>
<test.int.skip>true</test.int.skip>
</properties>
</profile>
我在pom.xml
或Glassfish配置中是否遗漏了某些内容?
答案 0 :(得分:4)
问题解决了。
我忘了从default
远程调用web.xml
servlet映射,这是一个Tomcat规范。
以下是摘录
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/doc/*</url-pattern>
</servlet-mapping>
通过删除此servlet映射,它可以正常工作。