-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: weblogic HibernateException "Errors in named queries"
PostPosted: Thu Aug 27, 2009 4:44 pm 
Newbie

Joined: Thu Aug 27, 2009 1:26 pm
Posts: 1
hi
im trying to deploy an application in a wls 10.3 server, using the hibernate version: hibernate-core-3.3.1.GA (and related)
ive allready deployed it in a tomcat server and it worked great! also tried to replace the hibernate library with the last one available, but the same problem occurs every time.
any suggestion is welcome.
(need more info? just let me know...)

the HibernateException goes like this:
Code:
HTTP:101216]Servlet: "BeanFactoryServlet" failed to preload on startup in Web application: "myApp". org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'HibernateSessionFactory' defined in URL [zip:C:/bea/user_projects/domains/myApp/servers/AdminServer/tmp/_WL_user/myAppEAR/3mlg1w/war/WEB-INF/lib/_wl_cls_gen.jar!/hibernate-config.xml]: Initialization of bean failed; [b]nested exception is org.hibernate.HibernateException: Errors in named queries[/b]: qryGetMyData org.hibernate.HibernateException: Errors in named queries: qryGetMyData at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:397) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:825) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:751) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1091) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:396) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:277) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:313) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:87) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:72) at cl.altiuz.servlet.BeanFactoryServlet.init(BeanFactoryServlet.java:37) at javax.servlet.GenericServlet.init(GenericServlet.java:241) at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(Unknown Source) at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64) at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58) at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48) at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:521) at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1893) at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1870) at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1790) at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2999) at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1371) at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:468) at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37) at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60) at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200) at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117) at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37) at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60) at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27) at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37) at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212) at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:16) at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:162) at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:140) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:106) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323) at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:820) at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1227) at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:436) at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:181) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:12) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:67) at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201) at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

Code:
[b]Substituted for missing class org.hibernate.HibernateException - Errors in named queries: qryGetMyData [/b]


thanks!


Top
 Profile  
 
 Post subject: Re: weblogic HibernateException "Errors in named queries"
PostPosted: Wed Sep 30, 2009 8:42 pm 
Newbie

Joined: Sun Feb 08, 2009 10:05 pm
Posts: 11
I'm having the same problem...my code works fine on Glassfish with the latest Hibernate Entity Manager installed.

Weblogic gives me the same errors:

org.hibernate.HibernateException: Errors in named queries: getPointsByCloudId, getAvailablePointsByFilteredMission, getAvailablePointsByCloudId, getAllPoints, getMissionDataByFilter, getAvailablePoints, getMissionDataByCloudId, getAllMissionData
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:397)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:343)
at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:323)
at weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:125)
at weblogic.deployment.AbstractPersistenceUnitRegistry.storeDescriptors(AbstractPersistenceUnitRegistry.java:336)
at weblogic.deployment.AbstractPersistenceUnitRegistry.loadPersistenceDescriptors(AbstractPersistenceUnitRegistry.java:111)
at weblogic.deployment.ModulePersistenceUnitRegistry.<init>(ModulePersistenceUnitRegistry.java:58)
at weblogic.servlet.internal.WebAppModule.setupPersistenceUnitRegistry(WebAppModule.java:1661)
at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:364)


Top
 Profile  
 
 Post subject: Re: weblogic HibernateException "Errors in named queries"
PostPosted: Thu Oct 08, 2009 5:47 pm 
Regular
Regular

Joined: Mon Aug 22, 2005 1:11 pm
Posts: 50
Location: Pasadena, CA
I am getting the same error, has anyone solved this yet?

Thanks,
Mike


Top
 Profile  
 
 Post subject: Re: weblogic HibernateException "Errors in named queries"
PostPosted: Thu Oct 08, 2009 6:19 pm 
Newbie

Joined: Sun Feb 08, 2009 10:05 pm
Posts: 11
Yes. I solved this. The problem is that Weblogic 10.3.x already depends on ANTLR 2.7.7.

Hibernate EntityManager 3.4.0.GA depends on ANTLR 2.7.6 which is not loaded by the classloader.

Hibernate3 uses the ANTLR libraries to parse NamedQueries and thus this error.

I changed my persistence.xml by adding this property: <property name="hibernate.query.factory_class" value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory" />

to use the classic query parser from Hibernate instead of the ANTLR based one.


Top
 Profile  
 
 Post subject: Re: weblogic HibernateException "Errors in named queries"
PostPosted: Thu Oct 08, 2009 9:01 pm 
Regular
Regular

Joined: Mon Aug 22, 2005 1:11 pm
Posts: 50
Location: Pasadena, CA
Thanks for the quick response.

I tried changing that property but that does not work for me since we have some delete queries as named queries.

Is there another way to resolve the class loader conflict?

Thanks,
Mike


Top
 Profile  
 
 Post subject: Re: weblogic HibernateException "Errors in named queries"
PostPosted: Fri Oct 09, 2009 2:58 pm 
Regular
Regular

Joined: Mon Aug 22, 2005 1:11 pm
Posts: 50
Location: Pasadena, CA
So I tired changing the dependency in hibernate from 2.6.7 to 2.7.7 this seems to work fine in tomcat but still errors in web logic.

Any help would greatly appreciated.

Thanks,
Mike


Top
 Profile  
 
 Post subject: Re: weblogic HibernateException "Errors in named queries"
PostPosted: Fri Oct 09, 2009 3:02 pm 
Newbie

Joined: Sun Feb 08, 2009 10:05 pm
Posts: 11
Sorry Mike, I haven't tried DELETE Queries as named queries...only SELECTs.


Top
 Profile  
 
 Post subject: Re: weblogic HibernateException "Errors in named queries"
PostPosted: Fri Oct 09, 2009 4:14 pm 
Regular
Regular

Joined: Mon Aug 22, 2005 1:11 pm
Posts: 50
Location: Pasadena, CA
ronak2121 wrote:
Sorry Mike, I haven't tried DELETE Queries as named queries...only SELECTs.


Thanks!


Top
 Profile  
 
 Post subject: Re: weblogic HibernateException "Errors in named queries"
PostPosted: Wed Oct 14, 2009 12:55 pm 
Regular
Regular

Joined: Mon Aug 22, 2005 1:11 pm
Posts: 50
Location: Pasadena, CA
So I finally got this figured out.

I needed to add a weblogic.xml under my WEB-INF directory that contains this:

Code:
<?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>


All that does is set on flag so that the web inf classes are used over any others. Making weblogic behave more tomcat like.

Thanks everyone for their help.

-Mike


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.