Tobias Frech wrote:
> Hi Emiliano!
> I suggest not to set the properties in the code. Create a
> jndi.properties somewhere in your classpath with the following contents:
>
> java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
> java.naming.provider.url=hostname.of.server
> java.naming.factory.url.pkgs=org.jboss.naming
>
> Then just use 'new IntitialContext()'.
> That should work.
>
> Ciao, Tobias
Ok ... now I have a jndi.properties file in my classpath. I compile the
following client
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
import java.rmi.RemoteException;
import java.util.Properties;
import test.TestEJB;
import test.TestEJBHome;
public class Client
{
public static void main(String [] args)
{
try
{
System.out.println("OK 1");
InitialContext ctx = new InitialContext();
Object ref = ctx.lookup("TestEJB");
System.out.println("OK 2");
TestEJBHome home = (TestEJBHome) ref;
System.out.println("OK 3");
TestEJB test = home.create();
System.out.println("Message : " + test.toString());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
And the output is
OK 1
javax.naming.CommunicationException. Root exception is
java.lang.ClassNotFoundException:
org.jboss.ejb.plugins.jrmp13.interfaces.HomeProxy (no security manager:
RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:318)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:88)
at
sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:145)
at
java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:918)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at
java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java:2262)
at
java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:519)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1411)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at java.rmi.MarshalledObject.get(MarshalledObject.java:138)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:299)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:279)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at Client_1.main(Client_1.java:16)
Thanks very much for anyone can help me !!!!!!!!!!
Where I can find documentation on jboss ?
Thank you !!!!!!
Ciao Emiliano
P.S. scuse me my bad english ;-P
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]