3 Replies Latest reply on Feb 25, 2010 8:57 PM by quangle.legiaquangvn.yahoo.com

    weblogic 10.3 setup with ejb booking example

    mdurant.mark.durant.fiserv.com

      Hi,
      I'm having some problems getting the EJB version of the booking example in Seam 2.1.2 working with WebLogic 10.3, and I'm hoping that someone here has some advice.  I followed the instructions in Chapter 39 of the community documentation (http://docs.jboss.org/seam/2.1.2/reference/en-US/html/weblogic.html), worked through a few dependency issues, and got the application to the point where it deployed cleanly into WLS.  When I go to http://localhost:7001/seam-booking, though, I get lots of exceptions, each of whose root cause is this:


      Caused by: javax.naming.NameNotFoundException: While trying to lookup 'jboss-seam-booking.EjbSynchronizations/local' didn't find subcontext 'jboss-seam-booking'. Resolved ''; remaining name 'jboss-seam-booking/EjbSynchronizations/local'
              at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
              at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
              at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
              at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
              at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
              at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
              at javax.naming.InitialContext.lookup(InitialContext.java:392)
              at org.jboss.seam.Component.instantiateSessionBean(Component.java:1400)
              at org.jboss.seam.Component.instantiate(Component.java:1364)
              at org.jboss.seam.Component.newInstance(Component.java:2122)
              ... 48 more



      I'm able to get rid of these errors by commenting out the <transaction:ejb-transaction/> line from components.xml, and that gets me to the home page of the booking application fine, but then I get similar errors for other beans when I try to use the site.


      If I look at the WLS JNDI tree in the WLS admin console for the server that this is running on, I don't see any of these EJBs listed, so it looks like they're just not deploying.  I do see them identified as EJB jars in the deployments section, though, when I expand the booking app deployment in there.  I'm fairly new to EJBs, too, so I may just not be understanding where/how it should be shown.


      Thanks for any help!


      Mark

        • 1. Re: weblogic 10.3 setup with ejb booking example
          mdurant.mark.durant.fiserv.com

          For future reference, and to supplement the incomplete docs at http://docs.jboss.org/seam/2.1.2/reference/en-US/html/weblogic.html, I've managed to get the whole thing working with the following additions to the community doc instructions:


          1. There are a bunch of jar files that need to be added the to the WebLogic domain's shared library to get past ClassNotFoundExceptions:


          ([BEA_HOME]/user_projects/domains/seam_examples/lib)
          
          antlr.jar
          asm.jar
          cglib.jar
          commons-collections.jar
          commons-logging.jar
          concurrent.jar
          dom4j.jar
          el-api.jar
          hibernate.jar
          hibernate-annotations.jar
          hibernate-commons-annotations.jar
          hibernate-entitymanager.jar
          hibernate-validator.jar
          hsqldb.jar
          javassist.jar
          javax.jsf_1.2.0.0.jar
          jboss-common-core.jar



          2. WebLogic won't find any of the EJBs, and will throw NameNotFoundExceptions unless they're defined in web.xml:


          <ejb-local-ref>
               <ejb-ref-name>jboss-seam-booking/EjbSynchronizations/local</ejb-ref-name>
               <ejb-ref-type>Session</ejb-ref-type>
               <local>org.jboss.seam.transaction.LocalEjbSynchronizations</local>
               <ejb-link>EjbSynchronizations</ejb-link>
          </ejb-local-ref>
          
          <ejb-local-ref>
               <ejb-ref-name>jboss-seam-booking/AuthenticatorAction/local</ejb-ref-name>
               <ejb-ref-type>Session</ejb-ref-type>
               <local>org.jboss.seam.example.booking.Authenticator</local>
               <ejb-link>AuthenticatorAction</ejb-link>
          </ejb-local-ref>
          
          <ejb-local-ref>
               <ejb-ref-name>jboss-seam-booking/BookingListAction/local</ejb-ref-name>
               <ejb-ref-type>Session</ejb-ref-type>
               <local>org.jboss.seam.example.booking.BookingList</local>
               <ejb-link>BookingListAction</ejb-link>
          </ejb-local-ref>
          
          <ejb-local-ref>
               <ejb-ref-name>jboss-seam-booking/RegisterAction/local</ejb-ref-name>
               <ejb-ref-type>Session</ejb-ref-type>
               <local>org.jboss.seam.example.booking.Register</local>
               <ejb-link>RegisterAction</ejb-link>
          </ejb-local-ref>
          
          <ejb-local-ref>
               <ejb-ref-name>jboss-seam-booking/ChangePasswordAction/local</ejb-ref-name>
               <ejb-ref-type>Session</ejb-ref-type>
               <local>org.jboss.seam.example.booking.ChangePassword</local>
               <ejb-link>ChangePasswordAction</ejb-link>
          </ejb-local-ref>
          
          <ejb-local-ref>
               <ejb-ref-name>jboss-seam-booking/HotelBookingAction/local</ejb-ref-name>
               <ejb-ref-type>Session</ejb-ref-type>
               <local>org.jboss.seam.example.booking.HotelBooking</local>
               <ejb-link>HotelBookingAction</ejb-link>
          </ejb-local-ref>
          
          <ejb-local-ref>
               <ejb-ref-name>jboss-seam-booking/HotelSearchingAction/local</ejb-ref-name>
               <ejb-ref-type>Session</ejb-ref-type>
               <local>org.jboss.seam.example.booking.HotelSearching</local>
               <ejb-link>HotelSearchingAction</ejb-link>
          </ejb-local-ref>



          3. WebLogic registers those EJBs using a modified JNDI pattern that has to be defined in components.xml:


          <core:init jndi-pattern="java:comp/env/@jndiPattern@" debug="true" distributable="@distributable@"/>



          4. There is an ANTLR library conflict that also needs to be resolved in persistence.xml:


          <property name="hibernate.query.factory_class" value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>



          After that, http://localhost:7001/seam-booking works perfectly.


          As I mentioned up top, I'm new to much of this, so there may be cleaner ways.  In the absence of any good docs online, though, hopefully this'll help other travelers coming through this way. ;)


          Mark

          • 2. Re: weblogic 10.3 setup with ejb booking example
            mdurant.mark.durant.fiserv.com

            There's one additional issue with booking confirmation after the above changes:  It looks like you should also comment out <transaction:ejb-transaction> in components.xml, as the BookingListAction observer will throw serialization exceptions.

            • 3. Re: weblogic 10.3 setup with ejb booking example
              quangle.legiaquangvn.yahoo.com

              Mark,


              Thank you very much for your detail instruction.


              I have follow the steps in http://docs.jboss.org/seam/2.1.2/reference/en-US/html/weblogic.html
              and your above steps and I am able to deploy the jee5/booking example on Weblogic 10.3.2.


              But I got an issue when tried to login the demo. The problem is that:
              "Could not instantiate Seam component: Authenticator"


              I have looked around for the solution that some one has posted and decided to keep the components.xml unchanged (instead of follow your step 3), and it turns out working fine. Here it is:
              <core:init jndi-pattern="java:comp/env/jboss-seam-jee5/#{ejbName}/local" debug="true"/>.


              For someone wants to make a try with MySQL, below is some info of my data-source in Weblogic:
              - Name: seam-jee5-ds-mysql
              - JNDI Name: seam-jee5-ds-mysql
              - Database type: MySQL
              - Database Driver: (auto populated)


              - Database Name: seambooking (you have to create a database name seambooking in MySQL first, by typing create database seambooking in MySQL command line)
              - Host Name: 127.0.0.1
              - Port: 3306
              - Database User Name: (your username)
              - Database Password: (your password)


              then continue with other steps in instructed in http://docs.jboss.org/seam/2.1.2/reference/en-US/html/weblogic.html


              In the persistence.xml:
              - replace this:  <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
              - with this: <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>


              and
              - replace this:  <jta-data-source>seam-jee5-ds</jta-data-source>
              - with this: <jta-data-source>seam-jee5-ds-mysql</jta-data-source>


              Again, Mark - thank you very much for your valuable instructions.


              Regards.
              Quang Le


              PS: Have you make a try with Seam 2.2.0?
              (Sorry for my poor editing)