Hibernate, weblogic 12c deployment error - java

I am trying to deploy a .war on weblogic 12c and I get the following error:
weblogic console error :
An error occurred during activation of changes, please see the log for details.
Error org.hibernate.HibernateException: Errors in named queries:
getAuditTaskById, getAllAuditTasksByUser, getAllAuditTasks
Error Substituted for missing class org.hibernate.HibernateException -
Errors in named queries: getAuditTaskById, getAllAuditTasksByUser, getAllAuditTasks
I have tried to filter class path by changing weblogic.xml :
<container-descriptor>
<!-- prefer-web-inf-classes>true</prefer-web-inf-classes-->
<prefer-web-inf-classes>false</prefer-web-inf-classes>
<prefer-application-packages>
<package-name>org.hibernate.*</package-name>
<package-name>org.apache.*</package-name>
<package-name>antlr.*</package-name>
</prefer-application-packages>
</container-descriptor>
I am using hinernate-commons-annotations-4.0.2.Final.jar, hibernate-core-4.2.12.Final.jar , hibernate-entitymanaget-4.2.12.Final.jar . Any suggestion will be appreciated.
Here is complete error log:
<Apr 22, 2015 3:29:19 PM IRDT> <Warning> <Deployer> <BEA-149004> <Failures were
detected while initiating deploy task for application "benefits40".>
<Apr 22, 2015 3:29:19 PM IRDT> <Warning> <Deployer> <BEA-149078> <Stack trace fo
r message 149004
weblogic.application.ModuleException: org.hibernate.HibernateException: Errors i
n named queries: getAuditTaskById, getAllAuditTasksByUser, getAllAuditTasks
at weblogic.application.internal.ExtensibleModuleWrapper.prepare(Extensi
bleModuleWrapper.java:114)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(Modu
leListenerInvoker.java:100)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleSta
teDriver.java:175)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleSta
teDriver.java:170)
at weblogic.application.utils.StateMachineDriver$ParallelChange.run(Stat
eMachineDriver.java:80)
Truncated. see log file for complete stacktrace
Caused By: org.hibernate.HibernateException: Errors in named queries: getAuditTa
skById, getAllAuditTasksByUser, getAllAuditTasks
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.j
ava:532)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1797)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactor
yImpl.java:96)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
figuration.java:914)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
figuration.java:899)
Truncated. see log file for complete stacktrace
>
<Apr 22, 2015 3:29:19 PM IRDT> <Error> <Console> <BEA-240003> <Administration Co
nsole encountered the following error: weblogic.application.ModuleException: org
.hibernate.HibernateException: Errors in named queries: getAuditTaskById, getAll
AuditTasksByUser, getAllAuditTasks
at weblogic.application.internal.ExtensibleModuleWrapper.prepare(Extensi
bleModuleWrapper.java:114)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(Modu
leListenerInvoker.java:100)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleSta
teDriver.java:175)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleSta
teDriver.java:170)
at weblogic.application.utils.StateMachineDriver$ParallelChange.run(Stat
eMachineDriver.java:80)
at weblogic.work.ContextWrap.run(ContextWrap.java:40)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTunin
gWorkManagerImpl.java:548)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Caused by: java.lang.Throwable: Substituted for missing class org.hibernate.Hibe
rnateException - Errors in named queries: getAuditTaskById, getAllAuditTasksByUs
er, getAllAuditTasks
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.j
ava:532)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1797)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactor
yImpl.java:96)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
figuration.java:914)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
figuration.java:899)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFa
ctory(HibernatePersistence.java:76)
at weblogic.persistence.BasePersistenceUnitInfo.initializeEntityManagerF
actory(BasePersistenceUnitInfo.java:461)
at weblogic.persistence.BasePersistenceUnitInfo.initializeEntityManagerF
actory(BasePersistenceUnitInfo.java:454)
at weblogic.persistence.BasePersistenceUnitInfo.init(BasePersistenceUnit
Info.java:141)
at weblogic.persistence.BaseJPAIntegrationProvider.createPersistenceUnit
Info(BaseJPAIntegrationProvider.java:54)
at weblogic.persistence.AbstractPersistenceUnitRegistry.storeDescriptors
(AbstractPersistenceUnitRegistry.java:423)
at weblogic.persistence.AbstractPersistenceUnitRegistry.loadPersistenceD
escriptors(AbstractPersistenceUnitRegistry.java:130)
at weblogic.persistence.ModulePersistenceUnitRegistry.<init>(ModulePersi
stenceUnitRegistry.java:61)
at weblogic.servlet.internal.WebAppInternalModuleExtension$PersistenceEx
tension.setupPersistenceUnitRegistry(WebAppInternalModuleExtension.java:267)
at weblogic.servlet.internal.WebAppInternalModuleExtension$PersistenceEx
tension.access$400(WebAppInternalModuleExtension.java:188)
at weblogic.servlet.internal.WebAppInternalModuleExtension.prePrepare(We
bAppInternalModuleExtension.java:58)
at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateCha
nge.next(ExtensibleModuleWrapper.java:293)
at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateCha
nge.next(ExtensibleModuleWrapper.java:285)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:42)
at weblogic.application.internal.ExtensibleModuleWrapper.prepare(Extensi
bleModuleWrapper.java:109)
>

