glassfish:在部署应用程序时IOException:无效的zip文件 [英] glassfish: while deploying the app IOException: invalid zip file

查看:157
本文介绍了glassfish:在部署应用程序时IOException:无效的zip文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在通过CLI部署EAR时,会发生此错误:

 部署应用程序时出现异常[EnterpriseLegacy]:java。 io.IOException:无效的zip文件:file:/home/thufir/glassfish-4.1/glassfish/domains/domain1/application /EnterpriseLegacy/lib/RemoteEJB.jar 

然而,Netbeans在IDE内部署了相同的EAR罚款。



我认为问题在于EJB模块依赖于远程接口, RemoteEJB ,它构建为JAR。这个JAR包含在EAR中,但我不相信这是足够的。我试过把它放在 glassfish-4.1 / glassfish / domains / domain1 / lib / ext / glassfish-4.1 / glassfish / lib / ,但是,这不会解决或更改异常。



问题是 RemoteEJB JAR需要在glassfish上可用?在这个EJB实现这个接口之前,它部署得很好。 (EJB实现远程接口的原因是EJB可用于Web模块。)



在Netbeans之前和之后进行部署:

  thufir @ dur:〜$ 
thufir @ dur:〜$ glassfish-4.1 / glassfish / bin / asadmin list-applications
没有列出。
没有应用程序部署到此目标服务器。
命令列表 - 应用程序已成功执行。
thufir @ dur:〜$
thufir @ dur:〜$ glassfish-4.1 / glassfish / bin / asadmin list-applications
EnterpriseLegacy< ear,web,ejb>
命令列表 - 应用程序已成功执行。
thufir @ dur:〜$

Netbeans部署的glassfish日志:

  [2014-10-02T22:04:41.808-0700] [glassfish 4.1] [INFO] [AS-EJB-00054] [javax。 enterprise.ejb.container] [tid:_ThreadID = 39 _ThreadName = admin-listener(1)] [timeMillis:1412312681808] [levelValue:800] [[
] EJB MySingletonQueue的可移植JNDI名称:[java:global / EnterpriseLegacy /EnterpriseLegacy-ejb/MySingletonQueue!db.RemoteQueue,JAVA:全球/ EnterpriseLegacy / EnterpriseLegacy的EJB / MySingletonQueue]]]

[2014-10-02T22:04:41.914-0700] [GlassFish的4.1] [WARN] [] [org.jboss.weld.Event] [tid:_ThreadID = 39 _ThreadName = admin-listener(1)] [timeMillis:1412312681914] [levelValue:900] [[
WELD-000411:Observer方法[BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType< Object> ;, BeanManager)接收所有注释类型的事件。考虑限制事件使用@WithAnnotations或带有界限的泛型。]]

[2014-10-02T22:04:41.926-0700] [glassfish 4.1] [WARN] [] [org.jboss。 [org.glassfish.jms] [org.glassfish.jms] [ted:_ThreadID = 39 _ThreadName = admin-listener(1)] [timeMillis:1412312681926] [levelValue:900] [[
WELD-000411:Observer method [BackedAnnotatedMethod] .injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType< Object>)接收所有注释类型的事件。考虑限制事件使用@WithAnnotations或具有界限的泛型。]]

[2014-10-02T22:04:41.929-0700] [glassfish 4.1] [警告] [] [org.jboss。公共org.glassfish.jms WELD-000411:Observer方法[BackedAnnotatedMethod] public org.glassfish.jms [0] [0] [0] [0] .injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType< Object>)接收所有注释类型的事件。考虑限制事件使用@WithAnnotations或带范围的泛型。]]

[2014-10-02T22:04:41.939-0700] [glassfish 4.1] [警告] [] [org.jboss。 weld.Event] [tid:_ThreadID = 39 _ThreadName = admin-listener(1)] [timeMillis:1412312681939] [levelValue:900] [[
WELD-000411:Observer method [BackedAnnotatedMethod] private org.glassfish.jersey .gf.cdi.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType< Object>)接收所有注释类型的事件。考虑限制事件使用@WithAnnotations或带范围的泛型。]]

