IBM Portlet Factory 发布portlet 到WAS 如何配置JNDI
有明白的说说,现在项目可以正常发布到WAS CE或Tomcat下,可以正常使用jndi,但是我发布到WAS上时就找不到jndi了。
项目是通过WebSphere Portal 发布的,不是直接在WAS 控制台发布的。
已经在控制台的Portal 服务器节点添加了JNDI的资源。
在项目的web.xml的模板portlet.standard.web.xml添加了以下配置:
<description>jndi/ds</description>
<res-ref-name>jdbc/wide</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref> 现在当发布到Portal 里,运行时提示以下错误:
com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. [Root exception is javax.naming.NamingException: Failed to lookup the object configured with a null or empty name]
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:1000)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:191)
at com.ibm.ws.naming.java.javaURLContextRoot.processBoundObjectForLookup(javaURLContextRoot.java:407)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1280)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:384)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:205)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:145)
at javax.naming.InitialContext.lookup(InitialContext.java:363) 根据IBM里有关解决办法修改portlet.standard.web.xml为以下配置:
<resource-ref id="ResourceRef_1189613926409">
<description>My DataSource</description>
<res-ref-name>jdbc/wide</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref> 同时在ibm-web-bnd.xmi里做了以下配置:
<resRefBindings xmi:id="ResourceRefBinding_1189613926409" jndiName="jdbc/wide">
<bindingResourceRef href="WEB-INF/web.xml#ResourceRef_1189613926409"/>
</resRefBindings> 但是运行还是提示上面的错误,查看了一下服务器的发布的这个应用,ibm-web-bnd.xmi被生成为以下代码:
<resRefBindings xmi:id="ResourceRefBinding_1189613926409">
<bindingResourceRef href="WEB-INF/web.xml#ResourceRef_1189613926409"/>
</resRefBindings> 从这里看到配置的jndiName并没有生成到这里来,是不是这个原因导致上面的错误呢?
请帮忙!!!已经搞了一天了,还没解决,非常着急。
有明白的说说,现在项目可以正常发布到WAS CE或Tomcat下,可以正常使用jndi,但是我发布到WAS上时就找不到jndi了。
项目是通过WebSphere Portal 发布的,不是直接在WAS 控制台发布的。
已经在控制台的Portal 服务器节点添加了JNDI的资源。
在项目的web.xml的模板portlet.standard.web.xml添加了以下配置:
<description>jndi/ds</description>
<res-ref-name>jdbc/wide</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref> 现在当发布到Portal 里,运行时提示以下错误:
com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. [Root exception is javax.naming.NamingException: Failed to lookup the object configured with a null or empty name]
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:1000)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:191)
at com.ibm.ws.naming.java.javaURLContextRoot.processBoundObjectForLookup(javaURLContextRoot.java:407)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1280)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:384)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:205)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:145)
at javax.naming.InitialContext.lookup(InitialContext.java:363) 根据IBM里有关解决办法修改portlet.standard.web.xml为以下配置:
<resource-ref id="ResourceRef_1189613926409">
<description>My DataSource</description>
<res-ref-name>jdbc/wide</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref> 同时在ibm-web-bnd.xmi里做了以下配置:
<resRefBindings xmi:id="ResourceRefBinding_1189613926409" jndiName="jdbc/wide">
<bindingResourceRef href="WEB-INF/web.xml#ResourceRef_1189613926409"/>
</resRefBindings> 但是运行还是提示上面的错误,查看了一下服务器的发布的这个应用,ibm-web-bnd.xmi被生成为以下代码:
<resRefBindings xmi:id="ResourceRefBinding_1189613926409">
<bindingResourceRef href="WEB-INF/web.xml#ResourceRef_1189613926409"/>
</resRefBindings> 从这里看到配置的jndiName并没有生成到这里来,是不是这个原因导致上面的错误呢?
请帮忙!!!已经搞了一天了,还没解决,非常着急。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货