Did you enlist the classes in persistence.xml? Please try to enlist all of them as <class> items and also please add <exclude-unlisted-classes>true</exclude-unlisted-classes> to your persistence.xml. Worth a try. Without a sample project we can just try to narrow down the problematic zone.
Reason I'm asking is that the 'auto-pickup' is per JPA spec only working for the 'persistence root' of a project. Means the very same JAR where persistence.xml and all the entities are located in. For example if you have some of the entities in another jar then the entity auto-detection is not portably guaranteed to work anymore. And I have not much clue how that is supposed to work in OSGi environments like Apache Camel (JBoss Fuse is more or less just a pre-packaged distribution of Apache Camel afaik). Fortunately we have a few Camel folks around here, maybe this sounds familiar to one of them? txs and LieGrue, strub > On Monday, 16 May 2016, 9:11, Senthil Kumar Sekar > <senthilkum...@virtusapolaris.com> wrote: > > > Hi Strub, > We have multiple bundles deployed in which dao is a > separate > bundle and the entities are not duplicated. > > xx-ds --> dao bundle > xx depends on xx-ds > > Thanks. > > Regards > Senthil Kumar Sekar > ________________________________________ > > From: Loganathan, Senthil <senthil.loganat...@sc.com> > Sent: Thursday, May 12, 2016 12:13 PM > To: Mark Struberg; users@openjpa.apache.org; Senthil Kumar Sekar > Cc: openjpa-dev > Subject: RE: Open JPA Entity Loading issue due to failure in Enhancing at run > time. > > Hi Strub, > > We have the entities listed in one bundle and is part of single jar file. > Thanks. > > -----Original Message----- > From: Mark Struberg [mailto:strub...@yahoo.de] > Sent: Thursday, May 12, 2016 2:23 PM > To: users@openjpa.apache.org > Cc: openjpa-dev; Loganathan, Senthil > Subject: Re: Open JPA Entity Loading issue due to failure in Enhancing at run > time. > > Do you have the same entities in multiple EARs or WARs on the same server? > I got similar sounding issues on servers which did not properly isolate the > JPA > Metadata caches between different apps. > Trying to understand your exact scenario is imo the first step. > > LieGrue, > strub > > >> Am 12.05.2016 um 05:09 schrieb Senthil Kumar Sekar > <senthilkum...@virtusapolaris.com>: >> >> >> >> Hello Team, >> We have been using openjpa - 2.4.0 for our application data > access layer which will be deployed in Jboss Fuse 6.2.1. >> We have persistence xml where all the entities are declared. >> >> Very Frequently that we are facing the below issue and had to restart the > container multiple to get the issue resolved. >> >> java.lang.reflect.UndeclaredThrowableException >> at com.sun.proxy.$Proxy29.createQuery(Unknown Source) >> at > com.mysema.query.jpa.impl.AbstractJPAQuery.createQuery(AbstractJPAQuery.java:127)[744:com.mysema.querydsl.jpa:3.6.3] >> ................ >> Caused by: java.lang.reflect.UndeclaredThrowableException >> at com.sun.proxy.$Proxy103.createQuery(Unknown Source) >> ... 67 more >> Caused by: java.lang.reflect.InvocationTargetException >> at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source) >> at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_79] >> at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_79] >> at > org.apache.aries.jpa.container.impl.EntityManagerProxyFactory$EMHandler.invoke(EntityManagerProxyFactory.java:31) >> ... 68 more >> Caused by: <openjpa-2.4.0-r422266:1674604 nonfatal user error> >> org.apache.openjpa.persistence.ArgumentException: An error occurred >> while parsing the query filter "select cETAssignmentException_ from > CETAssignmentException cETAssignmentException_ where > lower(cETAssignmentException_.id.officeCode) = ?1 and > lower(cETAssignmentException_.id.businessSegmentCode) = ?2". Error message: > The name "CETAssignmentException" is not a recognized entity or > identifier. Perhaps you meant CDDCaseLocation, which is a close match. Known > entity names: [IndividualReferencesAsu, RmaExcllist, > WbSanctionsQuestionnaire, > IndividualAsu, SpeDocumentsChecklist, Property, MvSciClientGrpInfo, > CddAdditionalDetails, CopiFatcaSubownersInfo, DocumentTemplate, > ClientBranchOffices, RoccoDecisionReportPK, CddCaseActorsPK, DdCase, > ClientIndividualReln, EcddSciCasePublish, ForeignExchange, CaseDetail, > CopiFatcaTaxInfo, NorkomTxn, CopiFatcaDocument, ClientGroup, > ClientIndividual, > OpaScreen, Country, MvSciClientInfo, IndividualNorkom, CddRisks, > IndividualNorkomAsu, ClientOfficeProducts, CddCaseAuditPK, AtfFieldsMaster, > CddDdrBasedRouting, PreScreening, CddCasePK, MvSciClientOrgInfo, > WorkflowState, > RoccoRequest, RoccoRequestAuditPK, Risks, MvSciClientAddrInfo, > GaProductTransaction, ClientDocuments, Bba, ClientBranch, ClientNorkomPK, > ClientISIC, MvSciArmCodeInfo, DDCCountries, Client, GroupNorkom, > IndividualClientReln, Ga, OPARuleBases, CDDWorkflowState, SubReasonCodes, > MoneyMarket, OpaError, DefenceGoodsStatus, CDDStateMachine, > LegalConstitution, > ReasonCodes, RoccoRequestAudit, Address, BranchNorkom, FiDocumentsChecklist, > CopiFatcaStatusInfo, CddCase, Cdd, CddPepSummary, Bonds, > BbaDocumentsChecklist, > ClientOffice, CDDCaseLocation, MvSciEmpInfo, GaDocumentChecklist, > TaskBasedReasonCodes, BranchAddress, DgStatusDecisionMatrix, CashEquities, > IndividualReferences, EcddSciPublish, CddCaseAudit, BusinessSubSegment, > OPACases, ClientIndividualRelnPK, IndividualReferencesAsuPK, Product, > ClientNorkom, BusinessSegment, DocumentCategory, CoDocumentsChecklist, > CddCaseAuditSubReasons, IndividualClientRelnAsu, TaskBasedReasonCodesPK, > CustomerCountryRisk, PreScreeningComment, BbaRiskQuestion, > IndividualDocuments, > FormButton, Documents, BbaAdditionalDetails, ClientType, GuarantorNorkomPK, > AnticipatedTransaction, CddPepDetail, GoodsType, CddCaseActors, > GuarantorNorkom, > CddCountryRisk, CountryOffices, CopiFatca, CddWorkflowReassignment, Norkom, > Deferral, DocumentsUpload, ClientTriggerEvents, CopiFatcaStatus, Gic, > BusinessSubSegmentPK, ParentGroupDetails, MvSciClientCoreInfo, RequestMap, > CddRiskQuestions, DefenceGoods, OPADecisionReport, AtfRequestTxn, Individual, > ReviewCases, MvSciArmLocation, DefenceGoodsDecision, ClientIndividualPK, > RoccoDecisionReport, IndividualPK, CddTaskAction, PreScreeningRef, > ClientGuarantor, Derivative] >> at > org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:118)[848:org.apache.openjpa:2.4.0] >> at > org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:193)[848:org.apache.openjpa:2.4.0] >> at >> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaD >> ata(JPQLExpressionBuilder.java:166)[848:org.apache.openjpa:2.4.0] >> >> Looks like the entity CETAssignmentException is not in the open-jpa list > which is used in setting the values using Reflection. >> >> Below is the TRACE log enabled in openjpa. >> >> 3724779 bowbMSPersistenceUnit WARN [qtp1069331902-407] openjpa.MetaData > - The class "com.scb.cic.wb.cdd.ds.db.model.sci.SciOffices" listed in > the openjpa.MetaDataFactory configuration property could not be loaded by > wb-svc-cdd [970]; ignoring. >> 3724779 bowbMSPersistenceUnit WARN [qtp1069331902-407] openjpa.MetaData > - The class "com.scb.cic.wb.cdd.ds.db.model.sci.SciAssignment" listed > in the openjpa.MetaDataFactory configuration property could not be loaded by > wb-svc-cdd [970]; ignoring. >> 3724779 bowbMSPersistenceUnit WARN [qtp1069331902-407] openjpa.MetaData > - The class > "com.scb.cic.wb.cdd.ds.db.model.task.CETAssignmentExceptionPK" listed > in the openjpa.MetaDataFactory configuration property could not be loaded by > wb-svc-cdd [970]; ignoring. >> 3724779 bowbMSPersistenceUnit WARN [qtp1069331902-407] openjpa.MetaData > - The class > "com.scb.cic.wb.cdd.ds.db.model.task.CETAssignmentException" listed in > the openjpa.MetaDataFactory configuration property could not be loaded by > wb-svc-cdd [970]; ignoring. >> >> >> and debugged with the source code and found that >> >> private Class<?> classForName(String name, ClassLoader loader) { >> try { >> return Class.forName(name, true, loader); >> } catch (Exception e) { >> if ((_validate & VALIDATE_RUNTIME) != 0) { >> if (_log.isWarnEnabled()) >> _log.warn(_loc.get("bad-discover-class", name, > loader)); >> } else if (_log.isInfoEnabled()) >> _log.info(_loc.get("bad-discover-class", name, > loader)); >> if (_log.isTraceEnabled()) >> _log.trace(e); >> } catch (NoSuchMethodError nsme) { >> if (nsme.getMessage().indexOf(".pc") == -1) >> throw nsme; >> >> // if the error is about a method that uses the > PersistenceCapable >> // 'pc' method prefix, perform some logging and > continue. This >> // probably just means that the class is not yet enhanced. >> if ((_validate & VALIDATE_RUNTIME) != 0) { >> if (_log.isWarnEnabled()) >> _log.warn(_loc.get("bad-discover-class", name, > loader)); >> } else if (_log.isInfoEnabled()) >> _log.info(_loc.get("bad-discover-class", name, > loader)); >> if (_log.isTraceEnabled()) >> _log.trace(nsme); >> } >> return null; >> } >> >> >> Above entities are ignored in enhancement while the class is loaded. >> So, added below in persistence.xml >> >> <property name="openjpa.RuntimeUnenhancedClasses" > value="supported"/> --> in order to enhance dynamically during > run time. >> >> Additionally we have also enabled enhancement during build time by >> <plugin> >> <groupId>org.apache.openjpa</groupId> >> > <artifactId>openjpa-maven-plugin</artifactId> >> > <version>${openjpa-maven-plugin.version}</version> >> >> <configuration> >> </configuration> >> >> <executions> >> <execution> >> <id>enhancer</id> >> <phase>process-classes</phase> >> <goals> >> <goal>enhance</goal> >> </goals> >> </execution> >> </executions> >> </plugin> >> >> >> But still facing the same issue. >> >> This issue has become a serious issue. It would be great if the team could > help us in resolving the issue. >> >> Thanks. >> >> Regards >> Senthil Kumar Sekar >> > > This email and any attachments are confidential and may also be privileged. > If > you are not the intended recipient, please delete all copies and notify the > sender immediately. You may wish to refer to the incorporation details of > Standard Chartered PLC, Standard Chartered Bank and their subsidiaries at > https://www.sc.com/en/incorporation-details.html >