[2014-10-02T22:04:41.950-0700] [glassfish 4.1] [警告] [] [org.jboss。焊接事件] [tid:_ThreadID = 39 _ThreadName = admin-listener(1)] [timeMillis:1412312681950] [levelValue:900] [[
WELD-000411:Observer method [BackedAnnotatedMethod] org.glassfish.sse。 impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType< Object> ;, BeanManager)接收所有注释类型的事件。考虑限制事件使用@WithAnnotations或具有界限的泛型。]]

[2014-10-02T22:04:41.954-0700] [glassfish 4.1] [警告] [] [org.jboss。 weld.Event] [tid:_ThreadID = 39 _ThreadName = admin-listener(1)] [timeMillis:1412312681954] [levelValue:900] [[
WELD-000411:Observer method [BackedAnnotatedMethod] private org.glassfish.jersey .gf.cdi.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType< Object>)接收所有注释类型的事件。考虑限制事件使用@WithAnnotations或带有界限的泛型。]]

[2014-10-02T22:04:42.523-0700] [glassfish 4.1] [INFO] [jsf.config.listener。版本] [javax.enterprise.resource.webcontainer.jsf.config] [TID:_ThreadID = 39 _ThreadName =管理侦听(1)] [timeMillis:1412312682523] [levelValue:800] [[
初始化钻嘴鱼科2.2。 7(20140610-1547)https://svn.java.net/svn/mojarra~svn/tags/2.2.7@13362)上下文'/ EnterpriseLegacy-war']]

[2014- 10-02T22:04:43.199-0700] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid:_ThreadID = 39 _ThreadName = admin-listener(1)] [timeMillis :1412312683199] [levelValue:800] [[
在[EnterpriseLegacy-war]]]

[2014-10-02T22:04: 43.267-0700] [glassfish 4.1] [INFO] [] [javax.enterprise.system.core] [tid:_ThreadID = 39 _ThreadName = admin-listener(1)] [timeMillis:1412312683267] [levelValue:800] [[
EnterpriseLe gacy已成功部署在2,144毫秒。]]

,并且从Netbeans部署时web模块按预期运行。如何将EAR手动部署到Glassfish?



从CLI部署EAR:

  thufir @ dur:〜$ 
thufir @ dur:〜$ glassfish-4.1 / glassfish / bin / asadmin list-applications
无法列出。
没有应用程序部署到此目标服务器。
命令列表 - 应用程序已成功执行。
thufir @dur:〜$
thufir @dur:〜$ glassfish-4.1 / glassfish / bin / asadmin部署NetBeansProjects / EnterpriseLegacy / dist / EnterpriseLegacy.ear
远程故障:部署期间发生错误:部署应用程序时出现异常[EnterpriseLegacy]:java.io.IOException:无效的zip文件:file:/home/thufir/glassfish-4.1/glassfish/domains/domain1/applications/EnterpriseLegacy/lib/RemoteEJB.jar。有关更多详细信息,请参阅server.log。
命令部署失败。
thufir @ dur:〜

glassfish手动部署失败日志:

  [2014-10-02T21:20:47.809-0700] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.core ] [tid:_ThreadID = 40 _ThreadName = admin-listener(3)] [timeMillis:1412310047809] [levelValue:1000] [[
部署应用程序时出现异常[EnterpriseLegacy]:java.io.IOException:无效的zip文件:file:/home/thufir/glassfish-4.1/glassfish/domains/domain1/applications/EnterpriseLegacy/lib/RemoteEJB.jar
java.io.IOException:无效的zip文件:file:/ home / thufir / glassfish- 4.1 / glassfish / domains / domain1 / applications / EnterpriseLegacy / lib / RemoteEJB.jar
at com.sun.enterprise.deployment.deploy.shared.InputJarArchive $ ArchiveJarEntrySource。< init>(InputJarArchive.java:582)
at com.sun.enterprise.deployment.deploy.shared.InputJarArchive $ ArchiveJarEntrySource。< init>(InputJarArchive.java:573)
at com.sun.enterprise.deployment.deploy.shared.InputJa在com.sun.enterprise.deployment.deploy.shared.InputJarArchive.entries(InputJarArchive.java:203)
的com.sun.enterprise.deployment中,rArchive.createEntryEnum(InputJarArchive.java:451)
。部署.shared.InputJarArchive.access $ 100(InputJarArchive.java:74)
在com.sun.enterprise.deployment.deploy.shared.InputJarArchive $ 1.enumeration(InputJarArchive.java:166)
at com。 sun.enterprise.deployment.deploy.shared.InputJarArchive $ CollectionWrappedEnumeration。< init>(InputJarArchive.java:728)
at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.getDirectories(InputJarArchive.java:
org.glassfish.javaee.full.deployment.EarDetector.handles(EarDetector.java: 110)
在org.glassfish.deployment.common.DeploymentUtils.isArchiveOfType(DeploymentUtils.java:213)
在org.glassfish.deployment.common.DeploymentUtils.isAr chiveOfType(DeploymentUtils.java:225)
at org.glassfish.resources.util.ResourceUtil.hasResourcesXML(ResourceUtil.java:63)
at org.glassfish.resources.util.ResourceUtil.hasResourcesXML(ResourceUtil。的java:在org.glassfish.resources.connector.ResourcesCompositeSniffer.handles 76)
(ResourcesCompositeSniffer.java:83)
。在org.glassfish.internal.deployment.GenericSniffer.handles(GenericSniffer.java:105)在com.sun.enterprise.v3.server.SnifferManagerImpl.getSniffers(SnifferManagerImpl.java:145)

在com.sun.enterprise.v3.server.SnifferManagerImpl.getSniffers(SnifferManagerImpl.java:132)在com.sun.enterprise.v3.server.ApplicationLifecycle.getSniffers(ApplicationLifecycle.java:658)

在com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:358)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execu te(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:356)$在com.sun.enterprise.v3.admin.CommandRunnerImpl $ 2.execute b $ b(CommandRunnerImpl.java:534)
在com.sun.enterprise.v3.admin.CommandRunnerImpl $ 3.run(CommandRunnerImpl.java:565 )
在com.sun.enterprise.v3.admin.CommandRunnerImpl $ 3.run(CommandRunnerImpl.java:557)$ b $在java.security.AccessController.doPrivileged(本地方法)$ b $在javax。 security.auth.Subject.doAs(Subject.java:356)
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.Comm andRunnerImpl.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 org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:404)
at org.glassfish .admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:234)
at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl。 java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory $ 1.invoke(ResourceMethodInvocationHandlerFactory.java :81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher $ 1.run(AbstractJav aResourceMethodDispatcher.java:151)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171)
at org.glassfish.jersey.server.model.internal。 JavaResourceMethodDispatcherProvider $ ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104)
at org.glassfish.jersey。 server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:387)
处org.glassfish.jersey org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:331)
。 server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:103)
在org.glassfish.jersey.server.ServerRuntime $ 1.run(ServerRuntime.java:271)
在org.glassfish.jersey.internal错误$ 1.call(Errors.java:271)
在org.glassfish .jersey.internal.Errors $ 1.call(Errors.java:267)在org.glassfish.jersey.internal.Errors.process(Errors.java:315)
在org.glassfish.jersey处
。 internal.Errors.process(Errors.java:297)
在org.glassfish.jersey.internal.Errors.process(Errors.java:267)
在org.glassfish.jersey.process.internal。 RequestScope.runInScope(RequestScope.java:297)
位于org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:254)
位于org.glassfish.jersey.server.ApplicationHandler.handle( ApplicationHandler.java:1028)
在org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:365)
在org.glassfish.admin.rest.adapter.JerseyContainerCommandService $ 3.service (JerseyContainerCommandService.java:173)
at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)
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.HttpServerFilter.handleRead(HttpServerFilter.java:235)$ b $ org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
b。在org.glassfish.grizzly.filterchain.ExecutorResolver $ 9.execute(ExecutorResolver.java:119)$ b $在org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
b在组织.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.glassf ish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
处org.glassfish org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
。 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)
在org.glassfish.grizzly.threadpool.AbstractThreadPool $ Worker.doWork(AbstractThreadPool.java:565)
在org.glassfish.grizzly.threadpool .AbstractThreadPool $ Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:744)
]]

