I get a strange exception when I perform the jndiContext.lookup(...) below. Can
someone please point me in the right direction with this one? Also, I am kind
of new to EJB, I am wondering what steps I need to take in order to allow my
BMP bean to perform a jndi lookup on the datasource? The documents don't
seem to indicate how/where to add the reference to my database table.
Thanks.
Sean Kessler
Properties props=new Properties();
props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.provider.url", "localhost:1099");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
// Get a naming context
Context jndiContext=null;
try{jndiContext = new InitialContext(props);}
catch(Exception exception)
{
exception.printStackTrace();
return;
}
System.out.println("Got context");
Object objRef=null;
try{objRef=jndiContext.lookup("MyBean");}
catch(Exception exception)
{
exception.printStackTrace();
return;
}
main (13:45:59): javax.naming.CommunicationException. Root exception is java.io.StreamCorruptedException: Type code out of range, is 125
main (13:45:59): at java.io.ObjectInputStream.peekCode(ObjectInputStream.java:1280)
main (13:45:59): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:282)
main (13:45:59): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
main (13:45:59): at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:978)
main (13:45:59): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
main (13:45:59): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
main (13:45:59): at java.rmi.MarshalledObject.get(MarshalledObject.java:142)
main (13:45:59): at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:299)
main (13:45:59): at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:279)
main (13:45:59): at javax.naming.InitialContext.lookup(InitialContext.java:354)
main (13:45:59): at Proto.jboss(Proto.java:32)
main (13:45:59): at Proto.main(Proto.java:95)
main (13:45:59): at symantec.tools.debug.Agent.runMain(Native Method)
main (13:45:59): at symantec.tools.debug.MainThread.run(Agent.java:48)
