<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Embedded AS
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/kabir.khan%40jboss.com">Kabir Khan</a> in <i>JBoss AS7 Development</i> - <a href="http://community.jboss.org/message/569335#569335">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The first problem I see is that when trying to use the StandaloneClient and calling SC.getServerModel() I get this exception:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Exception in thread "pool-11-thread-2" java.util.ServiceConfigurationError: org.jboss.marshalling.ProviderDescriptor: Provider org.jboss.mar</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">shalling.river.RiverProviderDescriptor could not be instantiated: java.lang.IllegalAccessError: tried to access class org.jboss.marshalling.</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">reflect.ConcurrentReferenceHashMap from class org.jboss.marshalling.reflect.SerializableClassRegistry</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at java.util.ServiceLoader.fail(ServiceLoader.java:207)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at java.util.ServiceLoader.access$100(ServiceLoader.java:164)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:353)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at java.util.ServiceLoader$1.next(ServiceLoader.java:421)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.marshalling.Marshalling.loadMarshallerFactory(Marshalling.java:78)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.marshalling.Marshalling.getMarshallerFactory(Marshalling.java:74)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.as.protocol.ProtocolUtils.<clinit>(ProtocolUtils.java:50)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.as.protocol.mgmt.ManagementProtocolHeader.read(ManagementProtocolHeader.java:75)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.as.protocol.mgmt.ManagementResponseHeader.read(ManagementResponseHeader.java:60)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.as.protocol.mgmt.ManagementProtocolHeader.<init>(ManagementProtocolHeader.java:55)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.as.protocol.mgmt.ManagementResponseHeader.<init>(ManagementResponseHeader.java:45)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.as.protocol.mgmt.ManagementRequest$1.handle(ManagementRequest.java:124)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.as.protocol.mgmt.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:59)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.as.protocol.ConnectionImpl.safeHandleMessage(ConnectionImpl.java:239)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.as.protocol.ConnectionImpl$1$1.run(ConnectionImpl.java:198)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at java.lang.Thread.run(Thread.java:680)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Caused by: java.lang.IllegalAccessError: tried to access class org.jboss.marshalling.reflect.ConcurrentReferenceHashMap from class org.jboss</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">.marshalling.reflect.SerializableClassRegistry</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.marshalling.reflect.SerializableClassRegistry.<init>(SerializableClassRegistry.java:61)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.marshalling.reflect.SerializableClassRegistry.<clinit>(SerializableClassRegistry.java:42)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.marshalling.river.RiverMarshallerFactory$1.run(RiverMarshallerFactory.java:46)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.marshalling.river.RiverMarshallerFactory$1.run(RiverMarshallerFactory.java:44)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at java.security.AccessController.doPrivileged(Native Method)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.marshalling.river.RiverMarshallerFactory.<init>(RiverMarshallerFactory.java:44)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at org.jboss.marshalling.river.RiverProviderDescriptor.<clinit>(RiverProviderDescriptor.java:35)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at java.lang.Class.forName0(Native Method)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at java.lang.Class.forName(Class.java:247)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:345)</div><div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">... 15 more</div><p>Exception in thread "pool-11-thread-2" java.util.ServiceConfigurationError: org.jboss.marshalling.ProviderDescriptor: Provider org.jboss.mar</p><p>shalling.river.RiverProviderDescriptor could not be instantiated: java.lang.IllegalAccessError: tried to access class org.jboss.marshalling.</p><p>reflect.ConcurrentReferenceHashMap from class org.jboss.marshalling.reflect.SerializableClassRegistry</p><p><span style="white-space: pre;"> </span>at java.util.ServiceLoader.fail(ServiceLoader.java:207)</p><p><span style="white-space: pre;"> </span>at java.util.ServiceLoader.access$100(ServiceLoader.java:164)</p><p><span style="white-space: pre;"> </span>at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:353)</p><p><span style="white-space: pre;"> </span>at java.util.ServiceLoader$1.next(ServiceLoader.java:421)</p><p><span style="white-space: pre;"> </span>at org.jboss.marshalling.Marshalling.loadMarshallerFactory(Marshalling.java:78)</p><p><span style="white-space: pre;"> </span>at org.jboss.marshalling.Marshalling.getMarshallerFactory(Marshalling.java:74)</p><p><span style="white-space: pre;"> </span>at org.jboss.as.protocol.ProtocolUtils.<clinit>(ProtocolUtils.java:50)</p><p><span style="white-space: pre;"> </span>at org.jboss.as.protocol.mgmt.ManagementProtocolHeader.read(ManagementProtocolHeader.java:75)</p><p><span style="white-space: pre;"> </span>at org.jboss.as.protocol.mgmt.ManagementResponseHeader.read(ManagementResponseHeader.java:60)</p><p><span style="white-space: pre;"> </span>at org.jboss.as.protocol.mgmt.ManagementProtocolHeader.<init>(ManagementProtocolHeader.java:55)</p><p><span style="white-space: pre;"> </span>at org.jboss.as.protocol.mgmt.ManagementResponseHeader.<init>(ManagementResponseHeader.java:45)</p><p><span style="white-space: pre;"> </span>at org.jboss.as.protocol.mgmt.ManagementRequest$1.handle(ManagementRequest.java:124)</p><p><span style="white-space: pre;"> </span>at org.jboss.as.protocol.mgmt.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:59)</p><p><span style="white-space: pre;"> </span>at org.jboss.as.protocol.ConnectionImpl.safeHandleMessage(ConnectionImpl.java:239)</p><p><span style="white-space: pre;"> </span>at org.jboss.as.protocol.ConnectionImpl$1$1.run(ConnectionImpl.java:198)</p><p><span style="white-space: pre;"> </span>at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)</p><p><span style="white-space: pre;"> </span>at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)</p><p><span style="white-space: pre;"> </span>at java.lang.Thread.run(Thread.java:680)</p><p>Caused by: java.lang.IllegalAccessError: tried to access class org.jboss.marshalling.reflect.ConcurrentReferenceHashMap from class org.jboss</p><p>.marshalling.reflect.SerializableClassRegistry</p><p><span style="white-space: pre;"> </span>at org.jboss.marshalling.reflect.SerializableClassRegistry.<init>(SerializableClassRegistry.java:61)</p><p><span style="white-space: pre;"> </span>at org.jboss.marshalling.reflect.SerializableClassRegistry.<clinit>(SerializableClassRegistry.java:42)</p><p><span style="white-space: pre;"> </span>at org.jboss.marshalling.river.RiverMarshallerFactory$1.run(RiverMarshallerFactory.java:46)</p><p><span style="white-space: pre;"> </span>at org.jboss.marshalling.river.RiverMarshallerFactory$1.run(RiverMarshallerFactory.java:44)</p><p><span style="white-space: pre;"> </span>at java.security.AccessController.doPrivileged(Native Method)</p><p><span style="white-space: pre;"> </span>at org.jboss.marshalling.river.RiverMarshallerFactory.<init>(RiverMarshallerFactory.java:44)</p><p><span style="white-space: pre;"> </span>at org.jboss.marshalling.river.RiverProviderDescriptor.<clinit>(RiverProviderDescriptor.java:35)</p><p><span style="white-space: pre;"> </span>at java.lang.Class.forName0(Native Method)</p><p><span style="white-space: pre;"> </span>at java.lang.Class.forName(Class.java:247)</p><p><span style="white-space: pre;"> </span>at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:345)</p><p><span style="white-space: pre;"> </span>... 15 more</p></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>ADT starts the server without using modules so everything uses the app classpath, so that may be the reason for the exception?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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'.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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?</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/569335#569335">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss AS7 Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>