执行mvn embedded-glassfish:run时“Deployed null”

时间:2014-03-24 05:08:30

标签: java eclipse maven glassfish

这是我的长篇故事。我被分配到工作场所的新项目需要创建和使用RESTful Web服务。我们正在使用maven和它的嵌入式glassfish服务器以及Eclipse来创建应用程序。我是一个全新的人,我正在努力去理解它。

  1. 我设法使用maven(通过命令行)创建动态Web应用程序,如下所述:http://docs.oracle.com/cd/E19226-01/820-7627/giqdq/

  2. 执行mvn embedded-glassfish:run命令时出现多个错误。因此,广泛阅读了可用的文章并修改了我的POM.xml。

  3. 现在,没有错误,当我执行mvn embedded-glassfish:run时,这就是我得到的消息。

    Mar 24, 2014 9:56:59 AM com.sun.enterprise.v3.services.impl.GrizzlyService creat
    eNetworkProxy
    INFO: Network listener https-listener on port 0 disabled per domain.xml
    Mar 24, 2014 9:56:59 AM com.sun.enterprise.v3.services.impl.GrizzlyProxy$2$1 onR
    eady
    INFO: Grizzly Framework 1.9.46 started in: 65ms - bound to [0.0.0.0:8080]
    Mar 24, 2014 9:56:59 AM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: GlassFish Server Open Source Edition 3.1.2 (java_re-private) startup time
    : Embedded (510ms), startup services(491ms), total(1,001ms)
    Mar 24, 2014 9:56:59 AM org.glassfish.admin.mbeanserver.JMXStartupService$JMXCon
    nectorsStarterThread run
    INFO: JMX006: JMXStartupService had disabled JMXConnector system
    Mar 24, 2014 9:56:59 AM PluginUtil startGlassFish
    INFO: Started GlassFish ServerId = maven, GlassFish = com.sun.enterprise.glassfi
    sh.bootstrap.StaticGlassFishRuntime$1@1fe55fd, TimeTaken = 678 ms
    Mar 24, 2014 9:56:59 AM PluginUtil doDeploy
    INFO: Deployed null
    Hit ENTER to redeploy, X to exit
    
  4. 注意:当我按X并退出时,我会收到如下消息:

        Mar 24, 2014 12:01:43 PM PluginUtil doUndeploy
        INFO: Deployer = com.sun.enterprise.admin.cli.embeddable.DeployerImpl@1a3af98
        PlainTextActionReporterFAILUREApplication RestHelloApp is not deployed on this
        arget [server]Mar 24, 2014 12:01:43 PM PluginUtil doUndeploy
        INFO: Undeployed RestHelloApp
        [INFO] ------------------------------------------------------------------------
        [INFO] BUILD SUCCESS
        [INFO] ------------------------------------------------------------------------
        [INFO] Total time: 02:46 min
        [INFO] Finished at: 2014-03-24T12:01:43+05:30
        [INFO] Final Memory: 15M/37M
        [INFO] ------------------------------------------------------------------------
    
    1. 当我尝试在浏览器中测试应用程序时,我收到http错误404。
    2. 你可以帮我解决一下:

      1. 如何知道服务器是否真正在运行?

      2. 我在这里缺少什么?

      3. 这是我的POM.xml:

            <project xmlns="http://maven.apache.org/POM/4.0.0"        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-  v4_0_0.xsd">
            <modelVersion>4.0.0</modelVersion>
            <groupId>org.xerox</groupId>
            <artifactId>RestHelloApp</artifactId>
            <packaging>war</packaging>
            <version>1.0-SNAPSHOT</version>
            <name>RestHelloApp</name>
            <build>
            <finalName>RestHelloApp</finalName>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <inherited>true</inherited>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.glassfish.embedded</groupId>
                    <artifactId>maven-embedded-glassfish-plugin</artifactId>
                    <version>3.1.2</version>  
                    <configuration>    
                    <user>admin</user>
                    <adminPassword>admin</adminPassword>
                    <goalPrefix>glassfish</goalPrefix>
                    <app>target/RestHelloApp-1.0-SNAPSHOT.war</app>
                    <port>8080</port>
                    <contextRoot>RestHelloApp</contextRoot>
                    <name>RestHelloApp</name>
                    <glassfishDirectory>C:\glassfish3</glassfishDirectory>
        
                    </configuration>  
                        <executions>
                        <execution>
                            <phase>install</phase>
                            <goals>
                                 <goal>run</goal>
                            </goals>
                        </execution>
                    </executions>    
                </plugin>       
            </plugins>
            </build>
        
        
            <dependencies>
            <dependency>
                <groupId>com.sun.jersey</groupId>
                <artifactId>jersey-grizzly2</artifactId>
                <version>${jersey-version}</version>
            </dependency>
            <dependency>
                <groupId>com.sun.jersey</groupId>
                <artifactId>jersey-server</artifactId>
                <version>${jersey-version}</version>
            </dependency>
            <dependency>
                <groupId>com.sun.jersey</groupId>
                <artifactId>jersey-json</artifactId>
                <version>${jersey-version}</version>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.8.2</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.sun.jersey</groupId>
                <artifactId>jersey-client</artifactId>
                <version>${jersey-version}</version>
                <scope>test</scope>
            </dependency>
        
        
            <dependency>
                  <groupId>org.drools</groupId>
                  <artifactId>drools-compiler</artifactId>
                  <version>5.6.0.Final</version>
            </dependency>
            <dependency>
                  <groupId>mysql</groupId>
                  <artifactId>mysql-connector-java</artifactId>
                  <version>5.1.29</version>
                  <scope>runtime</scope>
            </dependency>
            <dependency>
                  <groupId>org.hibernate.javax.persistence</groupId>
                  <artifactId>hibernate-jpa-2.0-api</artifactId>
                  <version>1.0.1.Final</version>
            </dependency>
            <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-entitymanager</artifactId>
                  <version>4.2.8.Final</version>
            </dependency>
            <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-core</artifactId>
                  <version>4.2.8.Final</version>
            </dependency>
            <dependency>
                  <groupId>org.json</groupId>
                  <artifactId>json</artifactId>
                  <version>20140107</version>
            </dependency>
            <dependency>
                  <groupId>commons-codec</groupId>
                  <artifactId>commons-codec</artifactId>
                  <version>20041127.091804</version>
            </dependency>
             <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-project</artifactId>
            <version>3.0-alpha-2</version>
            <scope>provided</scope>
            </dependency>
            <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>3.2.1</version>
            <scope>provided</scope>
        
            </dependency>
            <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-artifact</artifactId>
            <version>3.2.1</version>
            <scope>provided</scope>
            </dependency>
        
        
        <dependency>
                <groupId>org.glassfish.distributions</groupId>
                <artifactId>web-all</artifactId>
                <version>10.0-build-20080430</version>
                <scope>test</scope>
        
            </dependency>
        
        
            <dependency>
                <groupId>org.glassfish.embedded</groupId>
                <artifactId>gf-embedded-api</artifactId>
                <version>1.0-alpha-4</version>
                <scope>test</scope>
        
        
            </dependency>
        
        
            </dependencies>
        
        
        
            <properties>
              <jersey-version>1.8</jersey-version>
            </properties>
        
        
            <repositories>
        
        
            <repository>
                <id>glassfish.java.net</id>
                <name>GlassFish Maven Repository</name>
                <url>http://central.maven.org/maven2/org/glassfish/embedded/maven-embedded-  glassfish-plugin/3.1.2/</url>
                <layout>default</layout>
            </repository>
            <repository>
                <id>m2.java.net</id>
                <name>Java.net Maven 2 Repository</name>
                <url>http://central.maven.org/maven2/org/glassfish/embedded/maven-embedded- glassfish-plugin/3.1.2/</url>
                <layout>default</layout>
            </repository>        
            </repositories>
        
        
        
            <pluginRepositories>
            <pluginRepository>
                <id>maven2-repository.dev.java.net</id>
                <name>Java.net Maven 2 Repository</name>
                <url>http://download.java.net/maven/glassfish/</url>
        
            </pluginRepository>
        
            </pluginRepositories>  
            </project>
        

0 个答案:

没有答案