websphere6.0下部署war包,异常javax.naming.NameNotFoundException: Namenotfound java:

Jark_wang 2012-10-31 03:06:09
websphere6.0下部署war包,异常javax.naming.NameNotFoundException: Namenotfound java:
web.xml配置:

<resource-ref id="ResourceRef_1">
<description>DB Connection</description>
<res-ref-name>oscdb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

spring.xml 配置
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>oscdb</value>
</property>
<property name="resourceRef">
<value>true</value>
</property>
</bean>
那位大侠有遇到此类问题,请一起讨论一下,谢谢!!!
异常日志如下:
************* End Display Current Environment *************
[12-10-31 14:56:00:812 CST] 0000007f javaURLContex E NMSV0310E: 由于服务器运行时无法将“java:”名称上的 JNDI 操作的线程与任何 J2EE 应用程序组件相关联,该操作无法完成。当使用“java:”名称的 JNDI 客户机不在服务器应用程序请求的线程中执行时,就会出现这种情况。确保 J2EE 应用程序不在静态代码块或该 J2EE 应用程序创建的线程中对“java:”名称执行 JNDI 操作。此类代码不必在服务器应用程序请求的线程中运行,因此不受“java:”名称上的 JNDI 操作支持。异常堆栈跟踪:
javax.naming.ConfigurationException [Root exception is javax.naming.NameNotFoundException: Name not found in context "java:".]
at com.ibm.ws.naming.java.javaURLContextImpl.throwConfigurationExceptionWithDefaultJavaNS(javaURLContextImpl.java:411)

at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:388)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:201)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:142)
at javax.naming.InitialContext.lookup(InitialContext.java:363)
at com.paraview.jar.core.tools.ServiceLocator.getInitialContext(ServiceLocator.java:182)
at com.paraview.jar.core.tools.ServiceLocator.<init>(ServiceLocator.java:57)
at com.paraview.jar.core.tools.ServiceLocator.getInstance(ServiceLocator.java:73)
at com.paraview.jar.core.tools.ConnDefImpl.getDataSource(ConnDefImpl.java:64)
at com.para.osc.framework.common.base.BaseDaoEntity.getConnection(BaseDaoEntity.java:25)
at com.paraview.jar.core.tools.ConnDefImpl.getConn(ConnDefImpl.java:96)
at com.paraview.jar.core.table.TableImpl.<init>(TableImpl.java:92)
at com.paraview.jar.core.table.TableImpl.getInstance(TableImpl.java:279)
at com.paraview.jar.core.factory.TableFactory.getTableHandler(TableFactory.java:40)
at com.paraview.jar.core.factory.TableFactory.getTableHandler(TableFactory.java:66)
at com.para.osc.framework.common.base.BaseDaoImpl.getTableInterface(BaseDaoImpl.java:21)
at com.para.osc.framework.common.base.DaoImpl.queryList(DaoImpl.java:424)
at com.para.osc.framework.security.service.impl.PrPasswordLogServiceImpl.query(PrPasswordLogServiceImpl.java:374)
at com.para.osc.framework.security.service.impl.PrPasswordLogServiceImpl$$FastClassByCGLIB$$b6a96355.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
at com.para.osc.framework.security.service.impl.PrPasswordLogServiceImpl$$EnhancerByCGLIB$$e2453cb0.query(<generated>)
at com.para.osc.framework.security.service.impl.PrEmployeeRequestLogServiceImpl.doProcessApplyPwdCheckOnline(PrEmployeeRequestLogServiceImpl.java:628)
at com.para.osc.framework.security.service.impl.PrEmployeeRequestLogServiceImpl$$FastClassByCGLIB$$fdf29789.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
at com.para.osc.framework.security.service.impl.PrEmployeeRequestLogServiceImpl$$EnhancerByCGLIB$$34c6beac.doProcessApplyPwdCheckOnline(<generated>)
at com.para.osc.framework.common.quartz.TimingFlowJobTasks$1.callback(TimingFlowJobTasks.java:48)
at com.para.osc.framework.common.quartz.ThreadSyncComponent.syncRun(ThreadSyncComponent.java:80)
at com.para.osc.framework.common.quartz.TimingFlowJobTasks.doApplyPwdCheckOnlineJob(TimingFlowJobTasks.java:44)
at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:311)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113)
at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Thread.java:797)
Caused by: javax.naming.NameNotFoundException: Name not found in context "java:".
...全文
4615 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
aBOUNTWINTER 2013-07-13
  • 打赏
  • 举报
回复
我也遇到过此类问题,不过我用的服务器是Jboss,此类问题不一定是代码的问题,也有可能是工具版本的问题。比如,我以前装的是jdk1.7版本的,服务器是jboss-4.0.5的。运行自己写的ejb小例子,每次都报NameNotFoundException,后来我把jdk换成了1.6,服务器换成了jboss-4.2.3.GA版本的eclipse里面的jdk也要设置成安装的1.6版本。再运行就好了。 你上网查下,什么样的版本搭配是最好的,再写代码。
miaohult 2013-06-28
  • 打赏
  • 举报
回复
你好,能具体说说在什么地方改配置吗? 我现在的web工程只用到了strut,用了一个继承自ServletContextListener的listener,在里面contextInitialized的方法中启动周期性任务处理数据库,碰到了跟你一样的问题,这样的情况下该怎么解决,大虾能指点下么。。多谢多谢
Jark_wang 2012-10-31
  • 打赏
  • 举报
回复
解决了 分享一下: 只需要配置一下就ok
希望能帮助遇到此问题的
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL,
"corbaloc:iiop:myhost.mycompany.com:2809");
Context initialContext = new InitialContext(env);
Jark_wang 2012-10-31
  • 打赏
  • 举报
回复
您好! was控制也是配置了的 ,测试也是通过的
leeskyer 2012-10-31
  • 打赏
  • 举报
回复
你在console里配jndi了?

67,515

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