[jboss-dev-forums] [JBoss AS7 Development] - Running AS7 embedded in Arquillian

Thomas Diesler do-not-reply at jboss.com
Mon Nov 22 07:42:42 EST 2010


Thomas Diesler [http://community.jboss.org/people/thomas.diesler%40jboss.com] created the discussion

"Running AS7 embedded in Arquillian"

To view the discussion, visit: http://community.jboss.org/message/572225#572225

--------------------------------------------------------------
This post describes what I have done and have seen when running AS7 embedded in Arquillian. There is a large overlap with what Kabir has done with embedded AS7 so lets try to converge.

The  https://github.com/jbosgi/arquillian/blob/jbas7/containers/jbossas-embedded-7/src/main/java/org/jboss/arquillian/container/jbossas/embedded_7/JBossASEmbeddedContainer.java JBossASEmbeddedContainer the  https://github.com/jbosgi/jboss-as/blob/arquillian/server/src/main/java/org/jboss/as/server/StandaloneServerFactory.java StandaloneServerFactory and waits for the Arquillian MBean to become available

         Properties sysprops = new Properties();
         sysprops.putAll(System.getProperties());
         sysprops.setProperty("jboss.home.dir", jbossHomeDir.getAbsolutePath());
         sysprops.setProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager");
         sysprops.setProperty("logging.configuration", "file:" + jbossHomeDir + "/standalone/configuration/logging.properties");
         sysprops.setProperty("org.jboss.boot.log.file", jbossHomeDir + "/standalone/log/boot.log");

         server = StandaloneServerFactory.create(jbossHomeDir, sysprops);
         server.start();

The StandaloneServerFactory uses the  https://github.com/jbosgi/jboss-as/blob/arquillian/server/src/main/java/org/jboss/as/server/InitialModuleLoaderFactory.java InitialModuleLoaderFactory to bootstrap modules with a controlled set of packages from the app classpath. I agree with Jason, it is impossible to put stuff on the appclasspath and somehow hope the test deployemnts will behave like they would in a running server.

For this to work in ARQ it is necessary that nothing initializes jdk logging before we have a chance to load the LoggingManager from the "org.jboss.logmanager" module. Therefore, I added a  https://github.com/jbosgi/arquillian/commit/6a7e152a1416a634047cf11178c7a901eee5d5cd looging abstraction to ARQ that allows you do disable or redirect ARQ logging to System.out

         <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <systemProperties>
                <property>
                  <name>java.util.logging.manager</name>
                  <value>org.jboss.logmanager.LogManager</value>
                </property>
                <property>
                  <name>arquillian.logging</name>
                  <value>system</value>
                </property>
              </systemProperties>
            </configuration>
          </plugin> 


The StandaloneServerFactory loads the server module and uses reflection and a proxy to bootstrap the server.

Currently, the server comes up and deployment fails with

12:46:07,295 ERROR [org.jboss.as.protocol.connection] (pool-1-thread-2) Failed to read a message: java.util.ServiceConfigurationError: org.jboss.marshalling.ProviderDescriptor: Provider org.jboss.marshalling.river.RiverProviderDescriptor could not be instantiated: java.lang.ClassCastException
    at java.util.ServiceLoader.fail(ServiceLoader.java:207) [:1.6.0_21]
    at java.util.ServiceLoader.access$100(ServiceLoader.java:164) [:1.6.0_21]
    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:353) [:1.6.0_21]
    at java.util.ServiceLoader$1.next(ServiceLoader.java:421) [:1.6.0_21]
    at org.jboss.marshalling.Marshalling.loadMarshallerFactory(Marshalling.java:78) [jboss-marshalling-1.3.0.CR8.jar:1.3.0.CR8]
    at org.jboss.marshalling.Marshalling.getMarshallerFactory(Marshalling.java:74) [jboss-marshalling-1.3.0.CR8.jar:1.3.0.CR8]
    at org.jboss.as.protocol.ProtocolUtils.<clinit>(ProtocolUtils.java:50) [jboss-as-protocol-7.0.0.Alpha1.jar:7.0.0.Alpha1]
    at org.jboss.as.protocol.mgmt.ManagementProtocolHeader.read(ManagementProtocolHeader.java:75) [jboss-as-protocol-7.0.0.Alpha1.jar:7.0.0.Alpha1]
    at org.jboss.as.protocol.mgmt.ManagementResponseHeader.read(ManagementResponseHeader.java:60) [jboss-as-protocol-7.0.0.Alpha1.jar:7.0.0.Alpha1]
    at org.jboss.as.protocol.mgmt.ManagementProtocolHeader.<init>(ManagementProtocolHeader.java:55) [jboss-as-protocol-7.0.0.Alpha1.jar:7.0.0.Alpha1]
    at org.jboss.as.protocol.mgmt.ManagementResponseHeader.<init>(ManagementResponseHeader.java:45) [jboss-as-protocol-7.0.0.Alpha1.jar:7.0.0.Alpha1]
    at org.jboss.as.protocol.mgmt.ManagementRequest$1.handle(ManagementRequest.java:124) [jboss-as-protocol-7.0.0.Alpha1.jar:7.0.0.Alpha1]



StandaloneServer is now an interface that also supports StandaloneServer.stop(). The idea is that the factory installs a service that can be used to bring down the server.

To try this out you need to checkout these branches

 https://github.com/jbosgi/arquillian/tree/jbas7 https://github.com/jbosgi/arquillian/tree/jbas7
 https://github.com/jbosgi/jboss-as/tree/arquillian https://github.com/jbosgi/jboss-as/tree/arquillian

Build AS7 and in arquillian run

mvn -Djboss.home=/home/tdiesler/git/jboss-as/build/target/jboss-7.0.0.Alpha2 -pl container/jbossas-embedded-7 -am install


I'll talk this through with Kabir. So hopefully the demos and other smoke/integration tests can be embedded ARQ tests soon.

cheers
-thomas
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/572225#572225]

Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20101122/78873f5c/attachment.html 


More information about the jboss-dev-forums mailing list