3 Replies Latest reply on Jun 16, 2008 4:06 PM by Tomasz Zdych

    ear with many of app.jar files

    Tomasz Zdych Newbie

      We want to save our entity beans and the interfaces for the session beans in the api.jar file and the implementations of session beans in the core.jar.


      Our Structure:


      helloworld.ear
       |+ app.war
       |+ api.jar (entities + api)
       |+ core.jar (core + api)
       |+ jboss-seam.jar
       |+ META-INF
       |+ application.xml
       |+ jboss-app.xml






      Our application.xml is like this:


      <?xml version="1.0" encoding="UTF-8"?>
      <application 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/application_5.xsd"
                   version="5">
          
          <display-name>adm</display-name>
          
          <module>
              <web>
                  <web-uri>frontend.war</web-uri>
                  <context-root>/adm</context-root>
              </web>
           </module>
           <module>
              <ejb>api.jar</ejb>
           </module>        
           <module>
              <ejb>core.jar</ejb>
           </module>        
           <module>
              <ejb>jboss-seam.jar</ejb>
           </module>    
          
          
      </application>
      





      I added an empty seam.properites to both of jar files.


      I didn't found any book or tutorial, where more than one app.jar file will be used. We have many problems and Errors with this structure. Can you give me the best way to use it? Where should i save my ejb-jar.xml and persistence.xml?


        • 1. Re: ear with many of app.jar files
          Tomasz Zdych Newbie

          this is the exception i become:



          Exception during request processing:
          Caused by javax.servlet.ServletException with message: "/newUser.xhtml @27,68 value="#{user.name}": Target Unreachable, identifier 'user' resolved to null"
          
          javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
          org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
          org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
          org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
          org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
          org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
          org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
          org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
          org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
          org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
          org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
          org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
          org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
          org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
          org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
          org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
          org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
          org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
          org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
          org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
          org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
          org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
          org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
          java.lang.Thread.run(Thread.java:619)
          
          Caused by javax.el.PropertyNotFoundException with message: "/newUser.xhtml @27,68 value="#{user.name}": Target Unreachable, identifier 'user' resolved to null"
          
          com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
          com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:81)
          javax.faces.component.UIInput.getConvertedValue(UIInput.java:934)
          javax.faces.component.UIInput.validate(UIInput.java:860)
          javax.faces.component.UIInput.executeValidate(UIInput.java:1065)
          javax.faces.component.UIInput.processValidators(UIInput.java:666)
          javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
          javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
          javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
          javax.faces.component.UIForm.processValidators(UIForm.java:229)
          javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
          javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:662)
          org.ajax4jsf.component.AjaxViewRoot.access$201(AjaxViewRoot.java:57)
          org.ajax4jsf.component.AjaxViewRoot$3.invokeRoot(AjaxViewRoot.java:319)
          org.ajax4jsf.context.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:56)
          org.ajax4jsf.context.AjaxContextImpl.invokeOnRegionOrRoot(AjaxContextImpl.java:170)
          org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:333)
          com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
          com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
          com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
          javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
          org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
          org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
          org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
          org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
          org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
          org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
          org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
          org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
          org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
          org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
          org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
          org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
          org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
          org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
          org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
          org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
          org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
          org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
          org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
          org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
          org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
          org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
          org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
          java.lang.Thread.run(Thread.java:619)
          
          




          newUser.xhtml is in app.war and the user in the api.jar file

          • 2. Re: ear with many of app.jar files
            Jason Long Novice

            I have the same problem with a jar that I put in my WEB-INF/lib.


            It will work on redeploy, but not always from a full server restart.


            Any ideas anyone?

            • 3. Re: ear with many of app.jar files
              Tomasz Zdych Newbie

              So i have put the seam.properties on the top of my jar files and make new




              <module><ejb>...</ejb></module> 





              declarations in application.xml.


              Furthermore there is only one jar file with the persistence.xml (application unique persistence-unit) inside.



              <persistence xmlns="http://java.sun.com/xml/ns/persistence" 
                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                           xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" 
                           version="1.0">
                           
                     <persistence-unit name="someUniqueUnitName">
              (...)
              




              Every time if we use a entityManager in our actions classes we have to declare the unitName from our persistence.xml file like:




              @Stateless
              @Name("userRolesAction") 
              public class UserRolesAction implements UserRolesService {
                
                @PersistenceContext(unitName="someUniqueUnitName")
                private EntityManager em;
              (...)
              




              It's seam to work correctly now. I hope the seam people can confirm, that this is the clear way to have a couple of seam modules in one ear file.