users@glassfish.java.net

glassfish javaee classloading problem

From: <forums_at_java.net>
Date: Wed, 30 Mar 2011 01:45:04 -0500 (CDT)

 Hello community

I`m new to jee world. I work on jca1.6 connector and have some problem. Here
is the problem: I have mycja.rar which consists of: META-INF/ra.xml ra.jar
*client.jar*
  And I wrote sample webapp which uses myjca, it consists of: META-INF
WEB-INF/classes WEB-INF/lib/*client.jar* WEB-INF/(xmls here) (web pages here)
  Both myjca.rar and webapp.war are deployed to glassfish 3.1.   And there
is such a code in the webapp class: ... 1      jndiContext = new
InitialContext(); 2     MmlConnectionFactory connectionFactory =
(MmlConnectionFactory) jndiContext.lookup("jca/MmlConnector"); 3    
 MmlConnection connection = connectionFactory.getConnection(); 4    
 connection.connect(); 5//some stuff here 6     connection.close(); ...  
But when it gets MmlConnectionFactory, line 2, there an exception:
java.lang.ClassCastException:
mml.connection.impl./MmlConnectionFactoryImpl/ cannot be cast to
mml.connection./MmlConnectionFactory/  
where /MmlConnectionFactoryImpl /implements /MmlConnectionFactory./   
MmlConnectionFactoryImpl is places in the ra.jar and MmlConnectionFactory is
places in the client.jar   But if I go another way and package connector and
webapp without client.jar, and client.jar i put into the
glassfish/domain/domain1/lib it works fine.   Where am I wrong? Any
suggestions?  

 


--
[Message sent by forum member 'gavaec']
View Post: http://forums.java.net/node/786616