2

我的 EJB3.1 应用程序出现了一个奇怪的异常,ZipException在应用程序部署期间抛出了一个异常:

[#|2010-05-15T16:01:44.688+0100|SEVERE|glassfish3.0.1|javax.enterprise.system.container.web.org.glassfish.web.loader|_ThreadID=22;_ThreadName=Thread-1;|WEB9051: Error trying to scan the classes at /Users/kevin/Documents/netbeans/WebAlbums/trunk/WebAlbums3/WebAlbums3-ea/dist/gfdeploy/WebAlbums3-Service.jar for annotations in which a ServletContainerInitializer has expressed interest
java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:114)
    at java.util.jar.JarFile.<init>(JarFile.java:133)
    at java.util.jar.JarFile.<init>(JarFile.java:70)
    at org.glassfish.web.loader.ServletContainerInitializerUtil.getInitializerList(ServletContainerInitializerUtil.java:255)
    at org.apache.catalina.core.StandardContext.callServletContainerInitializers(StandardContext.java:5331)
    at com.sun.enterprise.web.WebModule.callServletContainerInitializers(WebModule.java:550)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5263)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:499)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:928)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1947)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1619)
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:90)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
    at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
    at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
    at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
    at java.lang.Thread.run(Thread.java:637)
|#]

我真的不知道如何调查这个错误;我知道这与 Glassfish 安装无关(在 Ubuntu 和 Mac 上也有同样的问题)。


编辑:( 类路径细节似乎没用)

.../WebAlbums3-ea/dist/gfdeploy/WebAlbums3-Service.jar 的问题是这个文件实际上并不存在于 Glassfish 正在寻找它的地方......相反,我有一个名为 WebAlbums3-Service_jar的文件夹


(我正在使用 Netbeans 6.8、Glassfish v3、Servlet3、EJB 3.1、JPA/Hibernate)

谢谢您的帮助

编辑:通过在定义实现的位置之外提取 EJB 接口解决了问题(ZipException 和已加载的 EJB)(实现类与每个模块一起加载,因此 EJB 异常)

4

4 回答 4

1

Error trying to scan the classes at /Users/kevin/Documents/netbeans/WebAlbums/trunk/WebAlbums3/WebAlbums3-ea/dist/gfdeploy/WebAlbums3-Service.jar for annotations in which a ServletContainerInitializer has expressed interest

java.util.zip.ZipException: error in opening zip file

Look like the JAR file is corrupted. Recompile/replace it. If you're FTP'ing this during deploying, take care that you send binary files as binary data, not as text data.

This can also be caused by the temp storage being full or not writable.

Update: Google learns me that this may also be JDK specific. Try upgrading JDK to the latest.

于 2010-05-15T17:26:33.147 回答
1

我在网络上看到过多次提到这个问题,比如这个提到它是非阻塞的:

如果您在部署 EAR 后收到以下错误,请不要担心,这很正常:“WEB9051: Error trying to scan the classes at .../eclipseApps/Seven/SevenEJB.jar for an annotations in which a ServletContainerInitializer has expressed interest ”。看这里。

并且也在Issue 11149Issue 11341中。您的情况似乎有所不同,但如果不是(如果您有一个文件名中带有“+”的 jar),则应在 GF v3.0.1 中修复。

如果这不适用于您,我建议创建一个问题。即使没有阻塞,这显然也不正常。

于 2010-05-15T18:04:31.593 回答
0

你能用winzip或7zip打开zip文件吗?您可以使用 ZipFile 以编程方式打开文件吗?我确信其中一个问题将评估为假。

前段时间我遇到了一些奇怪的 zip 错误,这些错误与包含文件名称中的特殊字符(其中特殊表示非 ASCII 字符)有关。

于 2010-05-15T18:17:24.190 回答
0

有一个“_”而不是一个“。” 当您使用爆炸部署时是正常的(这就是应该部署爆炸工件的方式)

这可能是“正常的”,但 GF 正在寻找一个不存在的 myEJB.jar 文件。只有一个爆炸的人工制品,然后不会被部署。

该问题(ZipException 和已加载的 EJB)通过在定义实现的位置之外提取 EJB 接口得到解决(实现类与每个模块一起加载,因此出现 EJB 异常)

不确定我是否理解这如何解决上述问题。我的实现类是一个单独的消息 bean。

于 2011-01-06T12:44:17.600 回答