As it says in the error:
Error org.hibernate.HibernateException: Errors in named queries:
getAuditTaskById, getAllAuditTasksByUser, getAllAuditTasks
You have error in the JPQL in your named queries defined on top of some of your entities. If you dont know where those queries are defined, simply search your code files for the getAuditTaskById, getAllAuditTasksByUser... text, and fix the queries.

Finally I figured it out. There was a problem with my persistence.xml file. I was using this:
<property name="hibernate.query.factory_class" value="org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory" />
This uses the old hql parser, which is for hibernate 2.1 (or some version like that) and older versions. For newer versions of hibernate core, you must use this:
<property name="hibernate.query.factory_class" value="org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory" />
Or do not write anything for this property, and by default, ASTQueryTranslatorFactory will be chosen. I was using hibernate core 4.2.x , and some jar files from jbpm 6 that use some queries that ClassicQueryTranslatorFactory was unable to pars.
Note that if you have to use ClassicQueryTranslatorFactory alongside newer versions of hibernate core, it is possible to config hibernate so that it use this version of hql parser.

Related

Delta XML- Dita compare getting Caught com.deltaxml.dita.FilterProcessingException

I am using deltaxml for some time and it is working fine. But for a specific dita topics , I am getting these warnings in the logs:
WARNING: Caught com.deltaxml.dita.FilterProcessingException: Exception thrown when attempting to run the ‘input-a/9-dxp-9-cals-table-checker.xsl’ step (source: ‘/dita-xsl/cals-tables/cals-table-checker.xsl’) whilst performing DCE[BEINGPROCESSED: file:/home/nxf36037/crrbcompareissue/trydirecttmp5/a-0-file-/regs/d ipflexcan3syn.dita, file:/home/nxf36037/crrbcompareissue/trydirecttmp5/b-0-file-/regs/d ipflexcan3syn.dita.bak, file:/home/nxf36037/crrbcompareissue/trydirecttmp5/b-0-file-/regs/d ipflexcan3syn.dita]
Feb 09, 2018 2:37:55 PM com.deltaxml.dita.ditabb ditaa
WARNING: Cannot find ids within file:/home/nxf36037/crrbcompareissue/trydirecttmp5/b-0-file-/regs/d ipflexcan3syn.dita Cause: java.io.FileNotFoundException: /home/nxf36037/crrbcompareissue/trydirecttmp5/b-0-file-/regs/dipfl excan3syn.dita (No such file or directory)
Feb 09, 2018 2:37:55 PM com.deltaxml.dita.ditaq ditaa
WARNING: Cannot prepare topics for comparison. Cause: com.deltaxml.util.href.ditab: Cannot construct target (concerning hrefs file:/home/nxf36037/crrbcompareissue/trydirecttmp5/b-0-file-/regs/d ipflexcan3syn.dita, file:/home/nxf36037/crrbcompareissue/trydirecttmp5/b-0-file-/regs/d ipflexcan3syn.dita.dxml-p1)
Feb 09, 2018 2:38:02 PM com.deltaxml.dita.ditaq ditaa
WARNING: Skipping topicref /home/nxf36037/crrbcompareissue/trydirecttmp5/b-0-file-/regs/dipfl excan3syn.dita. Cause: Cannot determine whether file:/home/nxf36037/crrbcompareissue/trydirecttmp5/b-0-file-/regs/d ipflexcan3syn.dita contains change.
I am not able to find the cause of this issue, I have tried almost all the arguments which I felt could be the cause.
The command line I am using is:
java -jar /pkg/deltaxml-dita-/2017.09.21/lib/deltaxml-dita.jar compare mts B1518165232953/dipflexcan3syn/specsource/maps/dipflexcan3synbg .ditamap B1518165232953/dipflexcan3syn/specsource/maps/dipflexcan3syn_bg .ditamap output-format=dita-markup map-result-structure=map-pair map-result-origin=B trydirecttmp5
I have also checked the dita files, they gets validated and there are no errors. Could you please help here?
The schematron code at: https://github.com/nigelwhitaker/cals-table-schematron can be used to detect and report, in a fairly user-friendly manner, table validation issues, either inside an editor or using the schematron skeleton.
As discussed with Mohit over in https://github.com/nigelwhitaker/cals-table-schematron/issues/4 it does however depend on XSLT 2.0 or 3.0 features and therefore is not suitable for all schematron systems.

