Problem Running quartz-app RAR JUnit Test

View: New views
3 Messages — Rating Filter:   Alert me  

Problem Running quartz-app RAR JUnit Test

by thabach :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Heya

I am investigating RAR support in OpenEJB and was playing with the quartz-app from some earlier post (http://www.nabble.com/need-help-getting-quartz-ra.rar-file-to-deploy-td18531000.html#a18538001).

When running a top-level mvn clean install the tests are executed fine. Running the quartz-beans module test from within Eclipse as a JUnit test, leads to a problem in matching the message listener interface of the MDB against the message listener interface of the automatically deployed MdbContainer and yields this:

org.apache.openejb.OpenEJBException: Creating application failed: classpath.ear: Error deploying 'TimerJob'.  Exception: class org.apache.openejb.OpenEJBException: Deployment 'TimerJob' has message listener interface org.quartz.Job but this MDB container only supports interface javax.jms.MessageListener: Deployment 'TimerJob' has message listener interface org.quartz.Job but this MDB container only supports interface javax.jms.MessageListener
        at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:666)
        at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:449)
        at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:367)
        at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:279)
        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:137)
        at org.apache.openejb.OpenEJB.init(OpenEJB.java:286)
        at org.apache.openejb.OpenEJB.init(OpenEJB.java:265)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

I get the same effect, when running outside Eclipse with a top-level (multi-module root) mvn test. Strange enough an individual mvn test within the quartz-beans module does not have the matching issue.

Why does the quartz RAR MDB Container only get created in some cases, causing the matching to fail ? I am confused.

Thanks for any help and cheers, Christian.

Re: Problem Running quartz-app RAR JUnit Test

by David Blevins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Oct 27, 2009, at 12:54 AM, thabach wrote:

>
> Heya
>
> I am investigating RAR support in OpenEJB and was playing with the
> quartz-app from some earlier post (
> http://www.nabble.com/need-help-getting-quartz-ra.rar-file-to-deploy-td18531000.html#a18538001
> http://www.nabble.com/need-help-getting-quartz-ra.rar-file-to-deploy-td18531000.html#a18538001
> ).
>
> When running a top-level mvn clean install the tests are executed  
> fine.
> Running the quartz-beans module test from within Eclipse as a JUnit  
> test,
> leads to a problem in matching the message listener interface of the  
> MDB
> against the message listener interface of the automatically deployed
> MdbContainer and yields this:
>
> org.apache.openejb.OpenEJBException: Creating application failed:
> classpath.ear: Error deploying 'TimerJob'.  Exception: class
> org.apache.openejb.OpenEJBException: Deployment 'TimerJob' has message
> listener interface org.quartz.Job but this MDB container only supports
> interface javax.jms.MessageListener: Deployment 'TimerJob' has message
> listener interface org.quartz.Job but this MDB container only supports
> interface javax.jms.MessageListener

It seems there's something about the way the Eclipse project is setup  
that does not match the Maven setup.  If Eclipse isn't including the  
META-INF/ra.xml file in the classpath, then OpenEJB will not be able  
to see and deploy the resource adapter and create the required MDB  
container.

Try a little test code like this to verify your Eclipse setup:

   import junit.framework.TestCase;

   import java.net.URL;

   public class ClasspathTest extends TestCase {

       public void test() throws Exception {

           URL raXml = this.getClass().getResource("META-INF/ra.xml");

           assertNotNull("There is no resource adapter in the  
classpath", raXml);
       }
   }


Hope that helps!

-David


Re: Problem Running quartz-app RAR JUnit Test

by thabach :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I tried what you suggested, had to actually try with getClass().getClassLoader().getSystemResource("META-INF/ra.xml") to succeed, but the ra.xml is on the Classpath.

The quartz-beans JUnit Test in Eclipse runs fine as soon as I move the ra.xml from the quartz-ra module to the quartz-beans module, but only as long as I do not put an ejb-jar.xml into the src/main/resources/META-INF as well.

It really seems that it all depends on some ordering constraint, does one have to manage rar before ejb deployment somehow ?

Cheers Christian.


David Blevins wrote:
On Oct 27, 2009, at 12:54 AM, thabach wrote:

>
> Heya
>
> I am investigating RAR support in OpenEJB and was playing with the
> quartz-app from some earlier post (
> http://www.nabble.com/need-help-getting-quartz-ra.rar-file-to-deploy-td18531000.html#a18538001
> http://www.nabble.com/need-help-getting-quartz-ra.rar-file-to-deploy-td18531000.html#a18538001
> ).
>
> When running a top-level mvn clean install the tests are executed  
> fine.
> Running the quartz-beans module test from within Eclipse as a JUnit  
> test,
> leads to a problem in matching the message listener interface of the  
> MDB
> against the message listener interface of the automatically deployed
> MdbContainer and yields this:
>
> org.apache.openejb.OpenEJBException: Creating application failed:
> classpath.ear: Error deploying 'TimerJob'.  Exception: class
> org.apache.openejb.OpenEJBException: Deployment 'TimerJob' has message
> listener interface org.quartz.Job but this MDB container only supports
> interface javax.jms.MessageListener: Deployment 'TimerJob' has message
> listener interface org.quartz.Job but this MDB container only supports
> interface javax.jms.MessageListener

It seems there's something about the way the Eclipse project is setup  
that does not match the Maven setup.  If Eclipse isn't including the  
META-INF/ra.xml file in the classpath, then OpenEJB will not be able  
to see and deploy the resource adapter and create the required MDB  
container.

Try a little test code like this to verify your Eclipse setup:

   import junit.framework.TestCase;

   import java.net.URL;

   public class ClasspathTest extends TestCase {

       public void test() throws Exception {

           URL raXml = this.getClass().getResource("META-INF/ra.xml");

           assertNotNull("There is no resource adapter in the  
classpath", raXml);
       }
   }


Hope that helps!

-David