1 Reply Latest reply on Dec 7, 2010 3:15 PM by orr94

    Integration Testing for apps targeted for WebSphere

    orr94

      We use Seam 2.2.0.GA for an application deployed to WebSphere 7.0. To get it to work on WebSphere, we followed the Seam reference's Strategy 1:


      http://docs.jboss.com/seam/snapshot/en-US/html/websphere.html#was.strategy1


      That strategy has worked well to this point (though having to add all the @JndiName annotations is irritating). However, this causes some problems when we try to do intergration testing using TestNG and Embedded JBoss. Basically, the changes we made to get it to work on WAS7 cause it to fail in Embedded JBoss!


      I was able to get around the seam-jndi.properties change by putting a JBoss-specific version of seam-properties in (appname)-test/test-src, which overrides the WAS-specific version.


      However, the @JndiName annotation is giving me trouble. Since WAS uses the pattern ejblocal:package.EjbName for binding its EJBs, we need to put the @JndiName annotation in each bean class:


       @Name("ejbName")
       @JndiName("ejblocal:package.EjbName")
       public class EjbNameBean implements EjbName ...



      JBoss, of course, does not bind the EJBs with this pattern, so the lookups fail. It seems to me like the easiest way to fix this would be to configure Embedded JBoss to bind its EJBs using a different strategy (or even defining a new binding for each EJB, if necessary). However, I can't figure out a way to do this.


      Any thoughts? I think there are solutions that would work for both WAS and JBoss if we used Strategy 2 or 3 from the Seam reference, but those involve XML configuration for every EJB, which is NOT fun (I've done it in the past).


        • 1. Re: Integration Testing for apps targeted for WebSphere
          orr94

          One more note: I tried using the org.jboss.ejb3.annotation.LocalBinding annotation to indicate to Embedded JBoss that I wanted it to use a different name, like this:



           @Name("ejbName")
           @JndiName("ejblocal:package.EjbName")
           @LocalBinding(jndiBinding = "ejblocal:package.EjbName")
           public class EjbNameBean implements EjbName ...




          It worked in Embedded JBoss, but broke when deployed to WAS. I get java.lang.ClassNotFoundException: org.jboss.ejb3.annotation.LocalBinding, which I COULD fix by putting jboss-embedded-all.jar in my EAR. That doesn't seem like a good idea, though...