Glassfish错误生命周期处理java.nio.BufferUnderflowException期间的异常

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Glassfish错误生命周期处理java.nio.BufferUnderflowException期间的异常相关的知识,希望对你有一定的参考价值。

为什么我会收到以下错误

Exception during lifecycle processing
java.nio.BufferUnderflowException
at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:151)
.....

在错误之前我得到了多个

  Unknow type constant pool 0 at position65

池编号和位置编号更改。

当我部署耳朵文件它工作正常,错误只在我重新启动服务器(系统或glassfish)后出现。

关于在哪里寻找问题的一些帮助/提示将非常有用。

更新请从日志文件中查找更多详细信息

[2015-05-21T02:37:14.427+0530] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.tools.deployment.dol] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1432156029153] [timeMillis: 1432156034427] [levelValue: 1000] [[
Unknow type constant pool 0 at position63]]

[2015-05-21T02:37:14.427+0530] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.tools.deployment.dol] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1432156029153] [timeMillis: 1432156034427] [levelValue: 1000] [[
 Unknow type constant pool 0 at position65]]

[2015-05-21T02:37:14.427+0530] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1432156029153] [timeMillis: 1432156034427] [levelValue: 1000] [[
 Exception while deploying the app [TEST_APP]]]

[2015-05-21T02:37:14.428+0530] [glassfish 4.1] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1432156029153] [timeMillis: 1432156034428] [levelValue: 1000] [[
  Exception during lifecycle processing
java.nio.BufferUnderflowException
at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:151)
at com.sun.enterprise.deployment.annotation.introspection.ConstantPoolInfo.containsAnnotation(ConstantPoolInfo.java:86)
at com.sun.enterprise.deployment.annotation.introspection.ClassFile.containsAnnotation(ClassFile.java:133)
at com.sun.enterprise.deployment.annotation.introspection.ClassFile.containsAnnotation(ClassFile.java:87)
at com.sun.enterprise.deployment.util.AnnotationDetector.containsAnnotation(AnnotationDetector.java:157)
at com.sun.enterprise.deployment.util.AnnotationDetector.containsAnnotation(AnnotationDetector.java:146)
at com.sun.enterprise.deployment.util.AnnotationDetector.hasAnnotationInArchive(AnnotationDetector.java:137)
at com.sun.enterprise.deployment.archivist.ApplicationArchivist.getApplicationFromIntrospection(ApplicationArchivist.java:393)
at com.sun.enterprise.deployment.archivist.ApplicationArchivist.createApplication(ApplicationArchivist.java:264)
at org.glassfish.javaee.full.deployment.EarHandler.getApplicationHolder(EarHandler.java:578)
at org.glassfish.javaee.full.deployment.EarHandler.initCompositeMetaData(EarHandler.java:555)
at com.sun.enterprise.v3.server.ApplicationLifecycle.getSniffers(ApplicationLifecycle.java:655)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:358)
at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:406)
at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:243)
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:329)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:377)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:461)
at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:227)
at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:84)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2258)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:105)
at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1162)
at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1147)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
]]

[2015-05-21T02:37:14.437+0530] [glassfish 4.1] [SEVERE] [NCLS-CORE-00041] [javax.enterprise.system.core] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1432156029153] [timeMillis: 1432156034437] [levelValue: 1000] [[
  Application deployment failed: Exception while deploying the app [TEST_APP]]]
答案

在处理Java EE / JSF应用程序时,我遇到了同样的问题。虽然我不确定确切的原因,但我通过逐渐删除EJB和WAR文件的组件并每次重新部署来缩小它,直到达到不同的错误。

结果问题发生在我的一个EJB类中。我对类进行了一些小的更改(例如,将循环更改为函数表达式),重建并在之后部署完成。

这似乎是应用程序服务器中的一个错误,因为看似无关的代码更改使问题消失了。

另一答案

当你得到这样的行为时,它确实意味着你不应该使用更高的Java语法而不是服务器环境可以提供的语法。例如,Java 8中的lambda表达式可能会降低Glassfish 4.1.1上的部署

以上是关于Glassfish错误生命周期处理java.nio.BufferUnderflowException期间的异常的主要内容,如果未能解决你的问题,请参考以下文章

如何修复('throw er; //未处理'错误'事件')代码生命周期?

Spring Security 部署失败:生命周期方法 [initialize] 不得抛出已检查异常

service方法doGet方法doPost方法的区别和一些常见错误 Servlet的生命周期

React 组件的生命周期

React的生命周期你可以知道

react组件通信与生命周期