Latest Entries »

Tuesday, April 28, 2009

javax.naming.NameNotFoundException: Name java:comp is not bound in this Context


To resolve this exception, need to cross check context.xml, web.xml and jar files.

Creation of context.xml in your META-INF auto generates the xml file with the project name in TOMCAT/conf/ ( C:\Program Files\Apache Software Foundation\apache-tomcat-6.0.18\conf\Catalina\localhost ) cross check this file.

compare context.xml and web.xml with the reference files posted in my previous posting.









No need to create an entry in TOMCAT context.xml and server.xml files.

Finally you need to check your lib folders, both tomcat and project lib.

If you have the following jar's in your lib folder, then remove those

a) naming-common.jar
b) naming-factory.jar
c) naming-resources.jar

clean and rebuild your project and then deploy it, before starting tomcat delete xml file from C:\Program Files\Apache Software Foundation\apache-tomcat-6.0.18\conf\Catalina\localhost

Stack Trace:

javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:765)
at org.apache.naming.NamingContext.lookup(NamingContext.java:147)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.sravan.As400Connection.getConnection(As400Connection.java:47)
at com.sravan.GetValuesFromDB.getViolationCodeQM(GetValuesFromDB.java:1054)
at com.sravan.InsertintoDB.insertFromIntofiles(InsertintoDB.java:746)
at com.parseWEB.Services.ProjectNameSoapBindingImpl.getRequest(ProjectNameSoapBindingImpl.java:545)
at com.parseWEB.Services.ProjectNameSoapBindingSkeleton.getRequest(ProjectNameSoapBindingSkeleton.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)

Stack Trace of TOMCAT:

May 31, 2009 10:01:39 AM org.apache.tomcat.util.modeler.Registry registerComponent
SEVERE: Null component Catalina:type=DataSource,path=/ProjectName,host=localhost,class=javax.sql.DataSource,name="jdbc/DataSourceAS400"
May 31, 2009 10:01:39 AM org.apache.tomcat.util.modeler.Registry registerComponent
SEVERE: Null component Catalina:type=DataSource,path=/ProjectName,host=localhost,class=javax.sql.DataSource,name="jdbc/DataSource"

2 comments:

Unknown said...

Hi i am getting the following error:

"javax.naming.NameNotFoundException & com.btt.bms.dal.DALException."

Here i am sharing sample snippet code:
Here i am using Tomcat 5.5 and Postgresql database.

Can u resolve my problem...

context.xml







web.xml





HTTPController
com.btt.bms.controller.HTTPController
1



AJAXController
com.btt.bms.controller.AJAXController


HTTPController
*.action



AJAXController
*.do


login.jsp


postgreSQL connection
jdbc/btt
javax.sql.DataSource
Container



Regards,
Naveen.

Unknown said...
This comment has been removed by the author.