Personally I never use Ant's war or ear tasks in general and that goes
for cactification. The convenience of those methods is somewhere between
diddly and squat, IMO. 

I create a jar using the Ant jar task that just has my tests: test.jar. 

<target name="assemble-test" description="create test jar">
         <jar jarfile="${lib}/test.jar">
                 <fileset dir="${out}">
                         <include name="com/acme/test/**/*"/>
                 </fileset>
         </jar>
</target>

Then I update my EAR, which is already build, with my tests:

<target name="assemble-test-ear" description="stuff ear with test jar">
        <jar jarfile="${lib}/${ear}" update="true">
                <fileset dir="${lib}">
                        <include name="test.jar"/>
                </fileset>
        </jar>
</target>

Now, your problem is probably that you cannot "see" the test.jar from
the WAR. IMO WEB-INF and APP-INF are problematic. Instead, I create a
precise chain of dependencies using manifests. So, to see my test.jar
from my war, create the war with this manifest:

Manifest-Version: 1.0
Class-Path: test.jar ... other stuff the war sees ...


I have never, ever, use WEB-INF/classes or WEB-INF/lib and I never have
more than one copy of a given jar anywhere in my deployed application.
Using the manifest gives me total control. 

-----Original Message-----
From: Carpentier, Nelson [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 14, 2005 3:17 PM
To: cactus-user@jakarta.apache.org
Subject: Grrrrr... java.lang.ClassNotFoundException

Hey All...

I've been beating my head against the Cactus wall for about 3 days
now...  I think I've made a bunch of progress, however my headway seems
to have stopped.  (Some of my previous trials include: using WebLogic
8.1, figuring out to use the <cactus> ant task with the generic
container to use my pre-existing deploy tasks, losing 3/4 of a day to a
typo, etc...)

(Sorry for the blatant attempt at garnering sympathy, it's just I
figured some on this list would feel my pain...)

Now, on to my question:
Where are my test classes supposed to be?

I keep hitting the "java.lang.ClassNotFoundException".  (Full stack
trace to be included at the end...)

I am fairly certain my local (non-server-side) JVM is finding the class,
'cuz the only hint I give that I'm looking for my test class is the
following in the batchtest:
<include name="**/AllTestsCactus.*" />
... and the error comes back with the fully-qualified path name. (I.e.
com.icat.blah.AllTestsCactus...)

I'm also fairly certain the cactus.war file is deployed correctly,
because the <cactus> task returns from the deploy in a timely manner,
and when I hit it manually, I get a non-error, blank page back from
"http://localhost:7001/cactus/ServletRedirector?RUN_TEST.";

So, I've gone thru 3 different ways of including the test classes in the
EAR file, none of which rid me of the ClassNotFoundException:

1) In the EAR file, with the package structure directly at the top of
the archive...  I.e. earfile.ear/com/icat/blah/AllTestsCactus.class ...
(I figured out that this probably wouldn't work out for me at all...)

2) In the EAR file, under the /APP-INF/classes directory...  I.e.
earfile.ear/APP-INF/classes/com/icat/blah/AllTestsCactus.class...
(Where just about all the other classes seem to be...)

3) In the cactus war file, under the /WEB-INF/classes directory...  I.e.
earfile.ear/cactus.war/WEB-INF/classes/com/icat/blah/AllTestsCactus.clas
s...

For #3 above, to get these classes in, I've been doing the following
against a deployable ear:
<cactifyear srcfile="${ear}" destfile="${ear.test}" >
        <cactuswar context="/cactus" version="2.3">
                <classes dir="${test.classes.dir} ">
                        <include name="**/*.class" />
                </classes>
        </cactuswar>
</cactifyear>

Thanks for any help...  (Or a slap in the head, if I'm doing something
stupid...)

- Nelz

PS.  Here's the promised stack trace:

java.lang.ClassNotFoundException:
com.icat.server.domain.inspection.AllTestsCactus
        at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:219)
        at
org.apache.cactus.integration.ant.CactusTask.executeInContainer(CactusTa
sk.java:458)
        at
org.apache.cactus.integration.ant.CactusTask.execute(CactusTask.java:208
)

Nelson Carpentier
Software Developer
ICAT Managers, LLC
[EMAIL PROTECTED] 

 

Confidentiality Note: This message contains information that may be
confidential and/or privileged. If you are not the intended recipient,
you should not use, copy, disclose, distribute or take any action based
on this message. If you have received this message in error, please
advise the sender immediately by reply email and delete this message.
Although ICAT Managers, LLC scans e-mail and attachments for viruses, it
does not guarantee that either are virus-free and accepts no liability
for any damage sustained as a result of viruses.  Thank you.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to