[
https://jira.jboss.org/jira/browse/JBNAME-42?page=com.atlassian.jira.plug...
]
Ron Sigal commented on JBNAME-42:
---------------------------------
There seems to be a problem with the new NamingContext.getObjectInstance():
private Object getObjectInstance(Object obj, Name name, Hashtable env)
throws Exception
{
if (useAbsoluteName(env))
name = getAbsoluteName(name);
final Object obtained = NamingManager.getObjectInstance(obj, name, this, env);
if(obtained instanceof Reference) // <=== problem
{
final Reference ref = (Reference) obtained;
throw MissingObjectFactoryException.create(ref.getFactoryClassName(), name);
}
return obtained;
}
In particular, org.jboss.ejb.Container sets org.jboss.naming.ENCThreadLocalKey as the
factory for non-local references, and ENCThreadLocalKey.getObjectInstance() returns a new
LinkRef(target). But LinkRef is a subclass of Reference, so getObjectInstance() throws a
MissingObjectFactoryException even if the reference was found.
This problem shows up in org.jboss.test.naming.test.EjbLinkUnitTestCase.testEjbNoLink(),
which throws
2010-02-26 15:05:15,797 INFO [org.jboss.test.naming.ejb.TestEjbLinkBean]
(WorkerThread#0[127.0.0.1:58696]) failed: javax.naming.NamingException: Could not
dereference object [Root exception is java.lang.IllegalArgumentException: missing object
factory class name is required]
at
org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1591)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:900)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:911)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:749)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.jboss.test.naming.ejb.TestEjbLinkBean.testEjbLinkCaller(TestEjbLinkBean.java:75)
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:597)
at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
at
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:233)
at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)
at
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:173)
at
org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:228)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)
at
org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(PreSecurityInterceptor.java:97)
at
org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(PreSecurityInterceptor.java:81)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)
at org.jboss.ejb.Container.invoke(Container.java:1072)
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:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:271)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:670)
at org.jboss.invocation.unified.server.UnifiedInvoker.invoke(UnifiedInvoker.java:232)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:897)
at
org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:768)
at
org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:721)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:575)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)
Caused by: java.lang.IllegalArgumentException: missing object factory class name is
required
at org.jnp.MissingObjectFactoryException.create(MissingObjectFactoryException.java:99)
at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1564)
at
org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1583)
... 40 more
The line numbers won't match the current NamingContext, since I've added about
5000 log statements.
Maybe the test in NamingContext.getObjectInstance() should be
if(obtained == null && obj instanceof Reference)
{
final Reference ref = (Reference) obj;
throw MissingObjectFactoryException.create(ref.getFactoryClassName(), name);
}
since the javax.naming.spi.ObjectFactory.getObjectInstance() says "@return The object
created; null if an object cannot be created."
By the way, the test failure doesn't show up on hudson since AS trunk is still using
naming version 5.0.4.GA.
And now you know the contents of my weekly report next Monday. :)
Log debug info when NamingContext.getObjectInstance() fails to create
the instance
----------------------------------------------------------------------------------
Key: JBNAME-42
URL:
https://jira.jboss.org/jira/browse/JBNAME-42
Project: JBoss Naming
Issue Type: Feature Request
Components: jnpserver
Reporter: Brian Stansberry
Assignee: Andrew Lee Rubinger
Fix For: 5.1.0.Beta1
Attachments: JBNAME-42.patch
The JDK javax.naming.spi.NamingManager.getObjectInstance() method doesn't provide any
debugging output when it's unable to create an object from a Reference; it just
silently returns the Reference. Perhaps
org.jnp.interfaces.NamingContext.getObjectInstance() can help here
private Object getObjectInstance(Object obj, Name name, Hashtable env)
throws Exception
{
if (useAbsoluteName(env))
name = getAbsoluteName(name);
Object result = NamingManager.getObjectInstance(obj, name, this, env);
if (result == obj log.isDebugEnabled())
{
try
{
Reference ref == null;
if (obj instanceof Reference)
{
ref = (Reference) obj;
}
else if (obj instanceof Referenceable)
{
ref = ((Referenceable) obj).getReference();
}
if (ref != null)
{
log.debug("Could not resolve reference " + ref + " with
factory class " + ref.getFactoryClassName();
}
}
catch (RumtimeException ignored)
{
;
}
catch (NamingException ne)
{
if (ne.getCause() instanceof InterruptedException)
{
Thread.currentThread().interrupted();
}
}
}
return result;
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira