This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Initial context exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Initial context exception" Watch "Initial context exception" New topic
Author

Initial context exception

Priya Jothi
Ranch Hand

Joined: Jul 13, 2004
Posts: 168
Hi All,

When am trying to run the java code in tomcat server which tries to create the Initial context object with the following properties it is throwing an exception.


In my sample.client.T3MBeanConnector.java i have the following code.

Hashtable table = new Hashtable();
table.put(Context.SECURITY_PRINCIPAL, user);
table.put(Context.SECURITY_CREDENTIALS, password);
table.put(Context.PROVIDER_URL, url);
table.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");

sop("Map obj : " + table); // This works

InitialContext context = new InitialContext(table); // It strucks & exception is thrown

sop("Context obj : " + context); //This will never get printed


It is throwing an exception given below.In order to create an initial context object I've set weblogic.jar in classpath in catalina.bat.From the stacktrace it is understandable that it has also been considered.But I dont know how to fix the below issue. From where(which jar) it is taking this SAXParserFactory is unknown still.When i try to run as a simple standalone program it works.But when tomcat is executing the same code it is not working.Strange!!!.What is wrong here?.

java.lang.NoSuchMethodError: javax.xml.parsers.SAXParserFactory.getSchema()Ljavax/xml/validation/Schema;
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.<init>(SAXParserImpl.java:124)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl.newSAXParser(SAXParserFactoryImpl.java:98)
at weblogic.xml.jaxp.WebLogicSAXParser.<init>(WebLogicSAXParser.java:45)
at weblogic.xml.jaxp.WebLogicSAXParserFactory.newSAXParser(WebLogicSAXParserFactory.java:51)
at weblogic.rmi.internal.DescriptorManager.getDescriptorAsMap(DescriptorManager.java:176)
at weblogic.rmi.internal.DescriptorManager.getDescriptorAsMap(DescriptorManager.java:162)
at weblogic.rmi.internal.DescriptorManager.createRuntimeDescriptor(DescriptorManager.java:107)
at weblogic.rmi.internal.DescriptorManager.getBasicRuntimeDescriptor(DescriptorManager.java:88)
at weblogic.rmi.internal.DescriptorManager.getDescriptor(DescriptorManager.java:54)
at weblogic.rmi.extensions.server.ServerHelper.getRuntimeDescriptor(ServerHelper.java:332)
at weblogic.common.internal.RMIBootServiceStub.<clinit>(RMIBootServiceStub.java:29)
at weblogic.security.acl.internal.Security.authenticate(Security.java:177)
at weblogic.jndi.WLInitialContextFactoryDelegate.authenticateRemotely(WLInitialContextFactoryDelegate.java:700)
at weblogic.jndi.WLInitialContextFactoryDelegate.pushSubject(WLInitialContextFactoryDelegate.java:633)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:440)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:353)
at weblogic.jndi.Environment.getContext(Environment.java:263)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
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 sample.client.T3MBeanConnector.getServerConnector(Unknown Source)
at sample.client.MBeanConnectionHelper.getMBeanServer(Unknown Source)
at sample.servlets.RuntimeAction.execute(Unknown Source)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)

Details of s/w used :

Weblogic : 9.1
Tomcat : 5.0
JDK : 1.5

Any inputs on this would be highly appreciated!!.
Expecting reply at the earliest..Thanks in advance..

Regards,
Priya.
S Raman
Greenhorn

Joined: Mar 29, 2006
Posts: 16
Hi,
Try to find out whether you have multiple XMLParser in your Tomcat Path
Since you have mentioned you dont know which Parser says that

Bye
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Initial context exception
 
Similar Threads
getting error of sockets
Remote Home lookup from tomcat 5.0 to Weblogic 8.1
remote server access ....
Validator with Struts Problem ?
Getting Relaying denied error while sending out mails