You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Ch...@sonynetservices.com on 2003/08/14 15:31:44 UTC

Cactus: classpath problem?

Hi guys!

I've got the following problem in an EJB TestCase within Weblogic Bea 8.1 
(cactus-1.3-1.5Beta1; jdk 1.4):

While starting the TestCase deployed on weblogic the last message I get is 
something like [...ServletRedirector init]; When I look in the junitreport 
it says somethin like InvocationTargetException ... ClassDefNotFound 
...although the class is definetly in the classpath (as the following 
snippets prove). For me it looks that somehow cactus has a problem with 
imported classes and it's classpath for the generated TestCase object ....

Any help is welcome - even a workaround - thx, Chris.

Details:

For code snippet 1) the test works fine and results in No Errors:
Snippet 1) represents my workaround for a problem I encountered in 1.5 
Beta! Obviously my ejb-application finds all the Exception classes while 
cactus does not find it in it's classpath! 

1) 
        final public void testAuthenticateMobileId() throws Exception {
 
        // create a user and check authentication
        System.out.println("--- Test Authenticate a Mobile User ---");
 
        m_id = m_manager.createUser("Scotty", "123456", "StreamMeUp", "TestService0");
        int idAuth = m_manager.authenticateMobile("123456", "StreamMeUp", "TestService0");
        assertEquals("Authentication OK", m_id, idAuth);
 
        System.out.println("Authenticate with wrong mobile id name ...");
        try{
            m_manager.authenticate("NotExisting", "StreamMeUp", "TestService0");
            fail("Invalid user not recognised");
        // !!ONLY EXCEPTION CAUHGT HERE!!
        } catch (Exception e) {
            // work around since i can not access Exception in common module!?
            // see @todo
            assertEquals(e.getClass().getName(),
            "com.....common.interfaces.InvalidUserException");
        }
        }


In Snippet 2) the TestCase returns with the appended Classpath problem 
message. I also tried to put the appropriate jar file not only in my ear 
file but also directly in my cactus-war file with the same result! It 
seems that the ServletRedirector must face this exception already in it's 
init phase because it does not even come to the first system.out line! 
Additionally the last log message I get from the app server is something 
like "RedirectorServlet init"!? Does anyone know this problem - or have a 
clue what could cause this problem?

2)

        final public void testAuthenticateMobileId() throws Exception {
 
        // create a user and check authentication
        System.out.println("--- Test Authenticate a Mobile User ---");
 
        m_id = m_manager.createUser("Scotty", "123456", "StreamMeUp", "TestService0");
        int idAuth = m_manager.authenticateMobile("123456", "StreamMeUp", "TestService0");
        assertEquals("Authentication OK", m_id, idAuth);
 
        System.out.println("Authenticate with wrong mobile id name ...");
        try{
            m_manager.authenticate("NotExisting", "StreamMeUp", "TestService0");
            fail("Invalid user not recognised");
        // !!DIFF: InvalidUserException CAUHGT HERE!!
        } catch (InvalidUserException e) {
            // work around since i can not access Exception in common module!?
            // see @todo
            assertEquals(e.getClass().getName(),
            "com.sonynetservices.pma.common.interfaces.InvalidUserException");
        }
        }


Junit report message:

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Caused by: java.lang.NoClassDefFoundError: 
com/.../.../common/interfaces/InvalidUserException 

Thanks for every useful comment,
Chris.



RE: Cactus: classpath problem?

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Christian,

First, it seems this message is very similar to the one you sent on
30/7/2003. It looks the same to me. You should have said this was a
repost. Second, I have already answered to you (see attached) but you
haven't come back to us... I guess you may have missed the email.

Thanks
-Vincent

-----Original Message-----
From: Christian_Weiler@sonynetservices.com
[mailto:Christian_Weiler@sonynetservices.com] 
Sent: 14 August 2003 15:32
To: cactus-user@jakarta.apache.org
Subject: Cactus: classpath problem?


Hi guys! 

I've got the following problem in an EJB TestCase within Weblogic Bea
8.1 (cactus-1.3-1.5Beta1; jdk 1.4): 

While starting the TestCase deployed on weblogic the last message I get
is something like [...ServletRedirector init]; When I look in the
junitreport it says somethin like InvocationTargetException ...
ClassDefNotFound ...although the class is definetly in the classpath (as
the following snippets prove). For me it looks that somehow cactus has a
problem with imported classes and it's classpath for the generated
TestCase object .... 

Any help is welcome - even a workaround - thx, Chris. 

Details: 

For code snippet 1) the test works fine and results in No Errors: 
Snippet 1) represents my workaround for a problem I encountered in 1.5
Beta! Obviously my ejb-application finds all the Exception classes while
cactus does not find it in it's classpath! 

1)         
        final public void testAuthenticateMobileId() throws Exception { 
    
        // create a user and check authentication 
        System.out.println("--- Test Authenticate a Mobile User ---"); 
    
        m_id = m_manager.createUser("Scotty", "123456", "StreamMeUp",
"TestService0"); 
        int idAuth = m_manager.authenticateMobile("123456",
"StreamMeUp", "TestService0"); 
        assertEquals("Authentication OK", m_id, idAuth); 
        
        System.out.println("Authenticate with wrong mobile id name
..."); 
        try{ 
            m_manager.authenticate("NotExisting", "StreamMeUp",
"TestService0"); 
            fail("Invalid user not recognised"); 
        // !!ONLY EXCEPTION CAUHGT HERE!! 
        } catch (Exception e) { 
            // work around since i can not access Exception in common
module!? 
            // see @todo 
            assertEquals(e.getClass().getName(), 
            "com.....common.interfaces.InvalidUserException"); 
        } 
        } 


In Snippet 2) the TestCase returns with the appended Classpath problem
message. I also tried to put the appropriate jar file not only in my ear
file but also directly in my cactus-war file with the same result! It
seems that the ServletRedirector must face this exception already in
it's  init phase because it does not even come to the first system.out
line! Additionally the last log message I get from the app server is
something like "RedirectorServlet init"!? Does anyone know this problem
- or have a clue what could cause this problem? 

2) 

        final public void testAuthenticateMobileId() throws Exception { 
    
        // create a user and check authentication 
        System.out.println("--- Test Authenticate a Mobile User ---"); 
    
        m_id = m_manager.createUser("Scotty", "123456", "StreamMeUp",
"TestService0"); 
        int idAuth = m_manager.authenticateMobile("123456",
"StreamMeUp", "TestService0"); 
        assertEquals("Authentication OK", m_id, idAuth); 
        
        System.out.println("Authenticate with wrong mobile id name
..."); 
        try{ 
            m_manager.authenticate("NotExisting", "StreamMeUp",
"TestService0"); 
            fail("Invalid user not recognised"); 
        // !!DIFF: InvalidUserException CAUHGT HERE!! 
        } catch (InvalidUserException e) { 
            // work around since i can not access Exception in common
module!? 
            // see @todo 
            assertEquals(e.getClass().getName(), 
           
"com.sonynetservices.pma.common.interfaces.InvalidUserException"); 
        } 
        } 


Junit report message: 
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
Caused by: java.lang.NoClassDefFoundError:
com/.../.../common/interfaces/InvalidUserException 

Thanks for every useful comment, 
Chris.