Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WebSphere specific JNDI problem.

127 views
Skip to first unread message

oartem

unread,
Nov 5, 2009, 7:25:01 AM11/5/09
to
Hi.
I face with such a problem. Our application has jni resource which is accessed from different points of application. For access we use jndi, i.e. we store jni object with help of jndi.
On Jboss, and OIAS this solution works fine, but on WebSphere 6.1 .......
I get following exception:

{code}
com.ibm.ws.naming.util.CannotBindObjectException: Object is not of any type which can be bound.
at com.ibm.ws.naming.util.Helpers.processJavaObjectForBinding(Helpers.java:628)
at com.ibm.ws.naming.jndicos.CNContextImpl.doRebind(CNContextImpl.java:2573)
at com.ibm.ws.naming.jndicos.CNContextImpl.rebind(CNContextImpl.java:788)
{code}

Here is the code for binding:

{code}
InitialContext context = new InitialContext();
context.rebind("com/factory", val);
{code}

I found that if store in java:comp namespace it should work. So i change my code to this:

{code}
InitialContext context = new InitialContext();
context .rebind("java:comp/com/factory", val);
{code}

And avoid an error, but get another one. On of the points of access of jni resource is quartz jobs. So, when jobs get started i see folowing exception:
{code}
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 comp/com/factory not found in context "java:".]
at com.ibm.ws.naming.java.javaURLContextImpl.throwConfigurationExceptionWithDefaultJavaNS(javaURLContextImpl.java:416)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:388)
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)
{code}

I can't make jni object serializable.

Can smb tell another solution for a such problem? Or ways where I can search a solution?

0 new messages