5 Replies Latest reply on Feb 28, 2012 9:20 AM by David Lloyd

    does ModuleClassLoader support class array syntax?

    Guillaume Bourdeaux Newbie

      Hi,

       

      We are having trouble deserializing rule packages on JBoss7 because JBoss7 / ModuleClassLoader 1.0.1.GA seem to ignore

      -Dsun.lang.ClassLoader.allowArraySyntax=true

      ClassLoading was working properly on JBoss6 with -Dsun.lang.ClassLoader.allowArraySyntax=true

      Is there any hidden option of ModuleClassLoader to reproduce native classloader behaviour and support class array syntax?

       

      Here is stacktrace:

       

      ERROR [RulePackageVersion] (MSC service thread 1-6) Could not read packaged rules:

      java.lang.ClassNotFoundException: [Lorg.drools.rule.Declaration; from [Module "deployment.myapp.ear.myapp.jar:main" from Service Module Loader]

      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)

      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)

      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307)

      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101)

      at org.drools.rule.PackageCompilationData$PackageClassLoader.loadClass(Unknown Source) [drools-core.jar:]

      at java.lang.ClassLoader.loadClass(ClassLoader.java:248) [:1.6.0_23]

      at org.drools.rule.Package$ObjectInputStreamWithLoader.resolveClass(Unknown Source) [drools-core.jar:]

      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1574) [:1.6.0_23]

      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495) [:1.6.0_23]

      at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1623) [:1.6.0_23]

      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1322) [:1.6.0_23]

      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946) [:1.6.0_23]

      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870) [:1.6.0_23]

      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752) [:1.6.0_23]

      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328) [:1.6.0_23]

      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350) [:1.6.0_23]

      at java.util.HashMap.readObject(HashMap.java:1030) [:1.6.0_23]

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_23]

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_23]

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_23]

      at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_23]

      at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974) [:1.6.0_23]

      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848) [:1.6.0_23]

      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752) [:1.6.0_23]

      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328) [:1.6.0_23]

      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350) [:1.6.0_23]

      at org.drools.rule.Package.readExternal(Unknown Source) [drools-core.jar:]

      at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1791) [:1.6.0_23]

      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750) [:1.6.0_23]

      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328) [:1.6.0_23]

      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350) [:1.6.0_23]

      at RulePackageVersion.getPackagedRules(RulePackageVersion.java:194) [myapp.jar:]

      at RulePackageServer.start(RulePackageServer.java:46) [myapp.jar:]

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_23]

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_23]

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_23]

      at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_23]

      at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptor.java:69)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]

      at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]

      at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptor.java:65)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]

      at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]

      at org.jboss.as.ee.component.ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptor.java:53)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]

      at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]

      at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:44)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]

      at org.jboss.as.ejb3.component.session.SessionInvocationContextInterceptor$CustomSessionInvocationContext.proceed(SessionInvocationContextInterceptor.java:126)

      at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:257)

      at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:402)

      at org.jboss.as.ejb3.tx.SingletonLifecycleCMTTxInterceptor.processInvocation(SingletonLifecycleCMTTxInterceptor.java:57)

      at org.jboss.as.ejb3.tx.SingletonLifecycleCMTTxInterceptor.processInvocation(SingletonLifecycleCMTTxInterceptor.java:43)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]

      at org.jboss.as.ejb3.component.session.SessionInvocationContextInterceptor.processInvocation(SessionInvocationContextInterceptor.java:71)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]

      at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)

      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]

      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.0.Final.jar:1.1.0.Final]

      at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:152)

      at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:77)

      at org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:125)

      at org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:138)

      at org.jboss.as.ee.component.ComponentStartService.start(ComponentStartService.java:44)

      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)

      at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_23]

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_23]

      at java.lang.Thread.run(Thread.java:662) [:1.6.0_23]

       

      detailed logging:

      [org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:181)] Finding class [Lorg.drools.rule.Declaration; from Module "deployment.myapp.ear.myapp.jar:main" from Service Module Loader

      [org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:189)] Class [Lorg.drools.rule.Declaration; not found from Module "deployment.myapp.ear.myapp.jar:main" from Service Module Loader

      [org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:181)] Finding class org.drools.rule.Declaration from Module "deployment.myapp.ear.myapp.jar:main" from Service Module Loader

      [org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:205)] Finding local class org.drools.rule.Declaration from Module "deployment.myapp.ear:main" from Service Module Loader

      [org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:210)] Found previously loaded class org.drools.rule.Declaration from Module "deployment.myapp.ear:main" from Service Module Loader

        • 1. Re: does ModuleClassLoader support class array syntax?
          David Lloyd Master

          Actually there really is no reason why we couldn't just always support array syntax.  Would you mind filing an enhancement request at https://issues.jboss.org/browse/MODULES?  Thanks.

          1 of 1 people found this helpful
          • 3. Re: does ModuleClassLoader support class array syntax?
            David Lloyd Master

            This issue has been resovled and this feature will be present in JBoss Modules 1.1 (and, by extension, JBoss AS 7.1.0).  Thanks!

            • 4. Re: does ModuleClassLoader support class array syntax?
              Enguerrand Dibanda Newbie

              Hi,

               

              does this actually means that this feature in now "out of the box" and the system property

              -Dsun.lang.ClassLoader.allowArraySyntax=true doesnt have to be set anymore?

              I'm currently having the following problem while using JBoss 7.1.0.Final:

              • I set the -Dsun.lang.ClassLoader.allowArraySyntax=true propery and can see that it is passed to the JVM at boot

              10:12:14,514 INFO  [org.jboss.modules] (main) JBoss Modules version 1.1.1.GA

              10:12:14,886 INFO  [org.jboss.msc] (main) JBoss MSC version 1.0.2.GA

              10:12:15,028 INFO  [org.jboss.as] (MSC service thread 1-4) JBAS015899: JBoss AS 7.1.0.Final "Thunder" starting

              10:12:15,030 DEBUG [org.jboss.as.config] (MSC service thread 1-4) Configured system properties:

              ...

                      sun.jnu.encoding = UTF-8

                      sun.lang.ClassLoader.allowArraySyntax = true

                      sun.management.compiler = HotSpot 64-Bit Tiered Compilers

              ...

                      user.timezone = Europe/Berlin

              10:12:15,049 DEBUG [org.jboss.as.config] (MSC service thread 1-4) VM Arguments: -D[Server:dcs1] -XX:PermSize=256m -XX:MaxPermSize=256m -Xms1536m -Xmx1536m -Xss256k -XX:+UseParallelGC -XX:ParallelGCThreads=16 -XX:+DisableExplicitGC ... -Dsun.lang.ClassLoader.allowArraySyntax=true ... -Dlogging.configuration=file:/usr/local/jboss/domain/configuration/logging.properties

              10:12:15,300 INFO  [org.xnio] (MSC service thread 1-1) XNIO Version 3.0.3.GA

              10:12:15,316 INFO  [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.0.3.GA

              10:12:15,325 INFO  [org.jboss.remoting] (MSC service thread 1-1) JBoss Remoting version 3.2.2.GA

              10:12:22,995 INFO  [org.jboss.as.logging] (MSC service thread 1-3) JBAS011502: Removing bootstrap log handlers

               

              • I can't however see this system property when I query all system properties over the CLI

              [domain@localhost:9999 /] /host=dcs1/core-service=platform-mbean/type=runtime:read-attribute(name=system-properties)

              ...

                      "sun.jnu.encoding" => "UTF-8",

                      "sun.management.compiler" => "HotSpot 64-Bit Tiered Compilers",

              ...

              • 5. Re: does ModuleClassLoader support class array syntax?
                David Lloyd Master

                Well, it depends on whether you (or any of your frameworks) use custom class loaders, but all modules and deployments may load classes using array syntax without having to set the system property now.