Hello,
I would like to use a CORBA object from servlet running under Tomcat 5.
Following code is used to resolve object throught JNDI:

protected Context getNamingContext() throws NamingException {
        org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
        if( orb != null ) {
                Hashtable env = new Hashtable();
                env.put("java.naming.corba.orb", orb);
                env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.cosnaming.CNCtxFactory");
                env.put(Context.PROVIDER_URL, "iiop://localhost:2809");
                Context ic = new InitialContext(env);
                return ic;
        } else
                return null;
}

protected ivq getVirtualQmail() throws NamingException {
        Context ic = getNamingContext();
        ivq vqo = ivqHelper.narrow((org.omg.CORBA.Object) ic.lookup("VQ.ivq"));
        return vqo;
}

I get following exception running code beyond:

Caused by: org.omg.CORBA.OBJECT_NOT_EXIST:   vmcid: OMG  minor code: 1 
completed: No
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0(Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at
com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.getSystemException(MessageBase.java:897)
        at
com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_0.getSystemException(ReplyMessage_1_0.java:94)
        at
com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(CorbaMessageMediatorImpl.java:572)
        at
com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:430)
        at
com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:326)
        at
com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:129)
        at
com.sun.corba.se.impl.resolver.BootstrapResolverImpl.invoke(BootstrapResolverImpl.java:89)
        at
com.sun.corba.se.impl.resolver.BootstrapResolverImpl.resolve(BootstrapResolverImpl.java:107)
        at
com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:22)
        at
com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:22)
        at
com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:22)
        at
com.sun.corba.se.impl.orb.ORBImpl.resolve_initial_references(ORBImpl.java:1157)
        at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(CNCtx.java:340)
        at com.sun.jndi.cosnaming.CNCtx.initUsingIiopUrl(CNCtx.java:289)
        at com.sun.jndi.cosnaming.CNCtx.initUsingUrl(CNCtx.java:245)
        at com.sun.jndi.cosnaming.CNCtx.initOrbAndRootContext(CNCtx.java:209)
        at com.sun.jndi.cosnaming.CNCtx.<init>(CNCtx.java:69)
        at
com.sun.jndi.cosnaming.CNCtxFactory.getInitialContext(CNCtxFactory.java:32)
        at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
        at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
        at javax.naming.InitialContext.init(InitialContext.java:223)
        at javax.naming.InitialContext.<init>(InitialContext.java:197)
        at
com.foo_baz.ihs.VirtualQmailMailService.getNamingContext(Unknown
Source)
        at com.foo_baz.ihs.VirtualQmailMailService.getVirtualQmail(Unknown
Source)
...

This code when run from a command line works without problems.
I would appreciate any hints. When running command line version
of this code I can also repoduce this error - by removing this
two lines:

org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
env.put("java.naming.corba.orb", orb);

I tried to google for it, I implemented this as in examples found.
Don't know what to do.

Best regards,
Pawel

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to