thufir @ dur: 〜$
thufir @dur:〜$

EJB实现这个远程接口: p>

package db;

import javax.ejb.Remote;

@Remote
public interface RemoteQueue {

  public int getNext(); 

}

code> EnterpriseLegacy-ejb 模块:



package db;

import javax.ejb.Singleton;

@Singleton
public class MySingletonQueue实现RemoteQueue {

  int i = 3; 

@Override
public int getNext(){
return i;
}

}

使用EJB和Web模块的 EnterpriseLegacy 结构:

  NetBeansProjects / EnterpriseLegacy / 
├──build.xml
├──EnterpriseLegacy-ejb
│├──build.xml
│├──nbproject
││├─ ─ant-deploy.xml
││├──build-impl.xml
││├──genfiles.properties
││├──private
│││├ ──private.properties
│││└──private.xml
││├──project.properties
││└──project.xml
│├──设置
││└──glassfish-resources.xml
│└──src
│├──conf
││├──MANIFEST.MF
│ │└──persistence.xml
│└──java
│└──db
│├──Clients.java
│├──ClientsJpaController.java
│├──例外
││├──IllegalOrphanException.java
││├──NonexistentEntityException.java
││ ├──PreexistingEntityException.java
││└──RollbackFailureException.java
│├──MySingletonQueue.java
│└──Queries.java
├──EnterpriseLegacy-war
│├──build.xml
│├──nbproject
││├──ant-deploy.xml
││├──build-impl.xml
││├──genfiles.properties
││├──私人
│││├──private.properties
│││└──private.xml
││├──project.properties
││└──project.xml
│├──setup
││└──sun-resources.xml
│├──src
││├──conf
│││└──MANIFEST.MF
││└──java
││└─ ─dur
││└──MySessionBean.java
│└──web
│├──index.xhtml
│├──menu.xhtml
│ ├──next.xhtml
│├──template.xhtml
│└──WEB-INF
│└──web.xml
├──nbproject
│├──ant-deploy.xml
│├──build-impl.xml
│├──genfiles.properties
│├──private
││├ ──private.properties
││└──private.xml
│├──project.properties
│└──project.xml
└──src
└──conf
└──MANIFEST.MF

