Glassfish部署期间发生错误-这里没有默认名称的Web组件

问题描述 投票:2回答:1

这是我第一次使用Maven在Glassfish服务器上部署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配置的内容?

maven glassfish
1个回答
5
投票

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

这是代码段,

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

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

© www.soinside.com 2019 - 2024. All rights reserved.