JavaEE + Glassfish - BufferUnderflowException
JavaEE + Glassfish - BufferUnderflowException
我有一个非常简单的 Java EE 应用程序,其中包含一些使用 JMS 进行通信的 bean。当我尝试部署和调试我的应用程序时,我得到了这个
Informazioni: visiting unvisited references
Grave: Unknow type constant pool 18 at position38
Grave: Unknow type constant pool 0 at position39
Grave: Unknow type constant pool 0 at position40
Grave: Unknow type constant pool 105 at position43
Grave: Unknow type constant pool 116 at position44
Grave: Unknow type constant pool 101 at position45
Grave: Unknow type constant pool 32 at position46
Grave: Unknow type constant pool 108 at position47
Grave: Unknow type constant pool -30 at position48
Grave: Unknow type constant pool -128 at position49
Grave: Unknow type constant pool -103 at position50
Grave: Unknow type constant pool 105 at position51
Grave: Unknow type constant pool 110 at position52
Grave: Unknow type constant pool 110 at position53
Grave: Unknow type constant pool 111 at position54
Grave: Unknow type constant pool 118 at position55
Grave: Unknow type constant pool 97 at position56
Grave: Unknow type constant pool 116 at position57
Grave: Unknow type constant pool 105 at position58
Grave: Unknow type constant pool 118 at position59
Grave: Unknow type constant pool 97 at position60
Grave: Unknow type constant pool 32 at position61
Grave: Unknow type constant pool 116 at position62
Grave: Unknow type constant pool 101 at position63
Grave: Unknow type constant pool 99 at position64
Grave: Unknow type constant pool 110 at position65
Grave: Unknow type constant pool 111 at position66
Grave: Unknow type constant pool 108 at position67
Grave: Unknow type constant pool 111 at position68
Grave: Unknow type constant pool 103 at position69
Grave: Unknow type constant pool 105 at position70
Grave: Unknow type constant pool 97 at position71
Grave: Unknow type constant pool 32 at position72
Grave: Unknow type constant pool 68 at position73
Grave: Unknow type constant pool 111 at position74
Grave: Unknow type constant pool 119 at position75
Grave: Unknow type constant pool 110 at position76
Grave: Unknow type constant pool 108 at position77
Grave: Unknow type constant pool 111 at position78
Grave: Unknow type constant pool 97 at position79
Grave: Unknow type constant pool 100 at position80
Grave: Unknow type constant pool 32 at position81
Grave: Unknow type constant pool 66 at position82
Grave: Unknow type constant pool 111 at position83
Grave: Unknow type constant pool 111 at position84
Grave: Unknow type constant pool 115 at position85
Grave: Unknow type constant pool 116 at position86
Grave: Unknow type constant pool 101 at position87
Grave: Unknow type constant pool 114 at position88
Grave: Unknow type constant pool 44 at position89
Grave: Unknow type constant pool 32 at position90
Grave: Unknow type constant pool 112 at position91
Grave: Unknow type constant pool 111 at position92
Grave: Unknow type constant pool 116 at position93
Grave: Unknow type constant pool 114 at position94
Grave: Unknow type constant pool 97 at position95
Grave: Unknow type constant pool 105 at position96
Grave: Unknow type constant pool 32 at position97
Grave: Unknow type constant pool 97 at position98
Grave: Unknow type constant pool 117 at position99
Grave: Unknow type constant pool 109 at position100
Grave: Unknow type constant pool 101 at position101
Grave: Unknow type constant pool 110 at position102
Grave: Unknow type constant pool 116 at position103
Grave: Unknow type constant pool 97 at position104
Grave: Unknow type constant pool 114 at position105
Grave: Unknow type constant pool 101 at position106
Grave: Unknow type constant pool 32 at position107
Grave: Unknow type constant pool 115 at position108
Grave: Unknow type constant pool 105 at position109
Grave: Unknow type constant pool 103 at position110
Grave: Unknow type constant pool 110 at position111
Grave: Unknow type constant pool 105 at position112
Grave: Unknow type constant pool 102 at position113
Grave: Unknow type constant pool 105 at position114
Grave: Unknow type constant pool 99 at position115
Grave: Unknow type constant pool 97 at position116
Grave: Unknow type constant pool 116 at position117
Grave: Unknow type constant pool 105 at position118
Grave: Unknow type constant pool 118 at position119
Grave: Unknow type constant pool 97 at position120
Grave: Unknow type constant pool 109 at position121
Grave: Unknow type constant pool 101 at position122
Grave: Unknow type constant pool 110 at position123
Grave: Unknow type constant pool 116 at position124
Grave: Unknow type constant pool 101 at position125
Grave: Unknow type constant pool 32 at position126
Grave: Unknow type constant pool 108 at position127
Grave: Unknow type constant pool 97 at position128
Grave: Unknow type constant pool 32 at position129
Grave: Unknow type constant pool 118 at position130
Grave: Unknow type constant pool 101 at position131
Grave: Unknow type constant pool 108 at position132
Grave: Unknow type constant pool 111 at position133
Grave: Unknow type constant pool 99 at position134
Grave: Unknow type constant pool 105 at position135
Grave: Unknow type constant pool 116 at position136
Grave: Unknow type constant pool -61 at position137
Grave: Unknow type constant pool -96 at position138
Grave: Unknow type constant pool 32 at position139
Grave: Unknow type constant pool 100 at position140
Grave: Unknow type constant pool 105 at position141
Grave: Unknow type constant pool 32 at position142
Grave: Unknow type constant pool 100 at position143
Grave: Unknow type constant pool 111 at position144
Grave: Unknow type constant pool 119 at position145
Grave: Unknow type constant pool 110 at position146
Grave: Unknow type constant pool 108 at position147
Grave: Unknow type constant pool 111 at position148
Grave: Unknow type constant pool 97 at position149
Grave: Unknow type constant pool 100 at position150
Grave: Unknow type constant pool 32 at position151
Grave: Unknow type constant pool 100 at position152
Grave: Unknow type constant pool 101 at position153
Grave: Unknow type constant pool 105 at position154
Grave: Unknow type constant pool 32 at position155
Grave: Unknow type constant pool 100 at position156
Grave: Unknow type constant pool 97 at position157
Grave: Unknow type constant pool 116 at position158
Grave: Unknow type constant pool 105 at position159
Grave: Unknow type constant pool 32 at position160
Grave: Unknow type constant pool 99 at position161
Grave: Unknow type constant pool 111 at position162
Grave: Unknow type constant pool 109 at position163
Grave: Unknow type constant pool 98 at position164
Grave: Unknow type constant pool 105 at position165
Grave: Unknow type constant pool 110 at position166
Grave: Unknow type constant pool 97 at position167
Grave: Unknow type constant pool 110 at position168
Grave: Unknow type constant pool 100 at position169
Grave: Unknow type constant pool 111 at position170
Grave: Unknow type constant pool 32 at position171
Grave: Unknow type constant pool 87 at position172
Grave: Unknow type constant pool 105 at position173
Grave: Unknow type constant pool 45 at position174
Grave: Unknow type constant pool 70 at position175
Grave: Unknow type constant pool 105 at position176
Grave: Unknow type constant pool 32 at position177
Grave: Unknow type constant pool 101 at position178
Grave: Unknow type constant pool 32 at position179
Grave: Unknow type constant pool 52 at position180
Grave: Unknow type constant pool 71 at position181
Grave: Unknow type constant pool 32 at position182
Grave: Unknow type constant pool 76 at position183
Grave: Unknow type constant pool 84 at position184
Grave: Unknow type constant pool 69 at position185
Grave: Unknow type constant pool 46 at position186
Grave: Unknow type constant pool 103 at position188
Grave: Unknow type constant pool 110 at position189
Grave: Unknow type constant pool 105 at position190
Grave: Unknow type constant pool 32 at position191
Grave: Unknow type constant pool 115 at position192
Grave: Unknow type constant pool 105 at position193
Grave: Unknow type constant pool 116 at position194
Grave: Unknow type constant pool 117 at position195
Grave: Unknow type constant pool 97 at position196
Grave: Unknow type constant pool 122 at position197
Grave: Unknow type constant pool 105 at position198
Grave: Unknow type constant pool 111 at position199
Grave: Unknow type constant pool 110 at position200
Grave: Unknow type constant pool 101 at position201
Grave: Unknow type constant pool 32 at position202
Grave: Unknow type constant pool 105 at position203
Grave: Unknow type constant pool 108 at position204
Grave: Unknow type constant pool 32 at position205
Grave: Unknow type constant pool 116 at position206
Grave: Unknow type constant pool 117 at position207
Grave: Unknow type constant pool 111 at position208
Grave: Unknow type constant pool 32 at position209
Grave: Unknow type constant pool 71 at position210
Grave: Unknow type constant pool 97 at position211
Grave: Unknow type constant pool 108 at position212
Grave: Unknow type constant pool 97 at position213
Grave: Unknow type constant pool 120 at position214
Grave: Unknow type constant pool 121 at position215
Grave: Unknow type constant pool 32 at position216
Grave: Unknow type constant pool 83 at position217
Grave: Unknow type constant pool 53 at position218
Grave: Unknow type constant pool 32 at position219
Grave: Unknow type constant pool 115 at position220
Grave: Unknow type constant pool 97 at position221
Grave: Unknow type constant pool 114 at position222
Grave: Unknow type constant pool -61 at position223
Grave: Unknow type constant pool -96 at position224
Grave: Unknow type constant pool 32 at position225
Grave: Unknow type constant pool 112 at position226
Grave: Unknow type constant pool 114 at position227
Grave: Unknow type constant pool 111 at position228
Grave: Unknow type constant pool 116 at position229
Grave: Unknow type constant pool 101 at position230
Grave: Unknow type constant pool 116 at position231
Grave: Unknow type constant pool 116 at position232
Grave: Unknow type constant pool 111 at position233
Grave: Unknow type constant pool 32 at position234
Grave: Unknow type constant pool 100 at position235
Grave: Unknow type constant pool 97 at position236
Grave: Unknow type constant pool 32 at position237
Grave: Unknow type constant pool 97 at position238
Grave: Unknow type constant pool 99 at position239
Grave: Unknow type constant pool 113 at position240
Grave: Unknow type constant pool 117 at position241
Grave: Unknow type constant pool 97 at position242
Grave: Unknow type constant pool 44 at position243
Grave: Unknow type constant pool 32 at position244
Grave: Unknow type constant pool 112 at position245
Grave: Unknow type constant pool 105 at position246
Grave: Unknow type constant pool 111 at position247
Grave: Unknow type constant pool 103 at position248
Grave: Unknow type constant pool 103 at position249
Grave: Unknow type constant pool 105 at position250
Grave: Unknow type constant pool 97 at position251
Grave: Unknow type constant pool 44 at position252
Grave: Unknow type constant pool 32 at position253
Grave: Unknow type constant pool 112 at position254
Grave: Unknow type constant pool 111 at position255
Grave: Unknow type constant pool 108 at position256
Grave: Unknow type constant pool 118 at position257
Grave: Unknow type constant pool 101 at position258
Grave: Unknow type constant pool 114 at position259
Grave: Unknow type constant pool 101 at position260
Grave: Unknow type constant pool 32 at position261
Grave: Unknow type constant pool 101 at position262
Grave: Unknow type constant pool 32 at position263
Grave: Unknow type constant pool 115 at position264
Grave: Unknow type constant pool 97 at position265
Grave: Unknow type constant pool 98 at position266
Grave: Unknow type constant pool 98 at position267
Grave: Unknow type constant pool 105 at position268
Grave: Unknow type constant pool 97 at position269
Grave: Unknow type constant pool 44 at position270
Grave: Unknow type constant pool 32 at position271
Grave: Unknow type constant pool 103 at position272
Grave: Unknow type constant pool 114 at position273
Grave: Unknow type constant pool 97 at position274
Grave: Unknow type constant pool 122 at position275
Grave: Unknow type constant pool 105 at position276
Grave: Unknow type constant pool 101 at position277
Grave: Unknow type constant pool 32 at position278
Grave: Unknow type constant pool 97 at position279
Grave: Unknow type constant pool 108 at position280
Grave: Unknow type constant pool 108 at position281
Grave: Unknow type constant pool 97 at position282
Grave: Unknow type constant pool 32 at position283
Grave: Unknow type constant pool 99 at position284
Grave: Unknow type constant pool 101 at position285
Grave: Unknow type constant pool 114 at position286
Grave: Unknow type constant pool 116 at position287
Grave: Unknow type constant pool 105 at position288
Grave: Unknow type constant pool 102 at position289
Grave: Unknow type constant pool 105 at position290
Grave: Unknow type constant pool 99 at position291
Grave: Unknow type constant pool 97 at position292
Grave: Unknow type constant pool 122 at position293
Grave: Unknow type constant pool 105 at position294
Grave: Unknow type constant pool 111 at position295
Grave: Unknow type constant pool 110 at position296
Grave: Unknow type constant pool 101 at position297
Grave: Unknow type constant pool 32 at position298
Grave: Unknow type constant pool 73 at position299
Grave: Unknow type constant pool 80 at position300
Grave: Unknow type constant pool 54 at position301
Grave: Unknow type constant pool 55 at position302
Grave: Unknow type constant pool 46 at position303
Grave: Unknow type constant pool 15 at position330
Grave: Unknow type constant pool 118 at position333
Grave: Unknow type constant pool 16 at position334
Grave: Exception while deploying the app [AsteRibasso]
Grave: 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.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.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.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.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.access00(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.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.access0(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)
Grave: Exception while deploying the app [AsteRibasso]
在 Internet 上找不到与我在 NetBeans 8.0.2 中使用的 GlassFish 4.1(内部版本 13)和 jre1.8 有关的此问题的任何信息。0_31。有人可以帮助我吗?
我遇到了同样的问题
我将问题跟踪到 jar glassfish/modules/dol.jar
(sources)。此 jar 中的 class com.sun.enterprise.deployment.annotation.introspection.ConstantPoolInfo
负责在部署时测试 class 相关注释。
问题:
class 通过逐字节读取和解释 .class
文件的一个特殊部分:常量池(JVM spec). The pool contains "values such as numbers of all sorts, strings, identifier names, references to classes and methods, and type descriptors" (Wiki)来做到这一点。这包括注释的 class 个名称。
问题是,常量池的可能内容随着 Java 7 的增加而增加,并且添加了一些额外的条目类型以支持 JVM 的脚本语言。 ConstantPoolInfo
尚不支持这些条目(方法句柄、方法类型和 InvokeDynamic(ID 15、16 和 18))。当读取和检查其中一个常量池条目的类型标识符字节时,class 简单地记录 warning "Unknow [sic] type constant pool x at position i" 并继续处理下一个字节,缺少跳过属于当前类型的数据结构(无论如何它们都不相关)。
这会导致完全混乱,因为本应跳过的下一个字节被解释为类型标识符。
在某些情况下,错误解释的字节导致执行 "UTF 8/ASCII"-entry case 的代码,将接下来的两个字节解释为常量池中 String 的长度,然后想要读取该 String。这就是 BufferUnderflowException
的来源:包含常量池数据的输入源可能无法按要求保存尽可能多的字节。
地点和时间:
使用 Java 7 代码时没有问题,因为通常的 developer/compiler 不会生成需要额外常量池条目类型的字节码。
使用 Java 8 这改变了:Lambdas 和方法引用使用它。
出于某种原因我没有检查,war-modules 中的 lambda 不会出现问题,但只会出现在 ejb-modules 中。可能 class 文件的内省没有在那里完成——至少不是基于 ConstantPoolInfo。
解法:
我打开了一个错误报告:https://java.net/jira/browse/GLASSFISH-21510。
除了避免在 ejb 模块中使用 lambdas/method 引用(或任何编译为 invokedynamic
字节码的内容)之外,我没有其他解决方案。
重构代码直到它只产生 warnings 并且没有异常可能会有帮助,但我不认为它是一个干净的解决方案。它可能会因任何代码更改或 jdk 更新而再次中断。除此之外,class的检查还是有问题,可能会导致其他问题。
[TL;DR]
从 ejb-projects 中删除 lambdas/method 引用。
[/TL;DR]
为了修改 flo,我们在旧 GF 版本中遇到了同样的问题,在部署 WAR 时也会执行此代码。
无论如何,由于他出色的调查,我们能够通过自己修补 ConstantPoolInfo 并替换它来快速修复它
在它出现的罐子里。
因此,如果是 GF4,请下载源代码(例如 ConstantPoolInfo.java)应用下面的修复程序,编译它,然后替换为 jar(如果是 GF4,则将在 %gf_install_dir %glassfish/modules)。如果您使用的是较旧的 GF 版本,则相同的例程,但请确保您下载了该版本的源代码(随着时间的推移有一些小的修改)。此外,class 出现的 JAR 的名称可能不同。修补 class 的相关片段:
通过将它们添加到方法 containsAnnotation 中的 switch 语句来跳过额外的类型:
case METHODHANDLE:
buffer.get();
buffer.getShort();
break;
case METHODTYPE:
buffer.getShort();
break;
case INVOKEDYNAMIC:
buffer.getShort();
buffer.getShort();
break;
要添加到class末尾常量的新类型:
/**
* New types since Java7/8
**/
public static final int METHODHANDLE = 15;
public static final int METHODTYPE = 16;
public static final int INVOKEDYNAMIC = 18;
我有一个非常简单的 Java EE 应用程序,其中包含一些使用 JMS 进行通信的 bean。当我尝试部署和调试我的应用程序时,我得到了这个
Informazioni: visiting unvisited references
Grave: Unknow type constant pool 18 at position38
Grave: Unknow type constant pool 0 at position39
Grave: Unknow type constant pool 0 at position40
Grave: Unknow type constant pool 105 at position43
Grave: Unknow type constant pool 116 at position44
Grave: Unknow type constant pool 101 at position45
Grave: Unknow type constant pool 32 at position46
Grave: Unknow type constant pool 108 at position47
Grave: Unknow type constant pool -30 at position48
Grave: Unknow type constant pool -128 at position49
Grave: Unknow type constant pool -103 at position50
Grave: Unknow type constant pool 105 at position51
Grave: Unknow type constant pool 110 at position52
Grave: Unknow type constant pool 110 at position53
Grave: Unknow type constant pool 111 at position54
Grave: Unknow type constant pool 118 at position55
Grave: Unknow type constant pool 97 at position56
Grave: Unknow type constant pool 116 at position57
Grave: Unknow type constant pool 105 at position58
Grave: Unknow type constant pool 118 at position59
Grave: Unknow type constant pool 97 at position60
Grave: Unknow type constant pool 32 at position61
Grave: Unknow type constant pool 116 at position62
Grave: Unknow type constant pool 101 at position63
Grave: Unknow type constant pool 99 at position64
Grave: Unknow type constant pool 110 at position65
Grave: Unknow type constant pool 111 at position66
Grave: Unknow type constant pool 108 at position67
Grave: Unknow type constant pool 111 at position68
Grave: Unknow type constant pool 103 at position69
Grave: Unknow type constant pool 105 at position70
Grave: Unknow type constant pool 97 at position71
Grave: Unknow type constant pool 32 at position72
Grave: Unknow type constant pool 68 at position73
Grave: Unknow type constant pool 111 at position74
Grave: Unknow type constant pool 119 at position75
Grave: Unknow type constant pool 110 at position76
Grave: Unknow type constant pool 108 at position77
Grave: Unknow type constant pool 111 at position78
Grave: Unknow type constant pool 97 at position79
Grave: Unknow type constant pool 100 at position80
Grave: Unknow type constant pool 32 at position81
Grave: Unknow type constant pool 66 at position82
Grave: Unknow type constant pool 111 at position83
Grave: Unknow type constant pool 111 at position84
Grave: Unknow type constant pool 115 at position85
Grave: Unknow type constant pool 116 at position86
Grave: Unknow type constant pool 101 at position87
Grave: Unknow type constant pool 114 at position88
Grave: Unknow type constant pool 44 at position89
Grave: Unknow type constant pool 32 at position90
Grave: Unknow type constant pool 112 at position91
Grave: Unknow type constant pool 111 at position92
Grave: Unknow type constant pool 116 at position93
Grave: Unknow type constant pool 114 at position94
Grave: Unknow type constant pool 97 at position95
Grave: Unknow type constant pool 105 at position96
Grave: Unknow type constant pool 32 at position97
Grave: Unknow type constant pool 97 at position98
Grave: Unknow type constant pool 117 at position99
Grave: Unknow type constant pool 109 at position100
Grave: Unknow type constant pool 101 at position101
Grave: Unknow type constant pool 110 at position102
Grave: Unknow type constant pool 116 at position103
Grave: Unknow type constant pool 97 at position104
Grave: Unknow type constant pool 114 at position105
Grave: Unknow type constant pool 101 at position106
Grave: Unknow type constant pool 32 at position107
Grave: Unknow type constant pool 115 at position108
Grave: Unknow type constant pool 105 at position109
Grave: Unknow type constant pool 103 at position110
Grave: Unknow type constant pool 110 at position111
Grave: Unknow type constant pool 105 at position112
Grave: Unknow type constant pool 102 at position113
Grave: Unknow type constant pool 105 at position114
Grave: Unknow type constant pool 99 at position115
Grave: Unknow type constant pool 97 at position116
Grave: Unknow type constant pool 116 at position117
Grave: Unknow type constant pool 105 at position118
Grave: Unknow type constant pool 118 at position119
Grave: Unknow type constant pool 97 at position120
Grave: Unknow type constant pool 109 at position121
Grave: Unknow type constant pool 101 at position122
Grave: Unknow type constant pool 110 at position123
Grave: Unknow type constant pool 116 at position124
Grave: Unknow type constant pool 101 at position125
Grave: Unknow type constant pool 32 at position126
Grave: Unknow type constant pool 108 at position127
Grave: Unknow type constant pool 97 at position128
Grave: Unknow type constant pool 32 at position129
Grave: Unknow type constant pool 118 at position130
Grave: Unknow type constant pool 101 at position131
Grave: Unknow type constant pool 108 at position132
Grave: Unknow type constant pool 111 at position133
Grave: Unknow type constant pool 99 at position134
Grave: Unknow type constant pool 105 at position135
Grave: Unknow type constant pool 116 at position136
Grave: Unknow type constant pool -61 at position137
Grave: Unknow type constant pool -96 at position138
Grave: Unknow type constant pool 32 at position139
Grave: Unknow type constant pool 100 at position140
Grave: Unknow type constant pool 105 at position141
Grave: Unknow type constant pool 32 at position142
Grave: Unknow type constant pool 100 at position143
Grave: Unknow type constant pool 111 at position144
Grave: Unknow type constant pool 119 at position145
Grave: Unknow type constant pool 110 at position146
Grave: Unknow type constant pool 108 at position147
Grave: Unknow type constant pool 111 at position148
Grave: Unknow type constant pool 97 at position149
Grave: Unknow type constant pool 100 at position150
Grave: Unknow type constant pool 32 at position151
Grave: Unknow type constant pool 100 at position152
Grave: Unknow type constant pool 101 at position153
Grave: Unknow type constant pool 105 at position154
Grave: Unknow type constant pool 32 at position155
Grave: Unknow type constant pool 100 at position156
Grave: Unknow type constant pool 97 at position157
Grave: Unknow type constant pool 116 at position158
Grave: Unknow type constant pool 105 at position159
Grave: Unknow type constant pool 32 at position160
Grave: Unknow type constant pool 99 at position161
Grave: Unknow type constant pool 111 at position162
Grave: Unknow type constant pool 109 at position163
Grave: Unknow type constant pool 98 at position164
Grave: Unknow type constant pool 105 at position165
Grave: Unknow type constant pool 110 at position166
Grave: Unknow type constant pool 97 at position167
Grave: Unknow type constant pool 110 at position168
Grave: Unknow type constant pool 100 at position169
Grave: Unknow type constant pool 111 at position170
Grave: Unknow type constant pool 32 at position171
Grave: Unknow type constant pool 87 at position172
Grave: Unknow type constant pool 105 at position173
Grave: Unknow type constant pool 45 at position174
Grave: Unknow type constant pool 70 at position175
Grave: Unknow type constant pool 105 at position176
Grave: Unknow type constant pool 32 at position177
Grave: Unknow type constant pool 101 at position178
Grave: Unknow type constant pool 32 at position179
Grave: Unknow type constant pool 52 at position180
Grave: Unknow type constant pool 71 at position181
Grave: Unknow type constant pool 32 at position182
Grave: Unknow type constant pool 76 at position183
Grave: Unknow type constant pool 84 at position184
Grave: Unknow type constant pool 69 at position185
Grave: Unknow type constant pool 46 at position186
Grave: Unknow type constant pool 103 at position188
Grave: Unknow type constant pool 110 at position189
Grave: Unknow type constant pool 105 at position190
Grave: Unknow type constant pool 32 at position191
Grave: Unknow type constant pool 115 at position192
Grave: Unknow type constant pool 105 at position193
Grave: Unknow type constant pool 116 at position194
Grave: Unknow type constant pool 117 at position195
Grave: Unknow type constant pool 97 at position196
Grave: Unknow type constant pool 122 at position197
Grave: Unknow type constant pool 105 at position198
Grave: Unknow type constant pool 111 at position199
Grave: Unknow type constant pool 110 at position200
Grave: Unknow type constant pool 101 at position201
Grave: Unknow type constant pool 32 at position202
Grave: Unknow type constant pool 105 at position203
Grave: Unknow type constant pool 108 at position204
Grave: Unknow type constant pool 32 at position205
Grave: Unknow type constant pool 116 at position206
Grave: Unknow type constant pool 117 at position207
Grave: Unknow type constant pool 111 at position208
Grave: Unknow type constant pool 32 at position209
Grave: Unknow type constant pool 71 at position210
Grave: Unknow type constant pool 97 at position211
Grave: Unknow type constant pool 108 at position212
Grave: Unknow type constant pool 97 at position213
Grave: Unknow type constant pool 120 at position214
Grave: Unknow type constant pool 121 at position215
Grave: Unknow type constant pool 32 at position216
Grave: Unknow type constant pool 83 at position217
Grave: Unknow type constant pool 53 at position218
Grave: Unknow type constant pool 32 at position219
Grave: Unknow type constant pool 115 at position220
Grave: Unknow type constant pool 97 at position221
Grave: Unknow type constant pool 114 at position222
Grave: Unknow type constant pool -61 at position223
Grave: Unknow type constant pool -96 at position224
Grave: Unknow type constant pool 32 at position225
Grave: Unknow type constant pool 112 at position226
Grave: Unknow type constant pool 114 at position227
Grave: Unknow type constant pool 111 at position228
Grave: Unknow type constant pool 116 at position229
Grave: Unknow type constant pool 101 at position230
Grave: Unknow type constant pool 116 at position231
Grave: Unknow type constant pool 116 at position232
Grave: Unknow type constant pool 111 at position233
Grave: Unknow type constant pool 32 at position234
Grave: Unknow type constant pool 100 at position235
Grave: Unknow type constant pool 97 at position236
Grave: Unknow type constant pool 32 at position237
Grave: Unknow type constant pool 97 at position238
Grave: Unknow type constant pool 99 at position239
Grave: Unknow type constant pool 113 at position240
Grave: Unknow type constant pool 117 at position241
Grave: Unknow type constant pool 97 at position242
Grave: Unknow type constant pool 44 at position243
Grave: Unknow type constant pool 32 at position244
Grave: Unknow type constant pool 112 at position245
Grave: Unknow type constant pool 105 at position246
Grave: Unknow type constant pool 111 at position247
Grave: Unknow type constant pool 103 at position248
Grave: Unknow type constant pool 103 at position249
Grave: Unknow type constant pool 105 at position250
Grave: Unknow type constant pool 97 at position251
Grave: Unknow type constant pool 44 at position252
Grave: Unknow type constant pool 32 at position253
Grave: Unknow type constant pool 112 at position254
Grave: Unknow type constant pool 111 at position255
Grave: Unknow type constant pool 108 at position256
Grave: Unknow type constant pool 118 at position257
Grave: Unknow type constant pool 101 at position258
Grave: Unknow type constant pool 114 at position259
Grave: Unknow type constant pool 101 at position260
Grave: Unknow type constant pool 32 at position261
Grave: Unknow type constant pool 101 at position262
Grave: Unknow type constant pool 32 at position263
Grave: Unknow type constant pool 115 at position264
Grave: Unknow type constant pool 97 at position265
Grave: Unknow type constant pool 98 at position266
Grave: Unknow type constant pool 98 at position267
Grave: Unknow type constant pool 105 at position268
Grave: Unknow type constant pool 97 at position269
Grave: Unknow type constant pool 44 at position270
Grave: Unknow type constant pool 32 at position271
Grave: Unknow type constant pool 103 at position272
Grave: Unknow type constant pool 114 at position273
Grave: Unknow type constant pool 97 at position274
Grave: Unknow type constant pool 122 at position275
Grave: Unknow type constant pool 105 at position276
Grave: Unknow type constant pool 101 at position277
Grave: Unknow type constant pool 32 at position278
Grave: Unknow type constant pool 97 at position279
Grave: Unknow type constant pool 108 at position280
Grave: Unknow type constant pool 108 at position281
Grave: Unknow type constant pool 97 at position282
Grave: Unknow type constant pool 32 at position283
Grave: Unknow type constant pool 99 at position284
Grave: Unknow type constant pool 101 at position285
Grave: Unknow type constant pool 114 at position286
Grave: Unknow type constant pool 116 at position287
Grave: Unknow type constant pool 105 at position288
Grave: Unknow type constant pool 102 at position289
Grave: Unknow type constant pool 105 at position290
Grave: Unknow type constant pool 99 at position291
Grave: Unknow type constant pool 97 at position292
Grave: Unknow type constant pool 122 at position293
Grave: Unknow type constant pool 105 at position294
Grave: Unknow type constant pool 111 at position295
Grave: Unknow type constant pool 110 at position296
Grave: Unknow type constant pool 101 at position297
Grave: Unknow type constant pool 32 at position298
Grave: Unknow type constant pool 73 at position299
Grave: Unknow type constant pool 80 at position300
Grave: Unknow type constant pool 54 at position301
Grave: Unknow type constant pool 55 at position302
Grave: Unknow type constant pool 46 at position303
Grave: Unknow type constant pool 15 at position330
Grave: Unknow type constant pool 118 at position333
Grave: Unknow type constant pool 16 at position334
Grave: Exception while deploying the app [AsteRibasso]
Grave: 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.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.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.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.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.access00(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.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.access0(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)
Grave: Exception while deploying the app [AsteRibasso]
在 Internet 上找不到与我在 NetBeans 8.0.2 中使用的 GlassFish 4.1(内部版本 13)和 jre1.8 有关的此问题的任何信息。0_31。有人可以帮助我吗?
我遇到了同样的问题
我将问题跟踪到 jar glassfish/modules/dol.jar
(sources)。此 jar 中的 class com.sun.enterprise.deployment.annotation.introspection.ConstantPoolInfo
负责在部署时测试 class 相关注释。
问题:
class 通过逐字节读取和解释 .class
文件的一个特殊部分:常量池(JVM spec). The pool contains "values such as numbers of all sorts, strings, identifier names, references to classes and methods, and type descriptors" (Wiki)来做到这一点。这包括注释的 class 个名称。
问题是,常量池的可能内容随着 Java 7 的增加而增加,并且添加了一些额外的条目类型以支持 JVM 的脚本语言。 ConstantPoolInfo
尚不支持这些条目(方法句柄、方法类型和 InvokeDynamic(ID 15、16 和 18))。当读取和检查其中一个常量池条目的类型标识符字节时,class 简单地记录 warning "Unknow [sic] type constant pool x at position i" 并继续处理下一个字节,缺少跳过属于当前类型的数据结构(无论如何它们都不相关)。
这会导致完全混乱,因为本应跳过的下一个字节被解释为类型标识符。
在某些情况下,错误解释的字节导致执行 "UTF 8/ASCII"-entry case 的代码,将接下来的两个字节解释为常量池中 String 的长度,然后想要读取该 String。这就是 BufferUnderflowException
的来源:包含常量池数据的输入源可能无法按要求保存尽可能多的字节。
地点和时间:
使用 Java 7 代码时没有问题,因为通常的 developer/compiler 不会生成需要额外常量池条目类型的字节码。
使用 Java 8 这改变了:Lambdas 和方法引用使用它。
出于某种原因我没有检查,war-modules 中的 lambda 不会出现问题,但只会出现在 ejb-modules 中。可能 class 文件的内省没有在那里完成——至少不是基于 ConstantPoolInfo。
解法:
我打开了一个错误报告:https://java.net/jira/browse/GLASSFISH-21510。
除了避免在 ejb 模块中使用 lambdas/method 引用(或任何编译为 invokedynamic
字节码的内容)之外,我没有其他解决方案。
重构代码直到它只产生 warnings 并且没有异常可能会有帮助,但我不认为它是一个干净的解决方案。它可能会因任何代码更改或 jdk 更新而再次中断。除此之外,class的检查还是有问题,可能会导致其他问题。
[TL;DR]
从 ejb-projects 中删除 lambdas/method 引用。
[/TL;DR]
为了修改 flo,我们在旧 GF 版本中遇到了同样的问题,在部署 WAR 时也会执行此代码。 无论如何,由于他出色的调查,我们能够通过自己修补 ConstantPoolInfo 并替换它来快速修复它 在它出现的罐子里。
因此,如果是 GF4,请下载源代码(例如 ConstantPoolInfo.java)应用下面的修复程序,编译它,然后替换为 jar(如果是 GF4,则将在 %gf_install_dir %glassfish/modules)。如果您使用的是较旧的 GF 版本,则相同的例程,但请确保您下载了该版本的源代码(随着时间的推移有一些小的修改)。此外,class 出现的 JAR 的名称可能不同。修补 class 的相关片段:
通过将它们添加到方法 containsAnnotation 中的 switch 语句来跳过额外的类型:
case METHODHANDLE:
buffer.get();
buffer.getShort();
break;
case METHODTYPE:
buffer.getShort();
break;
case INVOKEDYNAMIC:
buffer.getShort();
buffer.getShort();
break;
要添加到class末尾常量的新类型:
/**
* New types since Java7/8
**/
public static final int METHODHANDLE = 15;
public static final int METHODTYPE = 16;
public static final int INVOKEDYNAMIC = 18;