1 2 Previous Next 24 Replies Latest reply on May 21, 2012 9:32 AM by alisissa

    Migration From Jboss 4.2.1 to Jboss 7.1.1

    alisissa

      Hi,

       

      i have a java application running on a linux server with mysql database using Jboss 4.2.1 and now my company needs to migrate to Jboss 7.1.1. here is what I have done so far:

      1. I dowloaded Jboss 7.1.1 and started it.
      2. I deployed my application (3 projects) 2 jar outputs and 1 war output, the first jar output was deployed successfully but my problem is with the second one.
      3. The error I am getting is the below

               

      java.lang.RuntimeException: Error getting reflective information for class tpg.tpgapp.sessions.CardValidatorBean with ClassLoader ModuleClassLoader for Module "deployment.TPGApp.jar:main" from Service Module Loader

                at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)

                at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)

                at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)

                at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)

                at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                ... 5 more

      Caused by: java.lang.NoClassDefFoundError: tpg/commons/exceptions/BusinessEntityFindException

                at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_04]

                at java.lang.Class.privateGetDeclaredFields(Class.java:2308) [rt.jar:1.7.0_04]

                at java.lang.Class.getDeclaredFields(Class.java:1760) [rt.jar:1.7.0_04]

                at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                ... 10 more

      Caused by: java.lang.ClassNotFoundException: tpg.commons.exceptions.BusinessEntityFindException from [Module "deployment.TPGApp.jar:main" from Service Module Loader]

                at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

                at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

                ... 15 more

       

      P.S. I am deploying the jar files by putting them in the deployemtn folder while jboss 7.1.1 is running and for the first one I am gettinga .deployed file but for the second I am getting .failed file.

      Here is the output of the .failed file.

       

      {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"TPGApp.jar\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"TPGApp.jar\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"TPGApp.jar\""}}}}

       

      Any help will be highly appreciated.

        • 1. Re: Migration From Jboss 4.2.1 to Jboss 7.1.1
          lafr

          The missing class tpg/commons/exceptions/BusinessEntityFindException is part of your succesfully deployed jar and TPGApp.jar is the one failing?

          Classes are not shared between deployment units.

          You have to explecitly define a dependency. The easiest option is to define this when building your jar by adding this to your manifest file like I did here:

                  <manifest>
                      <attribute name="Dependencies" value="deployment.controller.rar, deployment.filesystem.rar"/>
                  </manifest>

           

          For questions about JBoss AS7 you should use the forum named so.

          This question is not related to JBossWeb as far as I can see.

          • 2. Re: Migration From Jboss 4.2.1 to Jboss 7.1.1
            alisissa

            can you please tell me how to add it in the manifest file, and one more thing my manifest file is empty it only contains 1 line "Manifest-Version: 1.0"

            • 3. Re: Migration From Jboss 4.2.1 to Jboss 7.1.1
              lafr

              I'm using apache ant to build.

               

              The manifest file contains version, ant-version and java-version:

              Manifest-Version: 1.0

              Ant-Version: Apache Ant 1.8.3

              Created-By: 1.6.0_32-b05 (Sun Microsystems Inc.)

               

              So you probably use something different, but may be it helps you to see how I'm doing this.

              Within my ant build script my ear-file is build this way:

                  <ear earfile="${BIN}/${pre-stage.ear.name}" appxml="${etc.dir}/application.xml">
                      <fileset dir="${build.deploy.dir}" includes="ejb-entity.jar"/>
                      <fileset dir="${build.deploy.dir}" includes="ejb-session-*.jar"/>
                      <fileset dir="${build.deploy.dir}" includes="ws-*.war"/>
                      <fileset dir="${build.deploy.dir}" includes="web.war"/>
                      <fileset dir="${build.deploy.dir}" includes="lib/**"/>
                      <fileset dir="${etc.dir}" includes="mbi_deploy.xml"/>
                      <manifest>
                          <attribute name="Dependencies" value="deployment.controller.rar, deployment.filesystem.rar"/>
                      </manifest>
                  </ear>

               

              The name of the modules the current one depends on are always "deployment.<file name>".

              • 4. Re: Migration From Jboss 4.2.1 to Jboss 7.1.1
                alisissa

                one more question and if you can help it will be more than great.

                my application contains 3 projects: EJB Module (generates jar file upon building), Java project(generates jar file upon building), and a web project which generates war file upon building. when am building the java project TPGCommons it is deployed correctly in the folder deployments on jboss 7.1.1, but the EJB Module TPGApp is generating a .failed file, now my question is that I have many jar files in the lib folders in each project should i add only the TPGCommons.jar in the Manifest.MF of the TPGApp or i should include them all like this:

                Manifest-Version: 1.0

                Class-Path: TPGCommons.jar

                 

                Thank you veeeeeeeeeery much for your help.

                • 5. Re: Migration From Jboss 4.2.1 to Jboss 7.1.1
                  lafr

                  You add only the deployment unit in your manifest as dependenciy.

                  For TPGApp.jar this means you add "Dependencies: deployment.TPGCommons.jar" to the manifest file.

                  • 6. Re: Migration From Jboss 4.2.1 to Jboss 7.1.1
                    alisissa

                    I am getting this error now, do you have any clue?

                    New missing/unsatisfied dependencies:

                          service jboss.naming.context.java."TPG connection" (missing) dependents: [service jboss.persistenceunit."TPGApp.jar#TPGAppPU"]

                    • 7. Re: Migration From Jboss 4.2.1 to Jboss 7.1.1
                      lafr

                      TPGApp.jar contains META-INF/persistence.xml containing persistence-unit with name "TPGAppPU"?

                      Where is "TPG connection" coming from?

                      To few information to really help you.

                      • 8. Re: Migration From Jboss 4.2.1 to Jboss 7.1.1
                        alisissa

                        btw in my TPGApp project i have a jboss-ds.xml to select the connection string and after i build in jboss 7 i am putting my connection string in standalone.xml. does the TPGApp.jar includes the info of jboss-ds.xml inside it so a conflict might be occuring?

                        another thing i am using this mysql-connector-java-5.1.20-bin.jar as my driver.

                        is it very hard to migrate? should i migrate to jboss 5 considering i am not an expert in java enviroment? or with your help i am almost there?

                         

                        thanks again

                        • 9. Re: Migration From Jboss 4.2.1 to Jboss 7.1.1
                          lafr

                          Looks good.

                          Only you might use version 2.0:

                          <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_2_0.xsd"

                                       version="2.0">

                          ...

                           

                          And it's located in META-INF folder?

                          Of which file? App? Commons?

                          Is the PU detected and activated according to the server.log / console output?

                          • 10. Re: Migration From Jboss 4.2.1 to Jboss 7.1.1
                            lafr

                            I have no experience with -ds.xml file inside jar.

                            Either put it into standalone.xml or as a seperate file into the deployments folder.

                            But as far as I understand, you now have it twice. I think this is no good idea.

                             

                            It might be a good idea to provide your standalone.xml file and your server.log file.

                            BTW, your using standalone.xml as base or standalone-full.xml?

                            And perhaps a "jar -tvf" of each of your three deployment files.

                            • 11. Re: Migration From Jboss 4.2.1 to Jboss 7.1.1
                              lafr

                              It would be nice if you let me/us know, what the problem was that you fixed now.

                               

                              My datasource section looks like this:

                                      <datasources>
                                          <drivers>
                                              <driver name="ifxjdbc_all.jar">
                                                  <xa-datasource-class>com.informix.jdbcx.IfxXADataSource</xa-datasource-class>
                                              </driver>
                                              <driver name="ojdbc6.jar">
                                                  <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
                                              </driver>
                                              <driver name="sqljdbc4.jar">
                                                  <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
                                              </driver>
                                          </drivers>
                                      </datasources>

                              The mentioned names (ifxjdbc_all.jar, ojdbc6.jar, sqljdbc4.jar) reference the JDBC drivers also simply deployed by putting the files into the deployments directory.

                              No experience with mysql from my side.

                               

                              Did you create a module for the mysql-driver under $JBOSS_HOME/modules/com/mysql/? If not, rename the driver and erase the module attribute.

                              Or did you also drop mysql*.jar into deployments folder? Or is it part of your deployment unit (TPGApp.jar)?

                              To mention the xa-datasource-class is only needed when you're going to use it. I use it, you don't.

                              If the used JDBC driver is JDBC4 compliant, the datasource-class (non-XA) is automatically detected.

                               

                              My DefaultDS is deployed as a file named DefaultDS-ds.xml in the deployments folder.:

                              <?xml version="1.0" encoding="UTF-8"?>

                              <datasources xmlns="http://www.jboss.org/ironjacamar/schema">

                                <datasource jndi-name="DefaultDS" enabled="true" use-java-context="true" pool-name="DefaultDS">

                                  <connection-url>jdbc:informix-sqli://sb2000:9088/jboss7:INFORMIXSERVER=sb2000_net;NEWCODESET=8859_15,8859-1,819;LOBCACHE=-1</connection-url>

                                  <driver>ifxjdbc_all.jar</driver>

                                  <security>

                                    <user-name>mbi</user-name>

                                    <password>XXXXXX</password>

                                  </security>

                                </datasource>

                              </datasources>

                              The syntax in standalone.xml is the same.

                              But because of the Illegal Argument Invalid value specification TPG connection I'd try to define the JNDI name without spaces.

                              Maybe also for the pool-name.

                              Why "jta=false"? The persistence.xml file you showed had transaction-type JTA and references a jta-data-source.

                              And the name of the jta-data-source in persistence.xml should certainly be the same as in your datasource definition.

                              • 12. Re: Migration From Jboss 4.2.1 to Jboss 7.1.1
                                alisissa

                                Thank you again,

                                I fixed the problem by fixing the name of the jndi-name which was "exampleds".

                                Yes I had created a module under $JBOSS_HOME/modules/com/mysql/main and I am using it.

                                I added iin the folder of the module mysql-connector-java-5.1.20-bin.jar, should I deploy this?

                                 

                                I renamed TPG connection to TPGconnection and when trying to upload the jar file of TPGApp.jar using the web console of jboss 7.1, I am getting this error now:

                                 

                                Internal Server Error

                                {

                                    "outcome" => "failed",

                                    "failure-description" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"TPGApp.jar#TPGAppPU\"jboss.naming.context.java.TPGconnectionMissing[jboss.persistenceunit.\"TPGApp.jar#TPGAppPU\"jboss.naming.context.java.TPGconnection]"]},

                                    "rolled-back" => true

                                }


                                • 13. Re: Migration From Jboss 4.2.1 to Jboss 7.1.1
                                  alisissa

                                  in the nohup.out the error is:

                                   

                                  JBAS014775:    New missing/unsatisfied dependencies:

                                        service jboss.naming.context.java.TPGconnection (missing) dependents: [service jboss.persistenceunit."TPGApp.jar#TPGAppPU"]

                                  any suggestions?

                                   

                                  P.S. I tried to deploy mysql-connector-java-5.1.20-bin.jar before redeploying AppApp.jar but still the same error.

                                   

                                  Thanks a lot

                                  • 14. Re: Migration From Jboss 4.2.1 to Jboss 7.1.1
                                    lafr

                                    So the error message from before is back again? I get irritated.

                                     

                                    So let's start at the beginning.

                                    For every database driver 2 options are available: module or deployment. There are pros and cons for both.

                                    I preferred the deployment option. But only use one of them!

                                    The module option is described so many times, e.g. at https://zorq.net/b/2011/07/12/adding-a-mysql-datasource-to-jboss-as-7/.

                                    As you see, it's no sufficient to have the jar file in this folder, you also have to provide a module.xml file.

                                     

                                    I downloaded mysql-connector-java-5.1.20-bin.jar and simply dropped it to the deployments folder.

                                    On console output and in server.log I see then:

                                    18:36:43,228 INFO  [org.jboss.as.server.deployment#start] JBAS015876: Starting deployment of "mysql-connector-java-5.1.20-bin.jar"

                                    18:36:43,388 INFO  [org.jboss.as.connector.deployers.jdbc#deploy] JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)

                                    18:36:43,558 INFO  [org.jboss.as.server#execute] JBAS018559: Deployed "mysql-connector-java-5.1.20-bin.jar"

                                     

                                    Creating the module as described in the article and removing the jar file from the deployments folder I see:

                                    18:50:03,627 INFO  [org.jboss.as.connector.subsystems.datasources#startDriverServices] JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)

                                     

                                    So when you start your clean JBoss (unmodified standalone.xml, no deployments, ...) with either the added module or the jar file in the deployments folder do you see success message like the one above?

                                     

                                    If yes, then proceed with step 2, add your datasource as described in the mentioned article to your standalone.xml.

                                    Do you see the "Bound data source" message then?

                                     

                                    Then add your TPGCommons.jar to the deployments folder. Deploying OK? Check server.log.

                                     

                                    If yes,  then add TPGApp.jar to the deployments folder.

                                    If you get the same error as before, (about the PU), then check the server.log file. There are additonal messages to help you, only the last lines is not enough to help.

                                    Add the whole server.log file as an attachment to your response. The links to the gif files your provided before where not accessible for me.

                                    1 2 Previous Next