So I wrote:
*****************************************************************
public static void main(String[] args) throws Exception
   {
       try{

InitialContext iniCtx = new InitialContext();
Context ejbCtx = (Context)iniCtx.lookup("java:/Count");
CountHome home = (CountHome)
javax.rmi.PortableRemoteObject.narrow(
ejbCtx.lookup("CountHome"), CountHome.class);
...
*****************************************************************
and in console I got:


*****************************************************************
javax.naming.NoInitialContextException: Need to specify class name in environmen
t or system property, or as an applet parameter, or in an application resource f
ile: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
40)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
a:280)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at cz.iccc.ejb.ses.testses.CountClient.main(CountClient.java:36)
*****************************************************************


How I can access this ejb correctly?
In manager I see:


Stateful Session Bean



Name


Count (JNDI: Count)


EJB Module


counter.jar

What is correct way?

Thanks





Adrian Brock wrote:

I will rephrase it. Don't use Provider_URL if you
want to access the java:/ namespace.

JBoss provides a default initial context using
new InitialContext() that has access.

Access to java:/ namespace outside the JVM is not
available.

Regards,
Adrian

On Fri, 2003-08-22 at 08:35, Jiri Chaloupka wrote:


so, in console I found that source is named java:/Count
and if I call
...

InitialContext iniCtx = new InitialContext(props);
Context ejbCtx = (Context)iniCtx.lookup("java:Count");

I still receiving

java.lang.reflect.UndeclaredThrowableException
        at $Proxy0.lookup(Unknown Source)



but, if I should call new InitialContext() instead of InitialContext(props), haw I can set INITIAL_CONTEXT_FACTORY and PROVIDER_URL?

Thanks
Jiri

Adrian Brock wrote:



You should use new InitialContext(); when access java:comp/env

Regards,
Adrian


On Wed, 2003-08-20 at 14:23, Jiri Chaloupka wrote:





Hallo,
I am learning about ejbs ...
I have some ejb deployed on JBoss and client for this, where is:

************************************************
Properties props = System.getProperties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.naming.HttpNamingContextFactory");
props.setProperty(Context.PROVIDER_URL,
"http://localhost/invoker/ReadOnlyJNDIFactory";);
InitialContext iniCtx = new InitialContext(props);
Context ejbCtx = (Context)iniCtx.lookup("java:comp/env/ejb");
...
************************************************








-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user





-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user






-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to