[jboss-dev] obtain server connection vs jboss-logging

Aleksandar Kostadinov akostadi at redhat.com
Wed Oct 8 07:22:04 EDT 2008


Hallo,

Hope I use the right list.

I'm creating a connection to JBoss AS as part of JBASM-3. See below for 
code and exception. I can workaround it by setting 
"org.jboss.logging.Logger.pluginClass" to "logging.JDK14LoggerPlugin". 
But as server manager could be running in any environment I guess 
blindly setting this system property is not desirable.

Any other ways I can fix that? Actually the code works but the exception 
is visible to the user.

Code like:
ctx=new InitialContext(properties);
MBeanServerConnection connection = (MBeanServerConnection) 
ctx.lookup("jmx/rmi/RMIAdaptor");
connection.invoke("jboss.system/type/Server", "shutdown",null,null);

*outputs* an exception:
[server:stop] Shutting down server: profileservice
[server:stop] java.lang.NoClassDefFoundError: org/apache/log4j/Priority
[server:stop]   at java.lang.Class.getDeclaredConstructors0(Native Method)
[server:stop]   at 
java.lang.Class.privateGetDeclaredConstructors(Class.java:235
7)
[server:stop]   at java.lang.Class.getConstructor0(Class.java:2671)
[server:stop]   at java.lang.Class.newInstance0(Class.java:321)
[server:stop]   at java.lang.Class.newInstance(Class.java:303)
[server:stop]   at 
org.jboss.logging.Logger.getDelegatePlugin(Logger.java:312)
[server:stop]   at org.jboss.logging.Logger.<init>(Logger.java:78)
[server:stop]   at org.jboss.logging.Logger.getLogger(Logger.java:291)
[server:stop]   at 
org.jnp.interfaces.NamingContext.<clinit>(NamingContext.java:
162)
[server:stop]   at 
org.jnp.interfaces.NamingContextFactory.getInitialContext(Nam
ingContextFactory.java:55)
...


Thanks much,
Aleksandar



More information about the jboss-development mailing list