[jboss-user] [JNDI/Naming/Network] - Re: transaction exception while jndi lookup

loucs do-not-reply at jboss.com
Fri May 2 05:08:43 EDT 2008


i finally got rid of the Wrong tx on thread, but another strange issue is happening :

I first get the TransactionManager via jndi (java:TransactionManager).

then i suspend the current transaction :
t = tm.suspend();

then i do the lookup of my EJB remote or local interface, and i put it into an JBossProxy interface.

then i print infos with the getClass() method :


  | 
  | tmp = (JBossProxy) new InitialContext().lookup("smalltox-ear/IdentityUserModule/remote");
  | 			System.out.println("obj : " + tmp.getClass().getName() + " " + tmp.getClass().getSimpleName() + " " + tmp.getClass().getSuperclass() + " " + tmp.getClass().getPackage() );
  | 			
  | 			
  | 			for (int i = 0; i < tmp.getClass().getMethods().length; i++) {
  | 				System.out.println("method : " + tmp.getClass().getMethods()
  | .getName());
  | 			}
  | 			
  | 			
  | 			for (int i = 0; i < tmp.getClass().getInterfaces().length; i++)
  | 				System.out.println("Interface : " + tmp.getClass().getInterfaces()
  | .getName());
  | 
  | 
  | 
	




and here's the output :


  | 
  | obj : $Proxy855 $Proxy855 class java.lang.reflect.Proxy null
  | 
  | 10:20:29,339 INFO  [STDOUT] method : hashCode
  | 10:20:29,339 INFO  [STDOUT] method : equals
  | 10:20:29,339 INFO  [STDOUT] method : toString
  | 10:20:29,339 INFO  [STDOUT] method : findUserByUserName
  | 10:20:29,340 INFO  [STDOUT] method : getAsynchronousProxy
  | 10:20:29,340 INFO  [STDOUT] method : isProxyClass
  | 10:20:29,340 INFO  [STDOUT] method : getProxyClass
  | 10:20:29,340 INFO  [STDOUT] method : newProxyInstance
  | 10:20:29,340 INFO  [STDOUT] method : getInvocationHandler
  | 10:20:29,340 INFO  [STDOUT] method : wait
  | 10:20:29,340 INFO  [STDOUT] method : wait
  | 10:20:29,340 INFO  [STDOUT] method : wait
  | 10:20:29,340 INFO  [STDOUT] method : getClass
  | 10:20:29,340 INFO  [STDOUT] method : notify
  | 10:20:29,340 INFO  [STDOUT] method : notifyAll
  | 
  | 10:20:29,340 INFO  [STDOUT] Interface : com.smalltox.foundation.identity.IdentityUserModuleRemote
  | 10:20:29,341 INFO  [STDOUT] Interface : org.jboss.ejb3.JBossProxy
  | 	
  | 


then i try to cast the JBossProxy object into my local or remote interface and i got a class cast exception :

$Proxy855 cannot be cast to com.smalltox.foundation.identity.IdentityUserModuleRemote

this is really strange, and the samething happen whether i resume the transaction before the cast of after..

the encouraging part is that portal continues to work well after i resume the transaction.

i'd like to add that in my jmx console, i've got this output in the JNDIView :


  | 
  | when remote + ejb stateful
  | Global JNDI Namespace
  | 
  | +- smalltox-ear (class: org.jnp.interfaces.NamingContext)
  |     +- IdentityUserModule (class: org.jnp.interfaces.NamingContext)
  |       |   |   +- remote (class: java.lang.Object)
  |       |   |   +- remoteStatefulProxyFactory (proxy: $Proxy857 implements interface org.jboss.ejb3.Pr
  | oxyFactory)
  | 
  | when remote and ejb statless
  | 
  | +- smalltox-ear (class: org.jnp.interfaces.NamingContext)
  |     +- IdentityUserModule (class: org.jnp.interfaces.NamingContext)
  |       |   |   +- remote (proxy: $Proxy854 implements interface com.smalltox.foundation.identity.Iden
  | tityUserModuleRemote,interface org.jboss.ejb3.JBossProxy)
  | 
  | 
  | when i make my EJB local and stateless:
  | 
  | +- smalltox-ear (class: org.jnp.interfaces.NamingContext)
  |     +- IdentityUserModule (class: org.jnp.interfaces.NamingContext)
  |       |   |   +- local (proxy: $proxy855 implements interface com.smalltox.foundation.identity.Ident
  | ityUserModuleLocalInterface, interface org.jboss.ejb3.JBossProxy)
  |  
  | 	
  | 


i think it migth be caused by the fact my local or remote interfaces are in a jar in the libdir of portal, and also in my ear. but i can't see any other way of calling my ejb from the portal app.

any clues would help a lot,

Regards,

-- 
Lucas
Montes



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4148281#4148281

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4148281



More information about the jboss-user mailing list