.jspx page won't deploy on generic jDeveloper app

I am having this problem with deploying and running an empty .jspx page on weblogic server. I have a generic web application in which I want to add just a page to it in the ViewController. When I create this page and right click over it and then click over Run I get the following error:
[04:36:57 PM] Deploying Application...
<Sep 14, 2016 4:37:07 PM CEST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1473863817655' for task '4'. Error is: 'weblogic.application.ModuleException: Could not setup environment'
weblogic.application.ModuleException: Could not setup environment
at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:149 5)
at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:438)
at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:375)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:95)
Truncated. see log file for complete stacktrace
Caused By: weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'ejb_submit_batch.jar#PTBatchSessionEJB' declared in the ejb-ref or ejb-local-ref 'ejb/PTBatchSessionEJB' in the application module 'ViewControllerWebApp.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.
at weblogic.deployment.BaseEnvironmentBuilder.addEJBLinkRef(BaseEnvironmentBuilder.java:464)
at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:496)
at weblogic.servlet.internal.CompEnv.activate(CompEnv.java:157)
at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:3144)
at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1493)
Truncated. see log file for complete stacktrace
Truncated. see log file for complete stacktrace
Caused By: weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'ejb_submit_batch.jar#PTBatchSessionEJB' declared in the ejb-ref or ejb-local-ref 'ejb/PTBatchSessionEJB' in the application module 'ViewControllerWebApp.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.
at weblogic.deployment.BaseEnvironmentBuilder.addEJBLinkRef(BaseEnvironmentBuilder.java:464)
at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:496)
at weblogic.servlet.internal.CompEnv.activate(CompEnv.java:157)
at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:3144)
at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1493)
Truncated. see log file for complete stacktrace
I really don't know how to resolve this problem due to the fact that I am working on it for 3 days. Any suggestion to resolve. I am available to provide you will all required files and logs.
Thanks in advance.
UPDATE
I should mention that if I comment this part in my web.xml the page launches perfectly ! But if I delete the commented part the error above appears.
<!--<ejb-local-ref>
<ejb-ref-name>ejb/PTBatchSessionEJB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>it.enigen.pt.batch.submit.ejb.PTBatchSessionEJBLocal</local>
<ejb-link>ejb_submit_batch.jar#PTBatchSessionEJB</ejb-link>
</ejb-local-ref>-->