请注意,当EAR是解压后,包含接口JAR(应该是这样):

  thufir @ dur:〜/ NetBeansProjects / EnterpriseLegacy / dist $ 
thufir @dur:〜/ NetBeansProjects / EnterpriseLegacy / dist $ ll lib /
总共1280
drwxrwxr-x 2 thufir thufir 4096 Oct 2 21:35 ./
drwxrwxr-x 4 thufir thufir 4096 Oct 2 21:36 ../
-rw-rw-r- - 1 thufir thufir 1302203 Oct 2 21:35 javaee-web-api-7.0.jar
-rw-rw-r-- 1 thufir thufir 0 10月2日21:35 RemoteEJB.jar
thufir @dur :〜/ NetBeansProjects / EnterpriseLegacy / dist $

不知何故Netbeans包括 RemoteEJB ,这是部署中的EJB接口。 Netbeans如何以及在何处将JAR部署到Glassfish?如果是,实际上是错误的根源。

解决方案

我现在有这个问题,它是由错误的JDBC资源名称。一旦我在persistence.xml中解决了这个问题,.ear就成功部署了。


In deploying the EAR through the CLI, this error occurs:

Exception while deploying the app [EnterpriseLegacy] : java.io.IOException: invalid zip file: file:/home/thufir/glassfish-4.1/glassfish/domains/domain1/application /EnterpriseLegacy/lib/RemoteEJB.jar

and yet, Netbeans deploys the same EAR fine from within the IDE.

