2

This is my first time to deploy web application on a Glassfish Server with Maven.

I execute the following maven goals step by step:

  1. mvn glassfish:create-domain -P glassfish
  2. mvn glassfish:start-domain -P glassfish
  3. mvn glassfish:deploy -P glassfish

Everything goes fine until the third step (glassfish:deploy) and the error message is

[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".

And, here is part of my 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>

and 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>

Do I miss something in my pom.xml or in Glassfish configuration?

4

1 回答 1

5

问题已经解决了。我忘记defaultweb.xml.

这是片段,

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

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

于 2013-05-12T08:19:35.200 回答