What are the __pm and __nontx suffixes?

My java EE application is giving following error when i try to run the application on glassfish server. It says "Invalid resource : jdbc/busservice__nontx". Where should i look to fix this error? Previously it was giving error with "jdbc/busservice__pm". Once I created JDBC resource and connected with connection pool, error disappeared. However i'm still getting error with "jdbc/busservice__nontx"
Info: PER02100: Could not load Toplink Essentials. Assuming this is an upgrade from V2. Switching Persistence Unit [BusReservationPU] to use [org.eclipse.persistence.jpa.PersistenceProvider] as JPA provider. If you intend to use Toplink Essentials, please ensure that it is visible to your application."
Severe: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
Severe: java.lang.RuntimeException: Invalid resource : jdbc/busservice__nontx
at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:593)
at com.sun.enterprise.connectors.ConnectorRuntime.lookupNonTxResource(ConnectorRuntime.java:559)
at org.glassfish.persistence.common.PersistenceHelper.lookupNonTxResource(PersistenceHelper.java:59)
at org.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupNonTxDataSource(ProviderContainerContractInfoBase.java:76)
at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:109)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:142)
Do not add "jdbc/busservice__pm" to your Glassfish JDBC Resources, just add it as "jdbc/busservice". It looks like the __pm and __nontx are some internal names that it adds to the end of your jdbc name internally, and when you specifically add it will mess it up and throw that error.

Google App Engine Task Queue not working with eclipse plugin: org.quartz.SchedulerConfigException: Unable to instantiate class load helper class