I think the problem is that the EJB module depends on a remote interface, RemoteEJB which builds as a JAR. This JAR is included with the EAR, but I don't believe that's sufficient. I've tried placing it in glassfish-4.1/glassfish/domains/domain1/lib/ext/ and glassfish-4.1/glassfish/lib/, however, that doesn't resolve or change the exception.

Is the problem that the RemoteEJB JAR needs to be available on glassfish? Before this EJB implemented this interface, it deployed fine. (The reason the EJB implements a remote interface is so that the EJB is available for the web module.)

Deploying from within Netbeans, before and after:

thufir@dur:~$ 
thufir@dur:~$ glassfish-4.1/glassfish/bin/asadmin list-applications
Nothing to list.
No applications are deployed to this target server.
Command list-applications executed successfully.
thufir@dur:~$ 
thufir@dur:~$ glassfish-4.1/glassfish/bin/asadmin list-applications
EnterpriseLegacy  <ear, web, ejb>  
Command list-applications executed successfully.
thufir@dur:~$ 

glassfish log of deployment from Netbeans:

[2014-10-02T22:04:41.808-0700] [glassfish 4.1] [INFO] [AS-EJB-00054] [javax.enterprise.ejb.container] [tid: _ThreadID=39 _ThreadName=admin-listener(1)] [timeMillis: 1412312681808] [levelValue: 800] [[
  Portable JNDI names for EJB MySingletonQueue: [java:global/EnterpriseLegacy/EnterpriseLegacy-ejb/MySingletonQueue!db.RemoteQueue, java:global/EnterpriseLegacy/EnterpriseLegacy-ejb/MySingletonQueue]]]

[2014-10-02T22:04:41.914-0700] [glassfish 4.1] [WARN] [] [org.jboss.weld.Event] [tid: _ThreadID=39 _ThreadName=admin-listener(1)] [timeMillis: 1412312681914] [levelValue: 900] [[
  WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.]]

[2014-10-02T22:04:41.926-0700] [glassfish 4.1] [WARN] [] [org.jboss.weld.Event] [tid: _ThreadID=39 _ThreadName=admin-listener(1)] [timeMillis: 1412312681926] [levelValue: 900] [[
  WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.]]

[2014-10-02T22:04:41.929-0700] [glassfish 4.1] [WARN] [] [org.jboss.weld.Event] [tid: _ThreadID=39 _ThreadName=admin-listener(1)] [timeMillis: 1412312681929] [levelValue: 900] [[
  WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.]]

[2014-10-02T22:04:41.939-0700] [glassfish 4.1] [WARN] [] [org.jboss.weld.Event] [tid: _ThreadID=39 _ThreadName=admin-listener(1)] [timeMillis: 1412312681939] [levelValue: 900] [[
  WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.gf.cdi.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.]]

[2014-10-02T22:04:41.950-0700] [glassfish 4.1] [WARN] [] [org.jboss.weld.Event] [tid: _ThreadID=39 _ThreadName=admin-listener(1)] [timeMillis: 1412312681950] [levelValue: 900] [[
  WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.]]

[2014-10-02T22:04:41.954-0700] [glassfish 4.1] [WARN] [] [org.jboss.weld.Event] [tid: _ThreadID=39 _ThreadName=admin-listener(1)] [timeMillis: 1412312681954] [levelValue: 900] [[
  WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.gf.cdi.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.]]

