1 Reply Latest reply on Apr 3, 2007 3:37 AM by David DIDIER

    unit testing a war with actions in a separate jar

    David DIDIER Newbie

      Hi,

      I am trying to repackage the booking example in 3 jars :
      -domain.jar for the ejb entities
      -ejb.jar for the actions
      -web.war for the webapp

      I managed to successfully unit test the actions (BookingUnitTest) but i cannot make i work for the webapp.

      In domain.jar i have :


      META-INF/persistence.xml
      org/jboss/seam/example/booking/Booking.class
      org/jboss/seam/example/booking/Hotel.class
      org/jboss/seam/example/booking/User.class
      seam.properties (empty)


      In ejb.jar i have :

      META-INF/ejb-jar.xml (with SeamInterceptor)
      org/jboss/seam/example/booking/***Action.class
      seam.properties (empty)


      My webapp depends on domain.jar and ejb.jar and in my webapp target/classes directory i have :

      css/**
      img/**
      org/jboss/seam/example/booking/***Test.class
      WEB-INF/components.xml
      WEB-INF/faces-config.xml
      WEB-INF/navigation.xml
      WEB-INF/pages.xml
      WEB-INF/web.xml
      *.xtml
      components.properties


      components.xml :
      <components ...>
      
       <core:init debug="true" jndi-pattern="@jndiPattern@" />
      
       <core:manager concurrent-request-timeout="500" conversation-timeout="120000" conversation-id-parameter="cid"
       conversation-is-long-running-parameter="clr" />
      
       <core:pages no-conversation-view-id="/index.xhtml" />
      
       <!-- in embedded.jar -->
       <!--core:ejb installed="@embeddedEjb@" /-->
      
      </components>


      components.properties :
      embeddedEjb = true
      jndiPattern = #{ejbName}/local
      


      It works in an ear but here i got:
      FAILED: testBookHotel
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: hotelSearch
       at org.jboss.seam.Component.newInstance(Component.java:1740)
       at org.jboss.seam.Component.getInstance(Component.java:1643)
       at org.jboss.seam.Component.getInstance(Component.java:1610)
       at org.jboss.seam.Component.getInstance(Component.java:1604)
       at org.jboss.seam.jsf.SeamELResolver.getValue(SeamELResolver.java:49)
       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:135)
       at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
       at com.sun.el.parser.AstValue.getTarget(AstValue.java:41)
       at com.sun.el.parser.AstValue.setValue(AstValue.java:111)
       at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:246)
       at org.jboss.seam.util.UnifiedELValueBinding.setValue(UnifiedELValueBinding.java:44)
       at org.jboss.seam.mock.SeamTest$Request.setValue(SeamTest.java:374)
       at org.jboss.seam.example.booking.BookingTest$2.updateModelValues(BookingTest.java:62)
       at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:476)
       at org.jboss.seam.example.booking.BookingTest.testBookHotel(BookingTest.java:80)
      Caused by: javax.naming.NameNotFoundException: HotelSearchingAction not bound
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
       at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
       at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:626)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:588)
       at javax.naming.InitialContext.lookup(InitialContext.java:351)
       at org.jboss.seam.Component.instantiateSessionBean(Component.java:1107)
       at org.jboss.seam.Component.instantiate(Component.java:1093)
       at org.jboss.seam.Component.newInstance(Component.java:1736)
       ... 35 more
      ... Removed 21 stack frames


      although i have
      
       INFO 2007-04-02 18:03:48,468 (Component.java:245) - Component: hotelSearch, scope: SESSION, type: STATEFUL_SESSION_BEAN, class: org.jboss.seam.example.booking.HotelSearchingAction, JNDI: HotelSearchingAction/local
      
      ...
      
      
       INFO 2007-04-02 18:03:52,296 (Ejb3DescriptorHandler.java:1699) - adding class annotation org.jboss.annotation.internal.DefaultInterceptorMarker to org.jboss.seam.example.booking.HotelSearchingAction org.jboss.annotation.internal.DefaultInterceptorMarkerImpl@14b74a7
      DEBUG 2007-04-02 18:03:52,296 (Ejb3DescriptorHandler.java:1701) - adding class annotation org.jboss.annotation.internal.DefaultInterceptorMarker to org.jboss.seam.example.booking.HotelSearchingAction org.jboss.annotation.internal.DefaultInterceptorMarkerImpl@14b74a7
      DEBUG 2007-04-02 18:03:52,296 (Ejb3AnnotationHandler.java:164) - found EJB3: ejbName=HotelSearchingAction, class=org.jboss.seam.example.booking.HotelSearchingAction, type=STATEFUL
      DEBUG 2007-04-02 18:03:52,296 (ProxyDeployer.java:133) - no declared remote bindings for : HotelSearchingAction
      


      So it seems to be a classloading problem (???)
      Any help will be greatly appreciated !

      David