2016-05-31 132 views
2

我使用NetBeans 8.1,MySQL服务器,Glassfish的4.1的EclipseLink作为JPA提供商,新泽西州的JAX-RS提供者,并试图部署以下简单步骤:无法部署JavaEE应用到GlassFish 4.1

  • 设置Glassfish的4.1与MySQL连接池和数据源的
  • 生成与EJB和WAR模块标准的JavaEE应用
  • 增加了一些@Entity注解的类
  • 增加了一个persistence.xml中的EJB-和战争项目
  • 由Netbeans 8.1从我的实体类自动生成的RESTful类

该项目建立得很好。但尝试部署EAR文件到GlassFish 4.1应用服务器我在控制台收到以下错误消息时:

GlassFish Server 4.1, deploy, Can not read HTTP response, caught IOException, false 
/Users/nicolas/Workspace (Java)/TestProject/nbproject/build-impl.xml:332: The module has not been deployed. 
See the server log for details. 

和Glassfish上登录我阅读以下内容:

Exception while preparing the app : Unable to load the EJB module. DeploymentContext does not contain any EJB. Check the archive to ensure correct packaging for /Users/nicolas/Workspace (Java)/OilImperium/dist/gfdeploy/TestProject/TestProject-war_war. If you use EJB component annotations to define the EJB, and an ejb or web deployment descriptor is also used, please make sure that the deployment descriptor references a Java EE 5 or higher version schema, and that the metadata-complete attribute is not set to true, so the component annotations can be processed as expected java.lang.RuntimeException: Unable to load the EJB module. DeploymentContext does not contain any EJB. Check the archive to ensure correct packaging for /Users/nicolas/Workspace (Java)/TestProject/dist/gfdeploy/TestProject/TestProject-war_war. If you use EJB component annotations to define the EJB, and an ejb or web deployment descriptor is also used, please make sure that the deployment descriptor references a Java EE 5 or higher version schema, and that the metadata-complete attribute is not set to true, so the component annotations can be processed as expected 
at org.glassfish.ejb.startup.EjbDeployer.prepare(EjbDeployer.java:190) 
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925) 
at org.glassfish.javaee.full.deployment.EarDeployer.prepareBundle(EarDeployer.java:309) 
at org.glassfish.javaee.full.deployment.EarDeployer.access$200(EarDeployer.java:88) 
at org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:155) 
at org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:152) 
at org.glassfish.javaee.full.deployment.EarDeployer.doOnBundles(EarDeployer.java:232) 
at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllTypedBundles(EarDeployer.java:241) 
at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllBundles(EarDeployer.java:270) 
at org.glassfish.javaee.full.deployment.EarDeployer.prepare(EarDeployer.java:152) 
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925) 
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:434) 
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219) 
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535) 
at java.security.AccessController.doPrivileged(Native Method) 
at javax.security.auth.Subject.doAs(Subject.java:360) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557) 
at java.security.AccessController.doPrivileged(Native Method) 
at javax.security.auth.Subject.doAs(Subject.java:360) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846) 
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722) 
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534) 
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224) 
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189) 
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459) 
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) 
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201) 
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175) 
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) 
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133) 
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112) 
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) 
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561) 
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) 
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) 
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56) 
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) 
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565) 
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545) 
at java.lang.Thread.run(Thread.java:745) 

此外, @实体类似乎没有受到战争-项目中找到:

Class [ ch/baumgardt/model/Well ] not found. Error while loading [ class service.WellFacadeREST ] 

...更多:

Class [ ch/baumgardt/model/Player ] not found. Error while loading [ class service.PlayerFacadeREST ] 

有人有什么想法我可能做错了什么?

回答

0

重新启动Glassfish,清理WAR文件和WEB_INF/lib文件夹。 `Please Check out 或者你可以在netbeans的帮助下创建Restful web服务。 创建一个java包然后 右键单击CustomerDB节点,然后从数据库中选择新建>其他> Web服务> RESTful Web服务。 “新建REST风格的Web服务”向导将在“数据库表”面板上打开。 我希望它的帮助

+0

感谢您的回复。我已经使用JDK 8和GF 4.1,我尝试了你的建议,但仍然是同样的问题... – salocinx

+0

感谢您的更新。您发布的文本片段与我已经完成的教程完全相同。但问题似乎是在Netbeans或Glassfish中。 – salocinx

1

可能是您的服务器不能访问netbeans。测试它与工作.war文件看到服务器给出相同的错误。

相关问题