[2014-10-02T22:04:42.523-0700] [glassfish 4.1] [INFO] [jsf.config.listener.version] [javax.enterprise.resource.webcontainer.jsf.config] [tid: _ThreadID=39 _ThreadName=admin-listener(1)] [timeMillis: 1412312682523] [levelValue: 800] [[
  Initializing Mojarra 2.2.7 ( 20140610-1547 https://svn.java.net/svn/mojarra~svn/tags/2.2.7@13362) for context '/EnterpriseLegacy-war']]

[2014-10-02T22:04:43.199-0700] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid: _ThreadID=39 _ThreadName=admin-listener(1)] [timeMillis: 1412312683199] [levelValue: 800] [[
  Loading application [EnterpriseLegacy#EnterpriseLegacy-war.war] at [EnterpriseLegacy-war]]]

[2014-10-02T22:04:43.267-0700] [glassfish 4.1] [INFO] [] [javax.enterprise.system.core] [tid: _ThreadID=39 _ThreadName=admin-listener(1)] [timeMillis: 1412312683267] [levelValue: 800] [[
  EnterpriseLegacy was successfully deployed in 2,144 milliseconds.]]

and the web module runs as expected when deployed from Netbeans. How can I deploy the EAR manually to Glassfish?

deploying the EAR from the CLI:

thufir@dur:~$ 
thufir@dur:~$ glassfish-4.1/glassfish/bin/asadmin list-applications
Nothing to list.
No applications are deployed to this target server.
Command list-applications executed successfully.
thufir@dur:~$ 
thufir@dur:~$ glassfish-4.1/glassfish/bin/asadmin deploy NetBeansProjects/EnterpriseLegacy/dist/EnterpriseLegacy.ear
remote failure: Error occurred during deployment: Exception while deploying the app [EnterpriseLegacy] : java.io.IOException: invalid zip file: file:/home/thufir/glassfish-4.1/glassfish/domains/domain1/applications/EnterpriseLegacy/lib/RemoteEJB.jar. Please see server.log for more details.
Command deploy failed.
thufir@dur:~$ 

glassfish log of failed manual deploy:

[2014-10-02T21:20:47.809-0700] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=40 _ThreadName=admin-listener(3)] [timeMillis: 1412310047809] [levelValue: 1000] [[
  Exception while deploying the app [EnterpriseLegacy] : java.io.IOException: invalid zip file: file:/home/thufir/glassfish-4.1/glassfish/domains/domain1/applications/EnterpriseLegacy/lib/RemoteEJB.jar
java.io.IOException: invalid zip file: file:/home/thufir/glassfish-4.1/glassfish/domains/domain1/applications/EnterpriseLegacy/lib/RemoteEJB.jar
    at com.sun.enterprise.deployment.deploy.shared.InputJarArchive$ArchiveJarEntrySource.<init>(InputJarArchive.java:582)
    at com.sun.enterprise.deployment.deploy.shared.InputJarArchive$ArchiveJarEntrySource.<init>(InputJarArchive.java:573)
    at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.createEntryEnumeration(InputJarArchive.java:451)
    at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.entries(InputJarArchive.java:203)
    at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.access$100(InputJarArchive.java:74)
    at com.sun.enterprise.deployment.deploy.shared.InputJarArchive$1.enumeration(InputJarArchive.java:166)
    at com.sun.enterprise.deployment.deploy.shared.InputJarArchive$CollectionWrappedEnumeration.<init>(InputJarArchive.java:728)
    at com.sun.enterprise.deployment.deploy.shared.InputJarArchive.getDirectories(InputJarArchive.java:161)
    at org.glassfish.javaee.full.deployment.EarDetector.isEARFromIntrospecting(EarDetector.java:142)
    at org.glassfish.javaee.full.deployment.EarDetector.handles(EarDetector.java:110)
    at org.glassfish.deployment.common.DeploymentUtils.isArchiveOfType(DeploymentUtils.java:213)
    at org.glassfish.deployment.common.DeploymentUtils.isArchiveOfType(DeploymentUtils.java:225)
    at org.glassfish.resources.util.ResourceUtil.hasResourcesXML(ResourceUtil.java:63)
    at org.glassfish.resources.util.ResourceUtil.hasResourcesXML(ResourceUtil.java:76)
    at org.glassfish.resources.connector.ResourcesCompositeSniffer.handles(ResourcesCompositeSniffer.java:83)
    at org.glassfish.internal.deployment.GenericSniffer.handles(GenericSniffer.java:105)
    at com.sun.enterprise.v3.server.SnifferManagerImpl.getSniffers(SnifferManagerImpl.java:145)
    at com.sun.enterprise.v3.server.SnifferManagerImpl.getSniffers(SnifferManagerImpl.java:132)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.getSniffers(ApplicationLifecycle.java:658)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:358)
    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:356)
    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:356)
    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 org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:404)
    at org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:234)
    at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171)
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:387)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:331)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:103)
    at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:297)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:254)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1028)
    at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:365)
    at org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:173)
    at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)
    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:744)
]]

