Hello, I have problem with using JNDI with Cocoon 2 in Weblogic 6.1 and Tomcat 4. Can anybody help me ?
thanks vlk First : Weblogic 6.1, Windows NT, Cocoon 2.0.1, jdk1.3.1 In Weblogic I get object whith lookup, but then I get ClassCastException, Context ctx=new InitialContext() Object obj1 = ctx.lookup("java:comp/env/ejb/MyObject") Object obj2 = PortableRemoteObject.narrow(obj1,MyClass.class); MyClass obj3 = (MyClass) obj2; // throw ClassCastException but when I change classloader to its parent, all work fine : Context ctx=new InitialContext() ClassLoader cl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(cl.getParent()); Object obj1 = ctx.lookup("java:comp/env/ejb/MyObject") Object obj2 = PortableRemoteObject.narrow(obj1,MyClass.class); MyClass obj3 = (MyClass) obj2; // no exception Second : Tomcat 4.0.2, Windows NT, Cocoon 2.0.1, jdk1.3.1 I get empty JNDI context in classes which are loaded in Cocoon ClassLoader Context ctx=new InitialContext() NamingEnumeration enu = ctx.list("java:comp") // now enu is empty But when I use, the same code in JSP-page without Cocoon2 servlet, it's work fine. Again, when I change ClassLoader to parent, it work. ClassLoader cl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(cl.getParent()); Context ctx=new InitialContext() NamingEnumeration enu = ctx.list("java:comp") // this work in Cocoon2 Thread.currentThread().setContextClassLoader(cl); In Tomcat sources I found, that each web-application has own JNDI-context, and this context is associated ( and identified ) with classloader. So when Cocoon creates own classloader, lost tomcat's JNDI context. --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>