javaee / grizzly

Writing scalable server applications in the Java™ programming language has always been difficult. Before the advent of the Java New I/O API (NIO), thread management issues made it impossible for a server to scale to thousands of users. The Grizzly NIO framework has been designed to help developers to take advantage of the Java™ NIO API.
https://javaee.github.io/grizzly/
Other
221 stars 60 forks source link

Grizzly with jmx enabled doesn't work on ibm java 1.7 #1732

Closed glassfishrobot closed 9 years ago

glassfishrobot commented 9 years ago

Trying to start a minmal grizzly project on ibm java fails with java.lang.TypeNotPresentException: Type javax.rcm.ResourceAttributes not present

This "magically" works when trying with grizzly 2.3.18 but the underlying cause keeps worrying me enough to open this as i see potential that it will pop up again or at least somebody else might find this useful when stumbling upon this problem.

The underlying problem seems to be:

Grizzly uses gmbal annotations for management objects and methods. When registering such a management object (org.glassfish.grizzly.http.server.jmx.HttpServer) with gmbal's ManagedObjectManagerImpl the type of the object to register is evaluated. "Given any generic java type, evaluate all of its type bounds and return an evaluated type.". While trying to evaluate all the type bounds and depending on the jvm in use the lib somehow ends up in:

class com.ibm.tenant.TenantConfiguration.getResourceConstraints() which has a signature of ()Ljava/util/Map<Ljavax/rcm/ResourceAttributes;Lcom/ibm/rcm/resource/config/ResourceConfig;>;

Class.forName(String, boolean, ClassLoader) line: 252 CoreReflectionFactory.makeNamedType(String) line: 127 Reifier.visitClassTypeSignature(ClassTypeSignature) line: 138 ClassTypeSignature.accept(TypeTreeVisitor<?>) line: 62 Reifier.reifyTypeArguments(TypeArgument[]) line: 81 Reifier.visitClassTypeSignature(ClassTypeSignature) line: 151 ClassTypeSignature.accept(TypeTreeVisitor<?>) line: 62 MethodRepository.getReturnType() line: 81 Method.getGenericReturnType() line: 259 [local variables unavailable] TypeEvaluator$TypeEvaluationVisitor.visitMethodDeclaration(EvaluatedClassDeclaration, Method) line: 564

A simple project with the mentioned grizzly versions in pom.xml can be found at https://github.com/dermarens/grizzly.hello

The full error is shown here https://gist.github.com/dermarens/353208676dc79bb621e7

I have no idea how exactly we ended up in com.ibm.tenant.TenantConfiguration.getResourceConstraints starting from org.glassfish.grizzly.http.server.jmx.HttpServer and why this doesn't happen with grizzly-2.3.18. (doesn't happen with openjdk on sles either btw.) I hope somebody could explain this or at least forward it to the right developer as gmbal seems to be part of glassfish/grizzly

Environment

Suse Linux Enterprise Server 12 java -version java version "1.7.0" Java(TM) SE Runtime Environment (build pxa6470_27sr1fp1-20140708_01(SR1 FP1)) IBM J9 VM (build 2.7, JRE 1.7.0 Linux amd64-64 Compressed References 20140707_205525 (JIT enabled, AOT enabled) J9VM - R27_Java727_SR1_20140707_1408_B205525 JIT - tr.r13.java_20140410_61421.07 GC - R27_Java727_SR1_20140707_1408_B205525_CMPRSS J9CL - 20140707_205525) JCL - 20140707_01 based on Oracle 7u65-b16

Affected Versions

[2.2.22, 2.3.18]

glassfishrobot commented 9 years ago

Reported by marens

glassfishrobot commented 9 years ago

marens said: Here is gmbal's typelib debugging that shows the details of the TypeEvaluator at work https://gist.github.com/dermarens/982b632c17aca0b8ce01

glassfishrobot commented 9 years ago

marens said: Same problem for grizzly 2.3.18 after reading up on the monitoring changes for 2.3 and adding the modules mentioned in https://grizzly.java.net/monitoring.html. So please change the affected version.

glassfishrobot commented 9 years ago

oleksiys said: I approached folks responsible for gmbal, but for now I don't have any estimate from them on how long it may take to fix this.

glassfishrobot commented 9 years ago

marens said: Thanks for the feedback Alexey.

glassfishrobot commented 9 years ago

salvadormacedo said: I'm having the same issue in AIX 7.1 With any version of IBM Java while deploying and app in Glassfish..

omplete Message enterprise_util.excep_in_createorb java.lang.TypeNotPresentException: Type javax.rcm.ResourceAttributes not present at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:130) at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138) at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:62) at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:81) at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:151) at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:62) at sun.reflect.generics.repository.MethodRepository.getReturnType(MethodRepository.java:81) at java.lang.reflect.Method.getGenericReturnType(Method.java:259) at .....

Caused by: java.lang.ClassNotFoundException: javax.rcm.ResourceAttributes at java.lang.Class.forNameImpl(Native Method) at java.lang.Class.forName(Class.java:296) at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:127) ... 270 more

glassfishrobot commented 9 years ago

marens said: @salvadormacedo you might be able to work around it by using ibm java 1.6 until this bug gets fixed

glassfishrobot commented 9 years ago

salvadormacedo said: Unfortunately I'm using primefaces framework that requires java 1.7..! :|

glassfishrobot commented 9 years ago

marens said: We retested the Latest SLES12 Updates (Jun-16-2015, Kernel 3.12.43-52.6.1) and this version desn't seem to suffer from this problem anylonger

  1. cat /etc/SUSE-brand SLE VERSION = 12

  2. java -version java version "1.7.0" Java(TM) SE Runtime Environment (build pxa6470_27sr3-20150415_01(SR3)) IBM J9 VM (build 2.7, JRE 1.7.0 Linux amd64-64 Compressed References 20150407_243189 (JIT enabled, AOT enabled) J9VM - R27_Java727_SR3_20150407_1831_B243189 JIT - tr.r13.java_20150406_89182 GC - R27_Java727_SR3_20150407_1831_B243189_CMPRSS J9CL - 20150407_243189) JCL - 20150414_01 based on Oracle 7u79-b14

yet gmbal should be made more robust.

glassfishrobot commented 9 years ago

oleksiys said: thank you for the update!

glassfishrobot commented 9 years ago

@rlubke said: Closing this issue out for now. Gmbal team has been notified of the issue. Might still be worth logging an issue on their public tracker as well.

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA GRIZZLY-1732

glassfishrobot commented 9 years ago

Marked as won't fix on Friday, October 16th 2015, 1:29:35 pm