• Post Reply Bookmark Topic Watch Topic
  • New Topic

JBoss Session Bean RMISecurity config & client  RSS feed

Gregory Hall
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using the JBoss 3.0 w/ Tomcat package to do
CMP Session Bean proof of concept.
I build and jar the Bean. (With jboss.xml in META-INF).
I successfully, (meaing the output claims I'm successfull)
hot deploy the jar by copying to $JBOSS_HOME/server/default/deploy.
I can go to localhost:8082 and see my bean under
jboss.j2ee && jboss.management.single just like the ejb/mgmt/MEJB example.
I have a client I use to connect.
I can successfuly list context ejb/sim_mgmt/ExcerciseMgmtSessionBean,
so I believe I have the jndi riddle solved.
This is the error I get:
javax.naming.CommunicationException. Root exception is java.lang.ClassNotFoundException: org.jboss.proxy.ClientContainer (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:368)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:159)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:629)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:200)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1503)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1425)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1616)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1264)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1830)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1756)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1636)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1264)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:322)
at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:30)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:449)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:429)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at sim_mgmt.SampleClient.<init>(SampleClient.java:52)
at sim_mgmt.SampleClient.main(SampleClient.java:91)
A call to System.getSecurityManager()
returns null, and I have tried passing -Djava.security.policy=$standard_rmi.policy in to no avail. Why? I belive because the missing security policy is in the container, not this process. Thus, I don't think I have properly configured jboss.
Is there something I must do in standardjboss.xml?
Here's my deployment descriptor:
<?xml version = '1.0' encoding = 'UTF-8'?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_2_0.dtd">
<description>Session Bean ( Stateful )</description>
And jboss.xml
<?xml version='1.0' encoding='UTF-8'?>
Can anyone inform me as to the difference between
RMIObjectPort 4444 and jndi 1099.
That is, if I merely specify
have I done enough to successfully establish RMI service, or must another property be set so that my
client can find the RMIObjectPort?
At the end of this schpeal I'll paste the client src.
What the hay's an MBean.
a: M = Managment
b: M = Message(driven)
c: M = Man we like to confuse newbies.

For now, I'm not attempting any DB connection,
or persistance.
Also, I found on sun's site that I'm not allowed
to load native libs from a bean, session or otherwise. Is this merely a firm recommendation, or will I bet hit with a copmiler or run-time exception if I try?
All input is greatly appreciated.
///// Here's that client.
package sim_mgmt;
import javax.ejb.*;
import javax.naming.*;
import java.util.*;
import javax.rmi.*;
/* Simple client for connecting to Sim Mgmt EJBSessionBean. */
public class SampleClient
public SampleClient()
NamingEnumeration enum;
// ejb org.jnp.interfaces.NamingContext ??
Properties jndiProps = System.getProperties();
"org.jboss.naming rg.jnp.interfaces");
Context ctx = new InitialContext(jndiProps);
System.out.println("Got context.");
enum = ctx.list("ejb/sim_mgmt");
System.out.println("ejb/sim_mgmt sub-contexts:");
/* This suceeds. */
SecurityManager sec = System.getSecurityManager();
if (sec == null)
System.out.println("NULL RMISecurityManager"); /* This prints */
// System.setSecurityManager(new RMISecurityManager());
// The following causes Exception
Object obj = ctx.lookup("ejb/sim_mgmt/ExcerciseMgmtSessionBean");
System.out.println("Got object: " + obj.toString());
ExcerciseMgmtSessionBeanHome home = (ExcerciseMgmtSessionBeanHome)
ExcerciseMgmtSessionBean excer_mgmt = home.create();
int ret = excer_mgmt.createEntity("TANK");
System.out.println("Ret val :" + ret);
catch ( SecurityException se )
se.printStackTrace ();
System.out.println(se.toString ());
catch( Exception ex )
System.out.println( "Exception:" );
private void dump(NamingEnumeration enum)
int i = 0;
try {
while (enum.hasMore())
System.out.println(i++ + enum.next().toString());
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!