Kabir Khan [
http://community.jboss.org/people/kabir.khan%40jboss.com] created the
discussion
"Embedded AS"
To view the discussion, visit:
http://community.jboss.org/message/569335#569335
--------------------------------------------------------------
I'm having a play with getting the demos working as tests, and thought it would be
cool to be able to start standalone in-vm as was done in
BatchFailuresUnitTestCase/AbstractDeploymentTest.
The first problem I see is that when trying to use the StandaloneClient and calling
SC.getServerModel() I get this exception:
Exception in thread "pool-11-thread-2" java.util.ServiceConfigurationError:
org.jboss.marshalling.ProviderDescriptor: Provider org.jboss.mar
shalling.river.RiverProviderDescriptor could not be instantiated:
java.lang.IllegalAccessError: tried to access class org.jboss.marshalling.
reflect.ConcurrentReferenceHashMap from class
org.jboss.marshalling.reflect.SerializableClassRegistry
at java.util.ServiceLoader.fail(ServiceLoader.java:207)
at java.util.ServiceLoader.access$100(ServiceLoader.java:164)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:353)
at java.util.ServiceLoader$1.next(ServiceLoader.java:421)
at org.jboss.marshalling.Marshalling.loadMarshallerFactory(Marshalling.java:78)
at org.jboss.marshalling.Marshalling.getMarshallerFactory(Marshalling.java:74)
at org.jboss.as.protocol.ProtocolUtils.<clinit>(ProtocolUtils.java:50)
at
org.jboss.as.protocol.mgmt.ManagementProtocolHeader.read(ManagementProtocolHeader.java:75)
at
org.jboss.as.protocol.mgmt.ManagementResponseHeader.read(ManagementResponseHeader.java:60)
at
org.jboss.as.protocol.mgmt.ManagementProtocolHeader.<init>(ManagementProtocolHeader.java:55)
at
org.jboss.as.protocol.mgmt.ManagementResponseHeader.<init>(ManagementResponseHeader.java:45)
at org.jboss.as.protocol.mgmt.ManagementRequest$1.handle(ManagementRequest.java:124)
at
org.jboss.as.protocol.mgmt.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:59)
at org.jboss.as.protocol.ConnectionImpl.safeHandleMessage(ConnectionImpl.java:239)
at org.jboss.as.protocol.ConnectionImpl$1$1.run(ConnectionImpl.java:198)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.IllegalAccessError: tried to access class
org.jboss.marshalling.reflect.ConcurrentReferenceHashMap from class org.jboss
.marshalling.reflect.SerializableClassRegistry
at
org.jboss.marshalling.reflect.SerializableClassRegistry.<init>(SerializableClassRegistry.java:61)
at
org.jboss.marshalling.reflect.SerializableClassRegistry.<clinit>(SerializableClassRegistry.java:42)
at
org.jboss.marshalling.river.RiverMarshallerFactory$1.run(RiverMarshallerFactory.java:46)
at
org.jboss.marshalling.river.RiverMarshallerFactory$1.run(RiverMarshallerFactory.java:44)
at java.security.AccessController.doPrivileged(Native Method)
at
org.jboss.marshalling.river.RiverMarshallerFactory.<init>(RiverMarshallerFactory.java:44)
at
org.jboss.marshalling.river.RiverProviderDescriptor.<clinit>(RiverProviderDescriptor.java:35)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:345)
... 15 more
Exception in thread "pool-11-thread-2" java.util.ServiceConfigurationError:
org.jboss.marshalling.ProviderDescriptor: Provider org.jboss.mar
shalling.river.RiverProviderDescriptor could not be instantiated:
java.lang.IllegalAccessError: tried to access class org.jboss.marshalling.
reflect.ConcurrentReferenceHashMap from class
org.jboss.marshalling.reflect.SerializableClassRegistry
at java.util.ServiceLoader.fail(ServiceLoader.java:207)
at java.util.ServiceLoader.access$100(ServiceLoader.java:164)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:353)
at java.util.ServiceLoader$1.next(ServiceLoader.java:421)
at org.jboss.marshalling.Marshalling.loadMarshallerFactory(Marshalling.java:78)
at org.jboss.marshalling.Marshalling.getMarshallerFactory(Marshalling.java:74)
at org.jboss.as.protocol.ProtocolUtils.<clinit>(ProtocolUtils.java:50)
at
org.jboss.as.protocol.mgmt.ManagementProtocolHeader.read(ManagementProtocolHeader.java:75)
at
org.jboss.as.protocol.mgmt.ManagementResponseHeader.read(ManagementResponseHeader.java:60)
at
org.jboss.as.protocol.mgmt.ManagementProtocolHeader.<init>(ManagementProtocolHeader.java:55)
at
org.jboss.as.protocol.mgmt.ManagementResponseHeader.<init>(ManagementResponseHeader.java:45)
at org.jboss.as.protocol.mgmt.ManagementRequest$1.handle(ManagementRequest.java:124)
at
org.jboss.as.protocol.mgmt.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:59)
at org.jboss.as.protocol.ConnectionImpl.safeHandleMessage(ConnectionImpl.java:239)
at org.jboss.as.protocol.ConnectionImpl$1$1.run(ConnectionImpl.java:198)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.IllegalAccessError: tried to access class
org.jboss.marshalling.reflect.ConcurrentReferenceHashMap from class org.jboss
.marshalling.reflect.SerializableClassRegistry
at
org.jboss.marshalling.reflect.SerializableClassRegistry.<init>(SerializableClassRegistry.java:61)
at
org.jboss.marshalling.reflect.SerializableClassRegistry.<clinit>(SerializableClassRegistry.java:42)
at
org.jboss.marshalling.river.RiverMarshallerFactory$1.run(RiverMarshallerFactory.java:46)
at
org.jboss.marshalling.river.RiverMarshallerFactory$1.run(RiverMarshallerFactory.java:44)
at java.security.AccessController.doPrivileged(Native Method)
at
org.jboss.marshalling.river.RiverMarshallerFactory.<init>(RiverMarshallerFactory.java:44)
at
org.jboss.marshalling.river.RiverProviderDescriptor.<clinit>(RiverProviderDescriptor.java:35)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:345)
... 15 more
ADT starts the server without using modules so everything uses the app classpath, so that
may be the reason for the exception?
I have created a little 'ServerStarter' module programatically from my tests and
added that to the module roots of my LocalModuleLoader. The server is then started with
the correct module classloader and most classes are loaded from the module I would expect.
The exception is when a module that defines the 'system' dependency tries to load
a class and it both exists on the app classpath and in a 'real' module. In this
case the class is always loaded from 'system'.
Looking at Module.loadModuleClass() the loaders for the path for this situation seem to
always have SystemLocalLoader before the ModuleClassLoaders. Is this intentional? Is there
another way to have things both in app classpath and in modules always be loaded by
modules?
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/569335#569335]
Start a new discussion in JBoss AS7 Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]