1 2 Previous Next 23 Replies Latest reply on Apr 6, 2011 7:02 AM by Alex Corvs

    Packing WAR to EAR fails to deploy

    Alex Corvs Newbie
      I've got a SEAM application packing to war with some seam components in it that deploys and works well.
      Than I want to make a EAR with one additional EJB and this WAR. I've puted this war to ear as is except some common libraries was moved to ear/lib directory from war/web-inf/lib.

      The problem is that at the deploy time it throws
      |java.lang.RuntimeException: Could not create Component:|
      and the reason is it cannot found class that is located as earlier in war/web-inf/lib directory (ClassNotFoundException).

      The seam components are all in war, so jboss-seam.jar are also in war/web-inf/lib.

      The content of my ear as follows:
      EAR
      - lib (common libs)
      - META-INF
        - application.xml
      - myejb.jar (nothing about seam in it)
      - myseam.war
        - .... some data
        - META-INF
          - MANIFEST.MF (without classpath property)
        - WEB-INF
          - lib (war libs)
          - classes
          - components.xml
          - faces-config.xml
          - jboss-web.xml
          - pages.xml
          - web.xml

      The content of jboss-web.xml
      <!DOCTYPE jboss-web PUBLIC
          "-//JBoss//DTD Web Application 4.2//EN"
          "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
      <jboss-web> 
          <class-loading java2ClassLoadingCompliance="false">
              <loader-repository>
                  seam.jboss.org:loader=seam
                  <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
              </loader-repository>
          </class-loading>
      </jboss-web>

      I have spent one day to resolve this problem but still can't.
      Any help and ideas are welcome.


        • 1. Re: Packing WAR to EAR fails to deploy
          Alex Corvs Newbie

          Forgot to specify, I'm using Seam 2.2 and Jboss 5.1

          • 2. Re: Packing WAR to EAR fails to deploy
            Alex Corvs Newbie

            I also tried to generate seam test project using jboss tools in eclipse. I have my ear identical to this test project except my own classes but problem is still exists.

            • 3. Re: Packing WAR to EAR fails to deploy
              Leo van den berg Master

              Hi,


              I can't look inside you subdirs, but do you have the seam.properties files at the right places, so Seam can find the annotated classes?


              Leo

              • 4. Re: Packing WAR to EAR fails to deploy
                Alex Corvs Newbie

                Leo van den Berg wrote on Apr 05, 2011 05:57:


                Hi,

                I can't look inside you subdirs, but do you have the seam.properties files at the right places, so Seam can find the annotated classes?

                Leo


                seam.properties file is located at war/web-inf/classes and I think that it is all ok with it cause as I mentioned earlier this war is works fine when outside from ear.

                • 5. Re: Packing WAR to EAR fails to deploy
                  Leo van den berg Master

                  Hi,


                  Jboss-seam.jar should be at the root of your EAR. And others in lib under the root of the EAR.


                  Leo

                  • 6. Re: Packing WAR to EAR fails to deploy
                    Alex Corvs Newbie
                    Leo,

                    My last try was to compare my ear with the test one was generated by jboss tools. Now jboss-seam.jar is in root of ear and other libs except ejb are in lib subdirectory of ear.

                    This is updated content of ear:

                    JBOSS\server\default\deploy\my.app.ear\
                    |   jboss-seam.jar
                    |
                    |---lib
                    |       antlr-runtime.jar
                    |       commons-beanutils.jar
                    |       drools-api.jar
                    |       drools-compiler.jar
                    |       drools-core.jar
                    |       jboss-el.jar
                    |       jboss-seam-remoting.jar
                    |       jbpm-jpdl.jar
                    |---META-INF
                    |       application.xml
                    |       jboss-app.xml
                    |
                    |---my.ejb.jar
                    |   |
                    |   |---com
                    |   |   |  
                    |   |   |___... my classes
                    |   |  
                    |   |___META-INF
                    |       |   ejb-jar.xml
                    |       |   MANIFEST.MF
                    |       |  
                    |       |___wsdl
                    |               OperatorServiceNew.wsdl
                    |  
                    |___my.seam.war
                        |   error.xhtml
                        |   home.page.xml
                        |   home.xhtml
                        |   index.html
                        |  
                        |---... a lot of my pages
                        |  
                        |---META-INF
                        |   |   MANIFEST.MF
                        |   |  
                        |   |___wsdl
                        |           service.wsdl
                        |  
                        |___WEB-INF
                            |   components.xml
                            |   faces-config.xml
                            |   jboss-web.xml
                            |   pages.xml
                            |   web.xml
                            |  
                            |---classes
                            |   |  
                            |   |___... my classes
                            |  
                            |___lib
                                    activation-1.1.jar
                                    bcpg-jdk16-145.jar
                                    bcprov-jdk16-145.jar
                                    commons-codec-1.4.jar
                                    commons-dbcp-1.4.jar
                                    commons-digester.jar
                                    commons-io-2.0.jar
                                    commons-lang-2.4.jar
                                    commons-lang-2.5.jar
                                    commons-logging-1.1.0.jar

                    But the problem is still unresolved...
                    • 7. Re: Packing WAR to EAR fails to deploy
                      Leo van den berg Master

                      Hi,


                      An error is thrown:


                      java.lang.RuntimeException: Could not create Component:


                      Can you tell which component is not created. A Seam-one or one of your own application ?


                      Leo

                      • 8. Re: Packing WAR to EAR fails to deploy
                        Leo van den berg Master

                        Hi,


                        and be aware that the JNDI-names of the components need an additional prefix when you use them inside an EAR:


                        The jndi-pattern in components.xml should be edited from:





                        <core:init jndi-pattern="/#{ejbName}/local" />




                        to




                        <core:init jndi-pattern="YOUR_EAR_NAME/#{ejbName}/local" />
                        





                        Leo


                        • 9. Re: Packing WAR to EAR fails to deploy
                          Alex Corvs Newbie

                          Leo van den Berg wrote on Apr 05, 2011 06:47:


                          Hi,

                          An error is thrown:

                          java.lang.RuntimeException: Could not create Component:

                          Can you tell which component is not created. A Seam-one or one of your own application ?

                          Leo


                          It cannot create my own component annotated with @Name.
                          I will check about jndi names and report soon

                          • 10. Re: Packing WAR to EAR fails to deploy
                            Alex Corvs Newbie

                            Leo van den Berg wrote on Apr 05, 2011 06:51:


                            Hi,

                            and be aware that the JNDI-names of the components need an additional prefix when you use them inside an EAR:

                            The jndi-pattern in components.xml should be edited from:




                            <core:init jndi-pattern="/#{ejbName}/local" />




                            to



                            <core:init jndi-pattern="YOUR_EAR_NAME/#{ejbName}/local" />
                            





                            Leo




                            I didn't use jndi names in my components.xml

                            • 11. Re: Packing WAR to EAR fails to deploy
                              Leo van den berg Master

                              Hi,


                              you possibly have a components.properties file where this pattern is stored. The JNDI-binding is automatically and under normal circumstances you will never have to deal with JNDI-names directly, but it is really used under the hood by Seam.


                              Leo

                              • 12. Re: Packing WAR to EAR fails to deploy
                                Alex Corvs Newbie

                                Leo van den Berg wrote on Apr 05, 2011 08:13:


                                Hi,

                                you possibly have a components.properties file where this pattern is stored. The JNDI-binding is automatically and under normal circumstances you will never have to deal with JNDI-names directly, but it is really used under the hood by Seam.

                                Leo


                                I've checked and there is no components.properties file anywhere inside a jboss.

                                • 13. Re: Packing WAR to EAR fails to deploy
                                  Leo van den berg Master

                                  Hi,



                                  The components.properties file should be in ear and contains the definition form placeholder replacement in other parts of your configuration. If I recall well Seam-gen makes such a file for you. O


                                  have you tried my suggestion in components.xml. That should do the trick for you.


                                  Leo

                                  • 14. Re: Packing WAR to EAR fails to deploy
                                    Alex Corvs Newbie
                                    Leo,

                                    In my generated test seam project there is a seam-ejb.jar file storing seam ejb's and there is components.properties in it.
                                    In my case my.ejb.jar is not about seam but my war it is.
                                    Than I put components.properties file in my war next to seam.properties file in war/web-inf/classes and write my ear name in the template. The content of file is here:

                                    #
                                    #Mon Apr 04 17:45:47 MSD 2011
                                    jndiPattern=my-ear/\#{ejbName}/local
                                    embeddedEjb=false

                                    This is not helps ((

                                    Leo, can you explain more about your suggestion in components.xml. I didn't understood what can I try.

                                    Great thanks to you!

                                    There is a content of my components.xml
                                    <?xml version="1.0" encoding="UTF-8"?>

                                    <components xmlns="http://jboss.com/products/seam/components" xmlns:core="http://jboss.com/products/seam/core"
                                         xmlns:persistence="http://jboss.com/products/seam/persistence" xmlns:security="http://jboss.com/products/seam/security"
                                         xmlns:theme="http://jboss.com/products/seam/theme" xmlns:cache="http://jboss.com/products/seam/cache"
                                         xmlns:web="http://jboss.com/products/seam/web" xmlns:international="http://jboss.com/products/seam/international"
                                         xmlns:transaction="http://jboss.com/products/seam/transaction" xmlns:navigation="http://jboss.com/products/seam/navigation"
                                         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                         xsi:schemaLocation="http://jboss.com/products/seam/core
                                                    http://jboss.com/products/seam/core-2.1.xsd
                                                        http://jboss.com/products/seam/persistence
                                                        http://jboss.com/products/seam/persistence-2.1.xsd               
                                                    http://jboss.com/products/seam/security
                                                    http://jboss.com/products/seam/security-2.1.xsd
                                                    http://jboss.com/products/seam/theme
                                                    http://jboss.com/products/seam/theme-2.1.xsd
                                                    http://jboss.com/products/seam/cache
                                                    http://jboss.com/products/seam/cache-2.1.xsd
                                                    http://jboss.com/products/seam/web
                                                    http://jboss.com/products/seam/web-2.1.xsd
                                                    http://jboss.com/products/seam/international
                                                    http://jboss.com/products/seam/international-2.1.xsd
                                                    http://jboss.com/products/seam/components
                                                    http://jboss.com/products/seam/components-2.1.xsd
                                                    http://jboss.com/products/seam/transaction
                                                    http://jboss.com/products/seam/transaction-2.1.xsd
                                                    http://jboss.com/products/seam/navigation
                                                    http://jboss.com/products/seam/navigation-2.1.xsd">
                                         <!--
                                              it seems that this definitions are useless in current project http://jboss.com/products/seam/persistence
                                              http://jboss.com/products/seam/persistence-2.1.xsd
                                         -->

                                         <core:init debug="true" />

                                         <core:manager concurrent-request-timeout="500" conversation-timeout="120000"
                                              conversation-id-parameter="cid" parent-conversation-id-parameter="pid" />
                                              
                                         <core:resource-loader>
                                              <core:bundle-names>
                                                   <value>com.my.app.resources.ValidatorMessages</value>
                                                   <value>com.my.app.resources.menu</value>
                                                   <value>com.my.app.resources.common</value>
                                                   <value>com.my.app.resources.hints</value>
                                                   <value>com.my.app.resources.export</value>
                                              </core:bundle-names>
                                         </core:resource-loader>

                                         <!-- WEB -->
                                         <web:exception-filter />
                                         <web:rewrite-filter view-mapping="*.seam" />
                                         <web:redirect-filter url-pattern="*.seam" />
                                         <web:multipart-filter create-temp-files="true" max-request-size="1000000" url-pattern="*.seam" />
                                         <web:character-encoding-filter encoding="UTF-8" override-client="true" url-pattern="*.seam" />
                                         <web:context-filter url-pattern="/files/*" />
                                         <web:identity-filter url-pattern="/*" disabled="false" />

                                         <!-- web:hot-deploy-filter url-pattern="*.seam" / -->

                                         <theme:theme-selector>
                                              <theme:available-themes>
                                                   <value>default</value>
                                              </theme:available-themes>
                                         </theme:theme-selector>

                                         <international:locale-config default-locale="ru" supported-locales="ru" />

                                         <security:identity authenticate-method="#{authenticator.authenticate}" remember-me="false" />

                                         <security:jpa-identity-store auto-create="true" user-class=""
                                              class="com.my.app.security.CustomIdentityStore" />

                                         <security:jpa-permission-store auto-create="true"
                                              class="com.my.app.security.CustomPermissionStore" />

                                         <security:persistent-permission-resolver auto-create="true"
                                              class="com.my.app.security.CustomPersistentPermissionResolver" />

                                         <event type="org.jboss.seam.security.notLoggedIn">
                                              <action execute="#{redirect.captureCurrentView}" />
                                         </event>

                                         <event type="org.jboss.seam.security.postAuthenticate">
                                              <action execute="#{redirect.returnToCapturedView}" />
                                         </event>

                                    </components>

                                    1 2 Previous Next