thufir@dur:~$ 
thufir@dur:~$ 

The EJB implements this remote interface:

package db;

import javax.ejb.Remote;

@Remote public interface RemoteQueue {

public int getNext();

}

the EJB in the EnterpriseLegacy-ejb module:

package db;

import javax.ejb.Singleton;

@Singleton public class MySingletonQueue implements RemoteQueue {

int i = 3;

@Override
public int getNext() {
    return i;
}

}

the structure of EnterpriseLegacy with an EJB and web module:

NetBeansProjects/EnterpriseLegacy/
├── build.xml
├── EnterpriseLegacy-ejb
│   ├── build.xml
│   ├── nbproject
│   │   ├── ant-deploy.xml
│   │   ├── build-impl.xml
│   │   ├── genfiles.properties
│   │   ├── private
│   │   │   ├── private.properties
│   │   │   └── private.xml
│   │   ├── project.properties
│   │   └── project.xml
│   ├── setup
│   │   └── glassfish-resources.xml
│   └── src
│       ├── conf
│       │   ├── MANIFEST.MF
│       │   └── persistence.xml
│       └── java
│           └── db
│               ├── Clients.java
│               ├── ClientsJpaController.java
│               ├── exceptions
│               │   ├── IllegalOrphanException.java
│               │   ├── NonexistentEntityException.java
│               │   ├── PreexistingEntityException.java
│               │   └── RollbackFailureException.java
│               ├── MySingletonQueue.java
│               └── Queries.java
├── EnterpriseLegacy-war
│   ├── build.xml
│   ├── nbproject
│   │   ├── ant-deploy.xml
│   │   ├── build-impl.xml
│   │   ├── genfiles.properties
│   │   ├── private
│   │   │   ├── private.properties
│   │   │   └── private.xml
│   │   ├── project.properties
│   │   └── project.xml
│   ├── setup
│   │   └── sun-resources.xml
│   ├── src
│   │   ├── conf
│   │   │   └── MANIFEST.MF
│   │   └── java
│   │       └── dur
│   │           └── MySessionBean.java
│   └── web
│       ├── index.xhtml
│       ├── menu.xhtml
│       ├── next.xhtml
│       ├── template.xhtml
│       └── WEB-INF
│           └── web.xml
├── nbproject
│   ├── ant-deploy.xml
│   ├── build-impl.xml
│   ├── genfiles.properties
│   ├── private
│   │   ├── private.properties
│   │   └── private.xml
│   ├── project.properties
│   └── project.xml
└── src
    └── conf
        └── MANIFEST.MF

note that when the EAR is unzipped, the interface JAR is included (as it should be):

thufir@dur:~/NetBeansProjects/EnterpriseLegacy/dist$ 
thufir@dur:~/NetBeansProjects/EnterpriseLegacy/dist$ ll lib/
total 1280
drwxrwxr-x 2 thufir thufir    4096 Oct  2 21:35 ./
drwxrwxr-x 4 thufir thufir    4096 Oct  2 21:36 ../
-rw-rw-r-- 1 thufir thufir 1302203 Oct  2 21:35 javaee-web-api-7.0.jar
-rw-rw-r-- 1 thufir thufir       0 Oct  2 21:35 RemoteEJB.jar
thufir@dur:~/NetBeansProjects/EnterpriseLegacy/dist$ 

Somehow Netbeans is including RemoteEJB, which is the interface for the EJB, in the deployment. How and where is Netbeans deploying the JAR to Glassfish? If that is, in fact, the source of the error.

解决方案

I had this problem right now and it was being caused by a wrong JDBC resource name. Once I fixed this in persistence.xml the .ear deployed successfully.

这篇关于glassfish:在部署应用程序时IOException:无效的zip文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