Monday, April 16, 2012

JBoss 7 & Sandbox

JBoss 7 AS, has modular class loading. It provides true application isolation, hiding server implementation classes from application and only loading the classes your application needs. Modules, packaged as collections of classes, are peers that remain isolated unless explicitly defined as a dependency of another module. These visibility rules  can be customized. 

Due to this design, JBoss modules does not load everything from rt.jar and many other system jars by default. As a result you may get ClassNotFoundException or NoClassDefFounfError for a lot of classes. 

Open Office, web services tests might fail

Solution: jboss-deployment-structure.xml  -

To Fix this the solution is to, use a jboss-deployment-structure.xml in your war as explained here


<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
         <module name="deployment.system"/>
    <module name="deployment.system">
         <system export="true">
                 <path name="com/sun/net/ssl/internal/ssl"/>

However if for some reason you can't add jboss-deployment-structure.xml quickly in your application following are 2 workarounds.

Workarounds 1: For JRE System classes, There is a modue named "sun.jdk" that depdends on module "system". Here are defined all packages jboss loads from rt.jar.

In this module.xml of /sun/jdk/main directory add the required packages as -
                        <path name="com/sun/imageio/spi"/>
                        <path name="javax/annotation/processing"/>
etc, according to the need of application.

<module xmlns="urn:jboss:module:1.0" name="sun.jdk">
        <resource-root path="service-loader-resources"/>
        <module name="system" export="false" services="import">

                    <!-- extra packages -->
                    <path name="javax/annotation/processing"/>

                    <path name="com/sun/script/javascript"/>
                    <path name="com/sun/imageio/spi"/>
                    <path name="com/sun/jndi/dns"/>
                    <path name="com/sun/jndi/ldap"/>
                    <path name="com/sun/security/auth"/>
                    <path name="com/sun/security/auth/module"/>
                    <path name="sun/misc"/>
                    <path name="sun/nio"/>
                    <path name="sun/nio/ch"/>
                    <path name="sun/util"/>
                    <path name="sun/util/calendar"/>
                    <path name="META-INF/services"/>

Workaround 2:

Add jboss.modules.system.pkgs system property with comma separated list of packages to load. 


Additional Information:

Related issues - 

JBoss cfusion.ear/war deployment timeout:

If cfusion.ear is not deployed within the deployment timeout for jboss you can change the deployment timeout of jboss in standalone.xml
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0">
   <deployment-scanner scan-interval="5000"
      relative-to="jboss.server.base.dir" path="deployments"   deployment-timeout=”120”,/>


Performance tuning is an important part any application development.  In order to use JProfiler ofor jboss 7, first you need to add the following to your standalone.conf file:

JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=com.jprofiler -agentlib:jprofilerti -Xbootclasspath/a:/path/to/jprofiler/bin/agent.jar"

The "jboss.modules.system.pkgs" property tells JBoss Modules to allow the "com.profiler" classes to be found from any class loader, which is essential to allow the JProfiler agent to run. It is easier to then just set up your jprofiler sessio nas "Remote", and start the server and profiler.


  1. Have you taken a look at what it takes to deploy CF 11 on the latest community edition of Jboss, WildFly 8?

    I'm having class load errors there within the admin module. The navigation menu won't load.

    Class not found: com.adobe.coldfusion.entman.ProcessServer
    The error occurred in navserver.cfm: line 145
    Called from navserver.cfm: line 101
    Called from navserver.cfm: line 1
    Called from navserver.cfm: line 145

  2. Thanks a lot for the hint! Workaround 1 worked for my case


You can subscribe to the comments by licking on "Subscribe by email".