Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Multiple JPA Persistences loading issue in JBOSS 5(Multiple products with in same JBOSS Issue)
icon4.gif  Multiple JPA Persistences loading issue in JBOSS 5 [message #1064224] Tue, 18 June 2013 10:30 Go to next message
SRIHARIRAO M is currently offline SRIHARIRAO MFriend
Messages: 6
Registered: June 2013
Location: Hyderabad, India
Junior Member
Hello Every One!!

I have two projects "ProjectA.war" and "ProjectB.war".

In both projects, i am using Oracle 11g, JPA2 with EclipseLink 2.4.2.
and i am using JBOSS 5.1.0 GA application server.

Both have different persistence.xml files with different persistence-unit names, different datasource files.
Here i am connecting same Oracle DB user for both projects.

My Problem is...
First i had deployed ProjectA.war in server. And it is working fine. and DB operations also working fine.

Now i am deploying the ProjectB.war in server besides of ProjectA.war.
So, when i am trying to perform the db operations on ProjectA.war then jboss is searching the POJO classes in ProjectB.war's persistenece.xml file with the help of ProjectB's persistence-unit name.
But actually it need to search in ProjectA.

My ProjectA.war Configurations in the attached document "Project_A.xml".

My ProjectB.war Configurations in the attached document "Project_B.xml".

And the console error was described in the attached document "Console_Error.log".


In above error description....
"INFO  [IportIBEntity] finding IptUsers instance with property: userCode, value: ADMIN"


here IportIBEntity is the persistence-unit of ProjectB.war, but IptUsers pojo have in ProjectA.war. So, it is trying to search the pojo in ProjectB.war instead of ProjectA.war

Please help me to solve the problem....


SRIHARIRAO M,
Software Developer,
HYDERABAD.
------------------------------------
JAVA SE 6, JAVA EE 6, Struts 2.x, Spring 3.x, JPA, EclipseLink, TopLink, JAX-WS, jQuery, JSON, Apache Tomcat 6.x, JBoss-5.1.0.GA, Eclipse, MyEclipse, Linux, Windows.
Re: Multiple JPA Persistences loading issue in JBOSS 5 [message #1064304 is a reply to message #1064224] Tue, 18 June 2013 15:07 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

If you want to persist claseses from ProjectA in ProjectB, then you need those classes in the B war.


James : Wiki : Book : Blog : Twitter
Re: Multiple JPA Persistences loading issue in JBOSS 5 [message #1064420 is a reply to message #1064304] Wed, 19 June 2013 08:05 Go to previous messageGo to next message
SRIHARIRAO M is currently offline SRIHARIRAO MFriend
Messages: 6
Registered: June 2013
Location: Hyderabad, India
Junior Member
Hi James,
Thanks for your reply.

OK, i know that if i want to access the ProjectA classes through ProjectB then i need to be declare in ProjectB's persistence.xml.

But here my problem is i am not accessing the ProjectA classes in ProjectB.

At projects loading time, Jboss searching the classes in ProjectB instead of ProjectA.

Actually IptUsers table have in ProjectA's persistence.xml.

When i want to access the IptUsers table through ProjectA, then it is searching in ProjectB's persistence.xml file. But it should be search in ProjectA.

Please help me...


SRIHARIRAO M,
Software Developer,
HYDERABAD.
------------------------------------
JAVA SE 6, JAVA EE 6, Struts 2.x, Spring 3.x, JPA, EclipseLink, TopLink, JAX-WS, jQuery, JSON, Apache Tomcat 6.x, JBoss-5.1.0.GA, Eclipse, MyEclipse, Linux, Windows.
Re: Multiple JPA Persistences loading issue in JBOSS 5 [message #1064486 is a reply to message #1064420] Wed, 19 June 2013 13:22 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Are you sure your issue is related to project B? The error doesn't seem to reference anything in project B, and I would assume that you would get issues accessing persistence-unit "Entity" from the PersistenceProvider class if it were only using the persistence.xml in project B - it only exists in Project A's persistence.xml.

Does this happen when the server is restarted? On first deployment? How are you accessing the EntityManager and EMFs?

If the EntityManager isn't container managed, you might want to check that you are properly closing EntityManagers and EntityManagerFactories when they are no longer in use, and if statically holding them, that they are closed before the app is redeployed. Otherwise the persistence unit will still be using prior deployments classloaders instead of the current classloader.
Re: Multiple JPA Persistences loading issue in JBOSS 5 [message #1065891 is a reply to message #1064486] Fri, 28 June 2013 07:29 Go to previous message
SRIHARIRAO M is currently offline SRIHARIRAO MFriend
Messages: 6
Registered: June 2013
Location: Hyderabad, India
Junior Member
Hi Chris Delahunt,
Thanking you for your reply.

Sorry for delay response...

Quote:
Are you sure your issue is related to project B? The error doesn't seem to reference anything in project B, and I would assume that you would get issues accessing persistence-unit "Entity" from the PersistenceProvider class


When i am deploying only ProjectA or only ProjectB then it is executing successfully. But if i merged both the product then it is showing the above error.
Yes your are right, here the problem with persistence-unit problem. It is unable to call the "Entity" object.

"INFO  [IportIBEntity] finding IptUsers instance with property: userCode, value: ADMIN"


If we can observe the above code, here "IportIBEntity" is the ProjectB's persistence-unit name. But "IptUsers" is the db table's pojo reference which was mentioned in ProjectA's persistence.xml

Quote:
Does this happen when the server is restarted? On first deployment? How are you accessing the EntityManager and EMFs?


The above issue is showing when the JBOSS loading time.

I am accessing the EntityManager by using the code which was attached this post. (This code is for ProjectA)


SRIHARIRAO M,
Software Developer,
HYDERABAD.
------------------------------------
JAVA SE 6, JAVA EE 6, Struts 2.x, Spring 3.x, JPA, EclipseLink, TopLink, JAX-WS, jQuery, JSON, Apache Tomcat 6.x, JBoss-5.1.0.GA, Eclipse, MyEclipse, Linux, Windows.

[Updated on: Fri, 28 June 2013 07:39]

Report message to a moderator

Previous Topic:java.lang.ArrayIndexOutOfBoundsException: -1
Next Topic:Problem with ObjectGraph and xml attributes
Goto Forum:
  


Current Time: Wed Apr 24 18:17:02 GMT 2024

Powered by FUDForum. Page generated in 0.03612 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top