From jboss/java1.6 to wildfly20/java1.8

Viewed 53

sorry for long post

i have a web application made in java 1.6.0, jsf, richfaces3.3.3 and hibernate 3 ( DB oracle )

hibernate mapping made through *.hbm.xml files, and datasource configured on hibernate-service.xml

<?xml version="1.0" encoding="UTF-8"?>
<server>
    <mbean code="org.jboss.hibernate.jmx.Hibernate"
           name="jboss.har:service=HibernateFlowManager">
        <!-- Datasource settings -->
        <attribute name="SessionFactoryName">java:/hibernate/HibernateFlowManagerFactory</attribute>        
        <attribute name="DatasourceName">java:OracleDS</attribute>
        <attribute name="Dialect">org.hibernate.dialect.Oracle9iDialect</attribute>
        <!-- Second-level caching -->
        <attribute name="SecondLevelCacheEnabled">false</attribute>
        <attribute name="QueryCacheEnabled">false</attribute> 
        <attribute name="ReflectionOptimizationEnabled">true</attribute>
        <!-- Batching -->
        <attribute name="JdbcBatchSize">50</attribute>
        <!-- Logging  -->
        <attribute name="ShowSqlEnabled">false</attribute>
    </mbean>
</server>

i have an HibernateUtils class with sessionFactory

sessionFactory  = (SessionFactory)new InitialContext().lookup("java:/hibernate/HibernateFlowManagerFactory");

all packed in app.ear and deployed into jboss 4.2.3.GA

the goal is use the app with java 1.8.0 and use wildfly 20

i installed wildfly 20 and configured a oracle datasource OracleDS and test is ok

i tried to deploy app.ear but i have the exception

20:26:18,094 ERROR [org.jboss.as.server] (management-handler-thread Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class myapp.appl.beans.MgrValidatorBean with ClassLoader ModuleClassLoader for Module \"deployment.app.ear.app.jar\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: org/hibernate/Query
    Caused by: java.lang.ClassNotFoundException: org.hibernate.Query from [Module \"deployment.app.ear.app.jar\" from Service Module Loader]",
        "jboss.deployment.subunit.\"app.ear\".\"app.war\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment \"app.war\" of deployment \"app.ear\"
    Caused by: java.lang.NoClassDefFoundError: org/hibernate/Session

i don't want to change hibernate in the app so i builded app.ear and in META-INF folder i put file jboss-deployment-structure.xml like this

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
  <!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->
  <ear-subdeployments-isolated>true</ear-subdeployments-isolated>
  <!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->
  <!-- This is the top level ear module, which contains all the classes in the EAR's lib folder     -->
  <deployment>
     <!-- exclude-subsystem prevents a subsystems deployment unit processors running on a deployment -->
     <!-- which gives basically the same effect as removing the subsystem, but it only affects single deployment -->
     <exclude-subsystems>
        <subsystem name="org.hibernate" />
        <subsystem name="org.hibernate.validator" />
    </exclude-subsystems>
    <!-- Exclusions allow you to prevent the server from automatically adding some dependencies     -->
    <exclusions>
        <module name="org.hibernate" />
        <module name="org.hibernate.validator" />
    </exclusions>
  </deployment>
</jboss-deployment-structure>

deploy and different exception

20:29:20,671 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) WFLYCTL0013: Operation ("deploy") failed - address: ({"deployment" => "app.ear"}) - failure description: {
    "WFLYCTL0080: Failed services" => {
        "jboss.deployment.subunit.\"app.ear\".\"app.jar\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment \"app.jar\" of deployment \"app.ear\"
    Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class myapp.appl.beans.MgrValidatorBean with ClassLoader ModuleClassLoader for Module \"deployment.app.ear.app.jar\" from Service Module Loader
    Caused by: java.lang.NoClassDefFoundError: org/hibernate/Query
    Caused by: java.lang.ClassNotFoundException: org.hibernate.Query from [Module \"deployment.app.ear.app.jar\" from Service Module Loader]",

what approach i can use to achieve my goal ?

0 Answers
Related