12 Replies Latest reply on Aug 1, 2008 9:47 PM by Chris Simons

    Deploying Seam app to OC4J 10.1.3.3; can I mostly follow the OC4J 11g guide?

    Chris Simons Expert

      We are attempting to get our Seam app (2.0 GA, JSF 1.2, RichFaces 3.1.4GA) application deployed to a stand-alone OC4J 10.1.3.3 container.  I have found tidbits of information in various places but nothing concrete.  However, going by the improvements supposedly made to the latest version of OC4J (10.1.3.3) - I am wondering if it is possible to follow the Seam on OC4J 11g tutorial that has already been provided?


      For example, one would assume some of the app-server configurations are similar between 10.1.3.3 and 11.1, such as manually defining EJBs and setting up the persistence layer to ignore TopLink and use Hibernate.


      At this point, I'm trying to tackle the app-server level configurations.  After that will be the configuration of the deployment descriptions and Ant file to work accordingly to OC4J demands.


      If you have any input whatsoever I am all ears/eyes.  I am particularly interested in not only getting this to work but also documenting the necessary steps to be successful so that others may learn.  Some people have said getting a Seam 2.0 app to work on OC4J10 can be done and I intend to do whatever it takes to have similar success.


      Thank you for your assistance!

        • 1. Re: Deploying Seam app to OC4J 10.1.3.3; can I mostly follow the OC4J 11g guide?
          Jay Balunas Novice


          I think that your assumptions about the difference should be correct.  OC4J 11 has been in tech preview for some time so I would assume some of the fixes/features have made it into the latest 10.X release.  I would hope that the differences between OC4J 10.1.3.3. and OC4J 11g are not monumental, but I have not tried deploying the seam examples to 10.X.


          The best advice I could give is to follow the Seam reference guide chapter on OC4J 11g (2.0.2.GA )
          and see what works and what does not ;)  Also take a look at JBSEAM-2122 - it contains a link to a JPA example on 10.X.


          Post any issue you have here and we'll try to help out.


          -Jay

          • 2. Re: Deploying Seam app to OC4J 10.1.3.3; can I mostly follow the OC4J 11g guide?
            Chris Simons Expert

            Jay - I appreciate your input. I was able to deploy the jee5 examples to OC4J 11 and am now attempting to do the same for OC4J 10.1.3.3 (latest release).


            Jay / All -
            My main issue right now deals with Seam interceptors.  Has anyone encountered this?


            2008-05-27 17:01:30.567 ERROR J2EE EJB-03027 [jboss-seam-jee5] An error occured deploying EJB module: com.evermind.server.ejb.exception.DeploymentException: [jboss-seam-jee5:jboss-seam-jee5] - No <around-invoke
            > or lifecycle callbacks were specified for interceptor org.jboss.seam.ejb.SeamInterceptor.



            My ejb-jar.xml and all configuration is exactly the same as it was with OC4J11.
            Any help would be appreciated.  Thank you.

            • 3. Re: Deploying Seam app to OC4J 10.1.3.3; can I mostly follow the OC4J 11g guide?
              Jay Balunas Novice

              My guess is that with OC4J 10.1.3.3 you may need to specify the specific methods for the interceptor, maybe it does not handle the annotations as expected.  So try to specify <around-invoke> in the xml.  That is what it sounds like to me.


              That is the type of things I would expect to be different (configuration requirements, jar requirements, etc...). 

              • 4. Re: Deploying Seam app to OC4J 10.1.3.3; can I mostly follow the OC4J 11g guide?
                Chris Simons Expert

                Yeah, I was thinking along the same lines but at the same time I'm wondering if Seam isn't being loaded properly as it is intended to intercept these calls.


                By the way, the error message I am encountering happens on deployment.  Does that change your initial idea?


                Thanks.

                • 5. Re: Deploying Seam app to OC4J 10.1.3.3; can I mostly follow the OC4J 11g guide?
                  Jay Balunas Novice

                  If seam is not being loaded correctly I would expect some different errors.  This error seems to be finding the class, but not recognizing the lifecycle methods.


                  You could also try googling for:




                  OC4J No <around-invoke> or lifecycle callbacks were specified


                  If it is an OC4J config issue others have probably seen it.


                  -Jay

                  • 6. Re: Deploying Seam app to OC4J 10.1.3.3; can I mostly follow the OC4J 11g guide?
                    Chris Simons Expert

                    In some very obscure Oracle documentation, I found that the ejb-jar.xml file should be called orion-ejb-jar.xml; though I don't know if this is a requirement or just semantics on their part.


                    Therefore, my orion-ejb-jar.xml looks like:
                    <interceptors>
                          <interceptor>
                             <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
                          </interceptor>
                       </interceptors>
                      
                       <assembly-descriptor>
                          <interceptor-binding>
                             <ejb-name>*</ejb-name>
                          <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
                          </interceptor-binding>
                       </assembly-descriptor>


                    But I'm still running into the same problem.


                    I'm hoping very much this is a configuration issue and not something that will require modifying/rebuilding the Seam base.


                    I noticed that in pre-Seam 2.0 versions, SeamInterceptor implemented Serializable.  Now, however, it implements SessionBeanInterceptor.  I'm wondering (rather frightened) that OC4J is having trouble picking up the @AroundInvoke annotations on the parent class since they are not located on SeamInterceptor itself.


                    Jay, anyone - any thoughts on this? :)


                    Thank you!

                    • 7. Re: Deploying Seam app to OC4J 10.1.3.3; can I mostly follow the OC4J 11g guide?
                      Paul Saraber Newbie

                      Hi Chris and Jay,
                      We are attempting the same thing over here in the Netherlands: get the Seam booking demo  (2.0 GA, JSF 1.2, RichFaces 3.1.4GA)  deployed to a stand-alone OC4J 10.1.3.3 container.


                      Our current stack is Struts (1.1) and JHeadstart(!!) , combined with Oracle Toplink 10. We've got the impression that Seam will help us improve our productivity.
                      On top of that, the current combination is not embraced by our developers, they need a new challenge!


                      I've experienced the same problems as Chris did, but somehow I got around some of them.


                      The first issue was about interceptors:
                      No <around-invoke> or lifecycle callbacks were specified for interceptor org.jboss.seam.ejb.SeamInterceptor.


                      I Fixed this problem by changing the orion-ejb-jar xml :


                      <?xml version="1.0"?>
                      <!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 1.1 runtime//EN" "http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd">
                      <orion-ejb-jar deployment-version="1.5.0">
                           <assembly-descriptor>
                           </assembly-descriptor>
                      </orion-ejb-jar>



                      ....and the ejb-jar.xml:


                      <?xml version="1.0" encoding="UTF-8"?>
                      <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" 
                               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
                               version="3.0">
                      <interceptors>
                           <interceptor>
                      <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
                                 <around-invoke>
                                 <method-name>aroundInvoke</method-name>
                                </around-invoke>
                                 </interceptor>
                      </interceptors>
                      <assembly-descriptor>
                      <interceptor-binding>
                           <ejb-name>*</ejb-name>
                      <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
                      </interceptor-binding>
                      </assembly-descriptor>
                      </ejb-jar>



                      That solved the first deployment problem. Started up the container and yesss:


                      2008-06-05 15:34:07,124 [OC4J Launcher] INFO  javax.servlet.ServletContextListener -Welcome to Seam 2.0.2.SP1
                      ......


                      2008-06-05 15:34:11,530 [OC4J Launcher] INFO  org.jboss.seam.init.Initialization -initializing Seam
                      .....


                      2008-06-05 15:34:16,983 [OC4J Launcher] INFO org.jboss.seam.contexts.Contexts -starting up: org.jboss.seam.ioc.spring.springELResolver


                      2008-06-05 15:34:17,030 [OC4J Launcher] INFO  org.jboss.seam.contexts.Contexts -starting up: org.jboss.seam.security.facesSecurityEvents


                      2008-06-05 15:34:17,030 [OC4J Launcher] INFO  org.jboss.seam.contexts.Contexts -starting up: org.jboss.seam.navigation.pages


                      2008-06-05 15:34:17,077 [OC4J Launcher] INFO  org.jboss.seam.init.Initialization -done initializing Seam


                      That was good news, So on to http://localhost:8888/seam-jee5/home.seam


                      500 Internal Server Error
                      Servlet error: An exception occurred. The current application deployment descriptors do not allow for including it in this response. Please consult the application log for details.


                      Mmm, after a quick peek in the log I saw this:


                      08/06/05 16:43:04.223 jboss-seam-jee5: 10.1.3.3.0 Started
                      08/06/05 16:43:04.598 jboss-seam-jee5: Error initializing servlet
                      java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory
                           at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:256)
                           at javax.faces.webapp.FacesServlet.init(FacesServlet.java:142)
                           at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpApplication.loadServlet(HttpApplication.java:2371)
                           .....
                           at java.lang.Thread.run(Thread.java:619)
                      08/06/05 16:43:04.629 jboss-seam-jee5: Servlet error
                      java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory
                           at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:256)
                           at javax.faces.webapp.FacesServlet.init(FacesServlet.java:142)
                           at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpApplication.loadServlet(HttpApplication.java:2371)


                           
                           ...etcetra, etcetera. So I added the following files
                           
                      j2ee\home\applications\jboss-seam-jee5\jboss-seam-jee5\META-INF\services\javax.faces.render.RenderKitFactory
                      com.sun.faces.renderkit.RenderKitFactoryImpl


                      j2ee\home\applications\jboss-seam-jee5\jboss-seam-jee5\META-INF\services\javax.faces.application.ApplicationFactory
                      com.sun.faces.application.ApplicationFactoryImpl


                      j2ee\home\applications\jboss-seam-jee5\jboss-seam-jee5\META-INF\services\javax.faces.context.FacesContextFactory
                      com.sun.faces.context.FacesContextFactoryImpl


                      j2ee\home\applications\jboss-seam-jee5\jboss-seam-jee5\META-INF\services\javax.faces.lifecycle.LifecycleFactory
                      com.sun.faces.lifecycle.LifecycleFactoryImpl


                      That solved the problem...But now I'm really stuck here: I get a nullpointer while calling the FacesContext.getInstance():


                      2008-06-05 15:52:07,053 [HTTPThreadGroup-4] ERROR org.jboss.seam.web.ExceptionFilter -handling uncaught exception
                      javax.faces.FacesException: com.sun.faces.renderkit.RenderKitFactoryImpl
                           at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:569)
                           at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:440)
                           at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:249)
                           at com.sun.faces.util.Util.verifyFactoriesAndInitDefaultRenderKit(Util.java:260)
                           at com.sun.faces.context.FacesContextFactoryImpl.getFacesContext(FacesContextFactoryImpl.java:105)
                           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:239)
                           at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                           at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:623)
                           at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
                           at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
                           at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
                           at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
                           at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
                           at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
                           at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
                           at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
                           at java.lang.Thread.run(Thread.java:619)


                      Caused by: java.lang.NullPointerException
                           at com.sun.faces.config.WebConfiguration.getInstance(WebConfiguration.java:104)
                           at com.sun.faces.renderkit.ResponseStateManagerImpl.init(ResponseStateManagerImpl.java:351)
                           at com.sun.faces.renderkit.ResponseStateManagerImpl.<init>(ResponseStateManagerImpl.java:99)
                           at com.sun.faces.renderkit.RenderKitImpl.<init>(RenderKitImpl.java:88)
                           at com.sun.faces.renderkit.RenderKitFactoryImpl.<init>(RenderKitFactoryImpl.java:68)
                           at sun.reflect.GeneratedConstructorAccessor69.newInstance(Unknown Source)
                           at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
                           at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
                           at java.lang.Class.newInstance0(Class.java:355)
                           at java.lang.Class.newInstance(Class.java:308)
                           at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:567)
                           ... 32 more




                      • 8. Re: Deploying Seam app to OC4J 10.1.3.3; can I mostly follow the OC4J 11g guide?
                        Chris Simons Expert

                        Paul,


                        Are you deploying with EJB3?  If so, are you using Hibernate or TopLink for the persistence provider?  I have an open Oracle SA ticket for them to figure out why OC4J10.1.3.3 won't let me ignore TopLink.  Just curious if you got around that or if you're not using EJB3.


                        Regarding your error, I can't help you specifically but it sounds rough and I am oh-so not looking forward to it.


                        One tid-bit I received from Oracle is that you should have an additional resource file in your /WEB-INF directory called orion-web.xml.


                        In this file, you should have:


                        <?xml version="1.0" ?>
                        <orion-web-app>
                        <web-app-class-loader search-local-classes-first="true"/>
                        <web-app />
                        </orion-web-app>



                        Worth a shot, right?

                        • 9. Re: Deploying Seam app to OC4J 10.1.3.3; can I mostly follow the OC4J 11g guide?
                          Paul Saraber Newbie

                          Worth a shot...no results.


                          Time for another approach. We dropped the idea of the Seam booking example, since it was not completely clear which dependencies caused us trouble. So we took one of our Port Community Applications and tried to add a JSF page in the existing app (Oracle JHS, Struts 1.1, TopLink 10.3). We assigned two of our developers to  a two-week (time boxed) Proof Of Concept. First goal: get a simple Hello World JSF page running.


                          We ran into the same problems straight away. A frustrated developer is a powerful asset! After two days whe got JSF + Seam + Richfaces running on oc4j 10.


                          Add these Jars to the lib dir of the ear :



                          • jsf-api.jar

                          • jaxws-api.jar

                          • jsf-impl.jar

                          • el-ri.jar (not in the Seam examples)



                          The trick that did it for us: you have to add a listener to the web.xml:


                          <listener>
                            <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
                          </listener>




                          Add a local ref:


                          <ejb-local-ref>
                            <ejb-ref-name>seam-poc/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>



                          after that we added & modified the components.xml:


                          <core:init jndi-pattern="java:comp/env/seam_poc/#\{ejbName\}/local" debug="true"/>



                          ..and again: use the correct Listener in application.xml:


                          <interceptors>
                            <interceptor>
                              <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
                                <around-invoke>
                                  <method-name>aroundInvoke</method-name>
                                </around-invoke>
                              </interceptor-class>
                             </interceptor>
                          </interceptors>



                          Seam only localises components if the seam.properties is present in the root of the jar/folder (may be empty). If it is not there your components are invisible to Seam.



                          And there we have it: Hello World! Now things got underway.
                          After that we had to tweak (libs, buildsystem) a bit more in order to get a really useful JSF page running inside our app.


                          We still face some challenges after integrating Seam in our existing app. Authorisation, breadcrumbs, performance of dynamic tables, and....No eye candy!
                          The css files are encoded and cannot be read by the browser. The problem is that the wrong sax parser (oracle's implemantation) is used.


                          So we're not there yet, we need more JSF + Seam knowledge. But I guess we've come a long way. Seems to me (after a quick tour in Google) that more people are trying out  this combination (oc4j 10 +JSF + Seam) and run into problems.

                          • 10. Re: Deploying Seam app to OC4J 10.1.3.3; can I mostly follow the OC4J 11g guide?
                            Chris Simons Expert

                            Paul,


                            Great post.  You guys have made some great progress.  Somehow you were able to get around the EJB3 Synchronization problem that I have been having...I'm going to go back to my build and compare mine to what you posted.  But you say you're still having problems and it's unfortunate that it's just so difficult to use EJB3/Seam with OC4J10. 


                            I have read that it is quite necessary to replace OC4J10's default XML parser with a more recent version of SAX so you should give that a shot and maybe - just maybe - you'll be our new favorite OC4J10 integrator. :)

                            • 11. Re: Deploying Seam app to OC4J 10.1.3.3; can I mostly follow the OC4J 11g guide?
                              Paul Saraber Newbie

                              Chris, the problems we face are related to integrating Seam with our existing stack/architecture. I don't see any problems (well, not too many) for greenfield projects.


                              The combi of Seam & TopLink in our basic setup works fine. We use TopLink als OR mapping, and are waiting for version 11g (for a loooong time). After that we can use TopLinks/eclipselink(?) JPA capabilities. But that's another story.


                              Good luck!


                              • 12. Re: Deploying Seam app to OC4J 10.1.3.3; can I mostly follow the OC4J 11g guide?
                                Chris Simons Expert

                                Paul,


                                I don't know if we'll ever truly see 11g, at least not for OC4J.  As you probably know, Oracle has finalized their acquisition of BEA and has re-branded BEA WebLogic as Oracle WebLogic.  It is now their standard, recommended Java application server offering.  In fact, I believe 11g was always a technology project never meant for final release as Oracle has been going after big J2EE offerings for 2-3 years now (first JBoss, then BEA).  Oracle's emphasis in J2EE will be integrating their other Fusion Middleware products with WebLogic AS and WebLogic Portal.


                                The fact that you are using TopLink solves many of the issues Seam developers have with OC4J as it prefers TopLink and doesn't always listen when you tell it to use Hibernate and ignore TopLink.


                                I'd be interested to know how you got around the EJB3TimerSynchronization problems.  Did you get around it through by adding the local-ejb-ref?


                                Thank you.