浏览 5245 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2012-09-13
<bean id="baseDaoEntity" class="com.para.osc.framework.common.base.BaseDaoEntity" init-method="initEntity"> <property name="dataSource" ref="dataSource" /> <property name="dataBaseType"> <value>MYSQL</value> </property> <property name="jndiName"> <value>jdbc/oscdb</value> </property> </bean> javax.naming.ConfigurationException: A JNDI operation on a "java:" name cannot be completed because the serverruntime is not able to associate the operation's thread with any J2EE application component. This condition can occur when the JNDI client using the "java:" name is not executed on the thread of a server application request. Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE application. Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on "java:" names. [Root exception is javax.naming.NameNotFoundException: Name not found in context "java:".] 小弟是初次在websphere上部署项目 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2012-09-13
websphere 使用JNDI要在ibm-web-bnd.xml和web.xml文件里配置。否则会报找不到相应名字数据源的错误。
建议使用IBM Rational Application Developer进行开发。 |
|
返回顶楼 | |
发表时间:2012-09-13
给你个例子:
ibm-web-bnd.xml: <?xml version="1.0" encoding="UTF-8"?> <web-bnd xmlns="http://websphere.ibm.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-bnd_1_0.xsd" version="1.0"> <virtual-host name="default_host" /> <!-- Binding for Data Source, --> <resource-ref name="jdbc/oscdb" binding-name="jdbc/oscdb"></resource-ref> </web-bnd> web.xml: <!-- Data Source Reference --> <resource-ref> <res-ref-name>jdbc/oscdb</res-ref-name> <res-type>javax.sql.XADatasource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref> |
|
返回顶楼 | |
发表时间:2012-09-13
其中ibm-web-bnd.xml和web.xml在同一目录WEB-INF下
|
|
返回顶楼 | |
发表时间:2012-09-13
WS6 你部暑应用时候,注意下几点:
1: java:comp/env/jdbc/bbt 是全称形式, 2: jdbc/bbt 这是一个简写形式, 你如果向WS6部暑时候,好像我没有记错的话有一个让容器管理(数据源),就用简写形式了,你两形式切换下! |
|
返回顶楼 | |
发表时间:2012-09-14
was连接 JDNI数据源要使用;
initContext = new InitialContext(); Context envCtx = (Context) initContext.lookup("java:comp/env"); ds = (DataSource) envCtx.lookup(jndiName); |
|
返回顶楼 | |