This discussion is archived
10 Replies Latest reply: Jan 30, 2013 9:07 AM by 935795 RSS

weblogic javaee6 hibernate3.2

935795 Newbie
Currently Being Moderated
Hello,

My application j2ee1.4+jdk6+hibernate3.2 in IBM Websphere7 works beautiful.

If I move javaee6+jdk6+hibernate3.2 in Weblogic 12c, I get errors in hibernate.

Initial SessionFactory creation failed:Errors in named queries: TestOutcome.getCryptoTestDescriptions
org.hibernate.HibernateException: Errors in named queries: TestOutcome.getCryptoTestDescriptions
     at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:365)
     at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)

I did one experiment of moving to hibernate 3.6 and the error was little detailed and complained my named query had an unknown alias. I reverted back to hibernate3.2, as upversioning did not solve te problem

What could have caused the problem?
Have you been successful in running hiberate3.2 with weblogic 12c?

Your help will be very useful.

Thanks.
  • 1. Re: weblogic javaee6 hibernate3.2
    935795 Newbie
    Currently Being Moderated
    Hello,

    With no answers, I assume the answer should be trivial.
    I have a thought that the problem could be to do with confusion of dependency jars of Hibernate and those present in weblogic. Most of us would have used hibernate in weblogic. Did you do anything special to get this work?

    Regards,
    Raj
  • 2. Re: weblogic javaee6 hibernate3.2
    Kalyan Pasupuleti-Oracle Expert
    Currently Being Moderated
    Hi Raj,

    Provide me complete error stack from your server logs.

    Regards,
    kal
  • 3. Re: weblogic javaee6 hibernate3.2
    935795 Newbie
    Currently Being Moderated
    Thanks a ton for responding.

    The error trace is long.
    Initial SessionFactory creation failed:Errors in named queries: TestOutcome.getCryptoTestDescriptions, TestOutcome.getAtcTestDescriptions, TestOutcome.getTvrTestDescriptions, TestOutcome.getAtcDiffTestDescriptions, TestOutcome.getCvrTestDescriptions, TestOutcome.getRiskRangeDescriptions
    org.hibernate.HibernateException: Errors in named queries: TestOutcome.getCryptoTestDescriptions, TestOutcome.getAtcTestDescriptions, TestOutcome.getTvrTestDescriptions, TestOutcome.getAtcDiffTestDescriptions, TestOutcome.getCvrTestDescriptions, TestOutcome.getRiskRangeDescriptions
         at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:365)
         at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
         at com.XXXsolutions.common.dao.PerATSessionManager.getSessionFactory(PerATSessionManager.java:108)
         at com.XXXsolutions.common.dao.PerATSessionManager.getPerATSession(PerATSessionManager.java:280)
         at com.XXXsolutions.trxe.configuration.TRxEConfiguration.reload(TRxEConfiguration.java:61)
         at com.XXXsolutions.trxe.configuration.TRxEConfiguration.<init>(TRxEConfiguration.java:51)
         at com.XXXsolutions.trxe.configuration.TRxEConfiguration.getInstance(TRxEConfiguration.java:41)
         at com.XXXsolutions.trxe.components.AbstractTRxEComponent.startup(AbstractTRxEComponent.java:51)
         at com.XXXsolutions.stp.manager.STPManager.start(STPManager.java:291)
         at com.XXXsolutions.stp.manager.web.STPManagerServlet.startupSTP(STPManagerServlet.java:59)
         at com.XXXsolutions.stp.manager.web.STPManagerServlet.init(STPManagerServlet.java:114)
         at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:299)
         at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:250)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
         at weblogic.servlet.internal.StubSecurityHelper.initServletInstance(StubSecurityHelper.java:94)
         at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:82)
         at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:74)
         at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:60)
         at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:34)
         at weblogic.servlet.internal.ServletStubImpl.initStubLifecycleHelper(ServletStubImpl.java:624)
         at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:565)
         at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1874)
         at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1848)
         at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1738)
         at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2740)
         at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1704)
         at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:781)
         at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:213)
         at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:208)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
         at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:70)
         at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:212)
         at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:111)
         at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
         at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:213)
         at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:208)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
         at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:70)
         at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:24)
         at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:729)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
         at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258)
         at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:61)
         at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
         at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
         at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:192)
         at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:369)
         at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
         at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
         at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
         at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
         at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
         at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
         at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:186)
         at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:94)
         at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

    I believed the problem is to do with hibernate dependencies and weblogic jars. So I altered the weblogic-application.xml as follows. I wanted the classloader to prefer to use the hibernate's dependent jars over weblogic's. But that did not make any difference to the error.

    <?xml version="1.0" encoding="UTF-8"?>
    <weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
    <application-param>
    <param-name>webapp.encoding.default</param-name>
    <param-value>UTF-8</param-value>
    </application-param>
    <prefer-application-packages>
    <package-name>antlr.*</package-name> <!-- antlr 2.7.6 required -->
              <package-name>org.objectweb.*</package-name> <!-- asm 1.5.3 required/Mandatory but 2.2.3 is present in jars-->
              <package-name>com.mchange.*</package-name> <!-- c3p0 0.9.1 UNKNOWN Optional -->
              <package-name>net.sf.cglib.*</package-name> <!-- cglib 2.1.3 -->
              <package-name>org.apache.commons.collections.*</package-name> <!-- commons-collections 2.11, but 3.1 is present in jars -->
              <package-name>org.apache.commons.logging.*</package-name> <!-- commons-logging 1.0.4 -->
              <package-name>org.dom4j.*</package-name> <!-- dom4j 1.6.1 -->
              <package-name>javax.transaction.*</package-name> <!-- jta 1.0.1b -->
              <package-name>org.jboss.cache.*</package-name> <!-- jboss-cache 1.2.2 UNKNOWN optional -->
              <package-name>org.jgroups.*</package-name> <!-- jgroups-all 2.2.8 UNKNOWN optional -->
              <package-name>net.sf.ehcache.*</package-name> <!-- net.sf.ehcache 1.2.3 UNKNOWN MANDATORY-->
              <package-name>com.opensymphony.oscache.*</package-name> <!-- oscache 2.1 UNKNOWN optional-->
              <package-name>org.logicalcobwebs.*</package-name> <!-- proxool 0.8.3 UNKNOWN optional-->
              <package-name>net.sf.swarmcache.*</package-name> <!-- swarmcache 1.0RC2 UNKNOWN optional -->
    </prefer-application-packages>
         <classloader-structure>
              <classloader-structure>
                   <module-ref>
                        <module-uri>XXX-stp-web.war</module-uri>
                   </module-ref>
              </classloader-structure>
              <classloader-structure>
                   <module-ref>
                        <module-uri>trxe-web.war</module-uri>
                   </module-ref>
              </classloader-structure>
              <classloader-structure>
                   <module-ref>
                        <module-uri>XXX-espmanager-web.war</module-uri>
                   </module-ref>
              </classloader-structure>
              <classloader-structure>
                   <module-ref>
                        <module-uri>aks-web.war</module-uri>
                   </module-ref>
              </classloader-structure>
         </classloader-structure>     
    </weblogic-application>
  • 4. Re: weblogic javaee6 hibernate3.2
    Kalyan Pasupuleti-Oracle Expert
    Currently Being Moderated
    Hi,

    Try this option once and let me know.


    add below line to the file persistence.xml -

    <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />

    Sample snippets of persistence.xml -

    <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" xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="customerManager" transaction-type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>sample</jta-data-source>
    <properties>
    <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />
    <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
    </properties>
    </persistence-unit>
    </persistence>



    Regards,
    Kal
  • 5. Re: weblogic javaee6 hibernate3.2
    935795 Newbie
    Currently Being Moderated
    Hi Kal,

    The named queries referred in the error are eccentric. I realized it when I upversioned hibernate. Although the error trace above remains with hibernate 3.2.5.ga. These queries can also be a problem, but I don't have a proper justification, because this works well with Websphere.

    I will paste one of the Named query here. The complaint was that 'Crypto Test for ' was an invalid alias.
    <query name="TestOutcome.getCryptoTestDescriptions">
    select 'Crypto Test for ' ||
    rp.cardGroupSupportedTypes.cardGroup.name || ' ' ||
    rp.responseProfileType.longDesc || ' for ' ||
    rp.cardGroupSupportedTypes.cardType.name || ' cards'
    from ResponseProfile rp
    where rp.cryptoCheckTestOutcome = :OUTCOME_ID
    </query>

    As I mentioned, there is no problem with this query in Websphere. Weblogic complains. The error of alias is only with hibernate 3.6.7.Final and the error in 3.2.5.ga gives a weblogic error. I connected the error from 3.6.7 and 3.2.5.ga to guess the cause of the problem to be same named query. I may be wrong.

    Regards,
    Raj
  • 6. Re: weblogic javaee6 hibernate3.2
    935795 Newbie
    Currently Being Moderated
    The error remains same. I have entered the line as below in the hibernate configuration file. There are four similar hibernate configuration files inside four different jars. I have pasted one of the configuration file.

    <hibernate-configuration>
    <session-factory>
    <!-- Database connection settings -->
    <!-- Turn off JDBC3/jdk1.4 generated keys feature while we're still using older non-compliant data direct driver -->
    <property name="hibernate.jdbc.use_get_generated_keys">false</property>
    <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
    <!-- Echo all executed SQL to stdout -->
    <property name="show_sql">true</property>
    <!-- Disable the second-level cache -->
    <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
    <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
    <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.WeblogicTransactionManagerLookup </property>
    <!-- Mappings -->
    <mapping resource="AKS_KEY_CARD_GROUPS.hbm.xml"/>
    <mapping resource="AKS_KEY_CARD_GROUP_PANS.hbm.xml"/>
    </session-factory>
    </hibernate-configuration>

    FYI. Another difference between websphere deployment and weblogic deployment is all the libraries (including the ones containing hibernate config files) were present only once in the ear in the root. When I migrated to JavaEE6 (because weblogic 12c does not support j2ee1.4), i copied all the jars to every web-inf\lib. You had mentioned in another thread to use <library-ref> for common jars. I did not do that because most of them with hibernate config had dependencies in all the four wars. I may be stupid. But can this be the cause of the error?
  • 7. Re: weblogic javaee6 hibernate3.2
    935795 Newbie
    Currently Being Moderated
    hi Kal,

    I believe I have been in the wrong direction. I sense that this problem is simple and is to do with hibernate and antlr only.
    I have made the changes you have suggested in another threard - using ear/meta-inf/weblogic-application.xml and ear/warN/web-inf/weblogic.xml.
    The error continues to be same in spite of the changes.

    The weblogic-application.xml content is
    <?xml version="1.0" encoding="UTF-8"?>
    <weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
    <application-param>
    <param-name>webapp.encoding.default</param-name>
    <param-value>UTF-8</param-value>
    </application-param>
    <prefer-application-packages>
    <package-name>antlr.*</package-name>
              <package-name>org.hibernate.*</package-name>
              <package-name>org.apache.log4j.*</package-name>
              <package-name>org.apache.xalan.*</package-name>
    </prefer-application-packages>
    </weblogic-application>

    The weblogic.xml is present in every war is
    <?xml version="1.0" encoding="UTF-8"?>
    <weblogic-web-app
    xmlns="http://www.bea.com/ns/weblogic/90"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic- web-app.xsd">
    <container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
    </weblogic-web-app>

    Do you please if there is any error here? Is there a way to find if I am still using the antlr of weblogic?

    Thanks
  • 8. Re: weblogic javaee6 hibernate3.2
    935795 Newbie
    Currently Being Moderated
    Hi Kal,
    Do I have to correct or do anything in the classpath variable of Manifest.mf?
    Regards,
    Raj
  • 9. Re: weblogic javaee6 hibernate3.2
    935795 Newbie
    Currently Being Moderated
    Hello Kal, Jeets.
    Many Thanks for your support.
    I have come out of the trouble by commenting the problematic named queries. It is a mystery why those queries caused problems. I am planning to rewrite them using hsql or may be sql.
    But your support was useful.
    Regards,
    Raj
  • 10. Re: weblogic javaee6 hibernate3.2
    935795 Newbie
    Currently Being Moderated
    Not sure why the Named queries did not work. But I have solved the classloading problems using the solution presented in this thread.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points