Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven glassfish部署期间出错-此处没有默认名称的web组件_Maven_Glassfish - Fatal编程技术网

Maven glassfish部署期间出错-此处没有默认名称的web组件

Maven glassfish部署期间出错-此处没有默认名称的web组件,maven,glassfish,Maven,Glassfish,这是我第一次使用Maven在Glassfish服务器上部署web应用程序 我一步一步地执行以下maven目标: mvn glassfish:创建域-P glassfish mvn glassfish:启动域-P glassfish mvn glassfish:deploy-P glassfish 一切正常,直到第三步(glassfish:deploy)出现错误消息 [ERROR] remote failure: Error occurred during deployment: Exceptio

这是我第一次使用Maven在Glassfish服务器上部署web应用程序

我一步一步地执行以下maven目标:

  • mvn glassfish:创建域-P glassfish
  • mvn glassfish:启动域-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>
    

    我是否在我的
    pom.xml
    或Glassfish配置中遗漏了一些内容?

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

    这是片段

    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/doc/*</url-pattern>
    </servlet-mapping>
    
    
    违约
    /医生/*
    

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

    请添加web.xml的一个片段,并显示您在其中所做的更改,以使部署工作正常。这将使你的答案更清晰,值得投票。关于你是如何发现这个问题的信息也会很有用。
    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/doc/*</url-pattern>
    </servlet-mapping>