[jboss-user] [Security & JAAS/JBoss] - Getting Exception while trying to access a Stateless EJB in
dvuday
do-not-reply at jboss.com
Sun Dec 10 10:08:47 EST 2006
Hi...
I am trying to access a Stateless EJB
I am getting an Exception when trying to access the EJB which is deployed in the jboss server.
==========================================
The client program from which I tried to access is :
==========================================
package client;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import examples.ejb21.Hello;
import examples.ejb21.HelloHome;
public class HelloClient
{
public static void main (String args[])throws Exception
{
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.HttpNamingContextFactory");
props.put(Context.PROVIDER_URL,"jnp://localhost:8080");
Context ctx = new InitialContext(props);
Object obj = ctx.lookup("HelloHome");
HelloHome home = (HelloHome)PortableRemoteObject.narrow(obj, HelloHome.class);
Hello hello = home.create();
System.out.println(hello.hello());
hello.remove();
}
}
=============================================================================================
The Exception I got is
javax.naming.NamingException: Failed to retrieve Naming interface [Root exception is java.io.StreamCorruptedException: invalid stream header]
at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java:69)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.(Unknown Source)
at client.HelloClient.main(HelloClient.java:30)
Caused by: java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.(Unknown Source)
at org.jboss.naming.HttpNamingContextFactory.getNamingServer(HttpNamingContextFactory.java:119)
at org.jboss.naming.HttpNamingContextFactory.getInitialContext(HttpNamingContextFactory.java:65)
... 5 more
Exception in thread "main"
========================================================================
Can anybody help me to come out of this Exception??
Thanks in advance
Uday
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3992542#3992542
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3992542
More information about the jboss-user
mailing list