gpt4 book ai didi

maven - glassfish 部署期间发生错误 - 此处没有名称为 default 的 Web 组件

转载 作者:行者123 更新时间:2023-12-02 22:03:29 25 4
gpt4 key购买 nike

这是我第一次使用 Maven 在 Glassfish Server 上部署 Web 应用程序。

我逐步执行以下 Maven 目标:

  1. mvn glassfish:create-domain -P glassfish
  2. mvn glassfish:start-domain -P glassfish
  3. 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 配置中的某些内容?

最佳答案

问题解决了。我忘记从 web.xml 中删除 default servlet 映射,这是一个 Tomcat 规范。

这是片段,

<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/doc/*</url-pattern>
</servlet-mapping>

通过删除这个 servlet 映射,它可以工作。

关于maven - glassfish 部署期间发生错误 - 此处没有名称为 default 的 Web 组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16505321/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com