I am trying to implement GAE Task queue with Spring. But I am receiving the following error when I run the queue implementation.
Error
INFO: Successfully processed C:\Users\388638\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3\PubSub\WEB-INF/queue.xml
Apr 14, 2014 12:14:11 PM com.google.appengine.api.taskqueue.dev.LocalTaskQueue init
INFO: LocalTaskQueue is initialized
Apr 14, 2014 12:14:11 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
SEVERE: javax.servlet.ServletContext log: unavailable
java.lang.RuntimeException: org.quartz.SchedulerConfigException: Unable to instantiate class load helper class: org.quartz.simpl.CascadingClassLoadHelper cannot be cast to org.quartz.spi.ClassLoadHelper [See nested exception: java.lang.ClassCastException: org.quartz.simpl.CascadingClassLoadHelper cannot be cast to org.quartz.spi.ClassLoadHelper]
at com.google.appengine.api.taskqueue.dev.LocalTaskQueue.startScheduler(LocalTaskQueue.java:645)
at com.google.appengine.api.taskqueue.dev.LocalTaskQueue.start_(LocalTaskQueue.java:240)
at com.google.appengine.api.taskqueue.dev.LocalTaskQueue.access$000(LocalTaskQueue.java:66)
at com.google.appengine.api.taskqueue.dev.LocalTaskQueue$2.run(LocalTaskQueue.java:207)
at java.security.AccessController.doPrivileged(Native Method)
at com.google.appengine.api.taskqueue.dev.LocalTaskQueue.start(LocalTaskQueue.java:204)
at com.google.appengine.tools.development.ApiProxyLocalImpl.startServices(ApiProxyLocalImpl.java:604)
Queue Code
#RequestMapping("/subscribequeue")
public String subscribeUser(#ModelAttribute TestUser tuser, Model model)
{
String useremail=tuser.getEmail();
System.out.println("User's email "+ useremail);
Queue queue = QueueFactory.getQueue("subscription-queue");
queue.add(TaskOptions.Builder.withUrl("/sendusermail").param("emailid",useremail));
return "redirect:confirm";
}
I am using the Google App Engine Eclipse plugin. So all the app engine jars are added by default. I am not using Maven. App engine sdk version 1.9
The screenshot for jars
Referred this SO post
but I don't see appengine-api-stubs.jar and appengine-testing-.jar in the classpath. Besides the appengine needs all the jars at runtime. It doesn't let delete any of the jars.
I tried removing the appengine-api-labs.jar and running but it doesn't work.
Can anyone please provide any help on this? How do I get rid of the error?

Ebean does not find Entities after creating JAR

The problem is that in Eclipse-IDE every test with Ebean related methods works fine, but when you compile a jar-File to use it e.g. on a Homepage, or on command prompt, i only get this
Jul 10, 2012 4:25:48 PM com.avaje.ebeaninternal.server.util.ClassPathSearch find
Classes
Warnung: No Entities found in ClassPath using ClassPathReader [com.avaje.ebeanin
ternal.server.util.DefaultClassPathReader#6c08bae7] Classpath Searched[[file:/C:
/xampp/htdocs/webp3/jars/DPG.jar]]
Jul 10, 2012 4:25:48 PM com.avaje.ebeaninternal.server.core.BootupClassPathSearc
h search
Information: Classpath search hits in jars[] pkgs[] searchTime[27]
Jul 10, 2012 4:25:48 PM com.avaje.ebeaninternal.server.lib.sql.DataSourcePool in
itialise
Information: DataSourcePool [mysql] autoCommit[false] transIsolation[READ_COMMIT
TED] min[1] max[25]
Jul 10, 2012 4:25:48 PM com.avaje.ebeaninternal.server.core.DefaultServerFactory
setDatabasePlatform
Information: DatabasePlatform name:mysql platform:mysql
Jul 10, 2012 4:25:48 PM com.avaje.ebeaninternal.server.subclass.SubClassManager$
1 run
Information: SubClassFactory parent ClassLoader [sun.misc.Launcher$AppClassLoade
r]
Jul 10, 2012 4:25:48 PM com.avaje.ebeaninternal.server.deploy.BeanDescriptorMana
ger logStatus
Information: Entities enhanced[0] subclassed[0]
Exception in thread "main" javax.persistence.PersistenceException: com.dpu.entit
ies.Department is NOT an Entity Bean registered with this server?
at com.avaje.ebeaninternal.server.core.DefaultServer.createQuery(Default
Server.java:1008)
at com.avaje.ebeaninternal.server.core.DefaultServer.createQuery(Default
Server.java:965)
at com.avaje.ebeaninternal.server.core.DefaultServer.find(DefaultServer.
java:1001)
at com.avaje.ebean.Ebean.find(Ebean.java:1143)
at com.dpu.data.Datagenerator.generateData(Datagenerator.java:26)
at com.dpu.main.MainGenerator.main(MainGenerator.java:23)
I tried many "solutions" on google like editing the Classpath, but everything seems to be fine regarding on the log.
My JAR-Manifest contains this:
Manifest-Version: 1.0
Main-Class: com.dpu.main.MainGenerator
Class-Path: .
Does someone know how to solve this silly problem? I tried everything this day and it's just annoying
Alternatively to user1537597's answer you can add
# specify jars to search for entity beans
ebean.search.jars=myJarFile.jar
to the ebean.properties file, if you don't use the programmatic configuration.
You can also add the following to ebean.properties
ebean.packages=com.packagename
Same here.
The only way is to extract the jar and run the java main class. You need to put the ebean.properties file in the root of your project too.
e.g.:
jar xf project.jar
cp /my_project_root/ebean.properties project
cd project
java Project
not it depends on the fact that you need to specify in the ebean.properties to look for entities in the jar. I'm looking how to do it from the property file. Now I only found with the programmatic configuration.
config.addJar("nameFile.jar")
I managed to solve this by using a programmatic configuration and adding every entity class manually like this:
serverConfig.addClass(Entity.class);
The advantage of this approach compared to ebean.search.jars=yourJar.jar is that if the jar file name changes, it will still work.

Categories