Geert,
   Thanks for clarifying.  I will test it out and let you all know.

Take care,

Jeremy

On 12/20/06, Geert Bevin <[EMAIL PROTECTED]> wrote:

Hi everyone,

I wrongly directed Jeremy into the direction of a possible
classloader problem. It is a regression bug in RIFE when it's run
without a initialized repository. I fixed this in RIFE, so don't
spend any time looking at what happens in Maven with regards to this.
Sorry for the confusion.

Jeremy, please use the latest snapshot of RIFE which should fix this:
http://rifers.org/downloads/rife/snapshots/rife-1.6-snapshot-20061220/

Best regards,

Geert

On 20 Dec 2006, at 05:11, Jeremy Whitlock wrote:

> Hi All,
>     I have taken the liberty to create a sample RIFE application to
> reproduce this behavior so we can work together to fix this.  This
> sample RIFE application is attached and is a Maven project.  It has
> a README file to explain how to prepare the environment and how to
> reproduce is.  Please use the attached so I can figure out if I'm
> doing something wrong and if there is a workaround/fix available.
> I'm sure I am not the only person to run into a problem like this.
>
> Take care,
>
> Jeremy
>
> On 12/19/06, Jeremy Whitlock <[EMAIL PROTECTED]> wrote: Hi All,
>     I am developing a RIFE web application that I am trying to unit
> test.  When my surefire tests run, RIFE is unable to load Java
> classes properly.  Here is the related portion of the pom.xml:
>
>     <plugins>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-surefire-plugin</artifactId>
>         <configuration>
>           <excludes>
>                 <exclude>**/SACBaseTest.java</exclude>
>           </excludes>
>           <systemProperties>
>             <property>
>               <name>rife.webapp.path</name>
>               <value>${basedir}/target/classes</value>
>             </property>
>           </systemProperties>
>         </configuration>
>       </plugin>
>     </plugins>
>     <testResources>
>       <testResource>
>         <targetPath>/</targetPath>
>         <filtering>false</filtering>
>         <directory>${basedir}/src/main/webapp/WEB-INF/classes</
> directory>
>         <includes>
>           <include>**/*</include>
>         </includes>
>       </testResource>
>     </testResources>
>   </build>
>
> Before I explain the problem, here is a part of the stacktrace:
>
> com.uwyn.rife.engine.exceptions.ElementImplementationInstantiationExce
> ption: The implementation
> 'net.collab.extranet.sac.elements.SACHome' of element
> 'manual:SACHome' couldn't be instantiated.
>         at com.uwyn.rife.engine.ElementFactory.getInstance
> (ElementFactory.java:162)
>         at com.uwyn.rife.engine.ElementInfo.deploy(ElementInfo.java:
> 242)
>         at com.uwyn.rife.engine.SiteBuilder.setupElements
> ( SiteBuilder.java:984)
>         at com.uwyn.rife.engine.SiteBuilder.setupData
> (SiteBuilder.java:1618)
>         at com.uwyn.rife.engine.SiteBuilder.finish(SiteBuilder.java:
> 261)
>         at com.uwyn.rife.engine.SiteBuilder.process
> (SiteBuilder.java:252)
>         at com.uwyn.rife.engine.SiteBuilder.getSite
> (SiteBuilder.java:178)
>         at
> net.collab.extranet.sac.svn.SVNAdminCLIWrapperClientTest.setUp
> (SVNAdminCLIWrapperClientTest.java:21)
>         at junit.framework.TestCase.runBare(TestCase.java:125)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:
> 124)
>         at junit.framework.TestResult.run (TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         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:585)
>         at org.codehaus.surefire.battery.JUnitBattery.executeJUnit
> (JUnitBattery.java:246)
>         at org.codehaus.surefire.battery.JUnitBattery.execute
> (JUnitBattery.java:220)
>         at org.codehaus.surefire.Surefire.executeBattery
> (Surefire.java:204)
>         at org.codehaus.surefire.Surefire.run(Surefire.java:153)
>         at org.codehaus.surefire.Surefire.run( Surefire.java :77)
>         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:585)
>         at org.codehaus.surefire.SurefireBooter.run
> (SurefireBooter.java:104)
>         at org.apache.maven.test.SurefirePlugin.execute
> (SurefirePlugin.java:303)
>         at org.apache.maven.plugin.DefaultPluginManager.executeMojo
> (DefaultPluginManager.java:412)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
> (DefaultLifecycleExecutor.java :534)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLif
> ecycle(DefaultLifecycleExecutor.java:475)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
> (DefaultLifecycleExecutor.java :454)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHand
> leFailures(DefaultLifecycleExecutor.java:306)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegment
> s (DefaultLifecycleExecutor.java:273)
>         at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute
> (DefaultLifecycleExecutor.java:140)
>         at org.apache.maven.DefaultMaven.doExecute
> (DefaultMaven.java:322)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:
> 115)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
>         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:585)
>         at org.codehaus.classworlds.Launcher.launchEnhanced
> (Launcher.java:315)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>         at org.codehaus.classworlds.Launcher.mainWithExitCode
> (Launcher.java:430)
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: java.lang.NullPointerException
>         at com.uwyn.rife.engine.ElementFactory.getJavaClass
> (ElementFactory.java:100)
>         at com.uwyn.rife.engine.ElementFactory.getJavaInstance
> (ElementFactory.java:124)
>         at com.uwyn.rife.engine.ElementFactory.getInstance
> (ElementFactory.java:153)
>         ... 47 more
>
> So...a little information about the structure.  When my Maven
> application runs the tests, the target directory looks like this:
>
> target
>   /classes
>   /test-classes
>     /sites
>     /rep
>     /templates
>
> RIFE can successfully load the sites/main.xml but RIFE then starts
> to instantiate the SACHome object.  This object is compiled to
> target/classes but RIFE cannot find it.  RIFE developers tell me
> that RIFE's ClassLoader is being circumvented or is using the same
> classpath as what the surefire tests are.  How can I get my tests,
> which include RIFE's engine, to have the same classpath?  I've done
> everything I can think of.  Just to show you all the surefire
> classpath:
>
> [DEBUG] Test Classpath :
> [DEBUG] /Users/jwhitlock/work/sac/src/web-app/target/test-classes
> [DEBUG] /Users/jwhitlock/work/sac/src/web-app/target/classes
> [DEBUG] /Users/jwhitlock/work/sac/src/web-app/target/classes
> [DEBUG] /Users/jwhitlock/work/sac/src/web-app/target/test-classes
> [DEBUG] /Users/jwhitlock/.m2/repository/com/uwyn/rife-jdk15/1.5.1/
> rife-jdk15-1.5.1.jar
> [DEBUG] /Users/jwhitlock/.m2/repository/junit/junit/3.8.1/junit-
> 3.8.1.jar
> [DEBUG] /Users/jwhitlock/.m2/repository/commons-io/commons-io/1.2/
> commons-io-1.2.jar
> [DEBUG] Adding to surefire test classpath: /Users/jwhitlock/.m2/
> repository/surefire/surefire/1.4/surefire-1.4.jar
> [DEBUG] Adding to surefire test classpath: /Users/jwhitlock/.m2/
> repository/junit/junit/3.8.1/junit- 3.8.1.jar
> [DEBUG] Adding to surefire test classpath: /Users/jwhitlock/.m2/
> repository/surefire/surefire-booter/1.4/surefire-booter-1.4.jar
> [DEBUG] Adding to surefire test classpath: /usr/local/maven-2.0/
> core/plexus- utils-1.1.jar
>
> As you can see, target/classes and target/test-classes are both on
> the classpath and should allow RIFE to be able to load classes from
> target/classes but is not able to do so.
>
> Take care,
>
> Jeremy
>
> <rife-maven-example.tar.gz>

--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com



Reply via email to