|
Re: Separate project trouble [message #665698 is a reply to message #665658] |
Fri, 15 April 2011 14:27 |
Shaun Smith Messages: 197 Registered: July 2009 |
Senior Member |
|
|
A few comments:
1. You should be using JTA transaction type and datasource.
2. Are you sure the projects are correctly constructed? The EJB module should be able to see the JPA (utility) jar.
3. I'd recommend trying a simple two project JPA/EJB test using just @PersistenceUnit or @PersistenceContext.
--Shaun
[Updated on: Fri, 15 April 2011 14:28] Report message to a moderator
|
|
|
Re: Separate project trouble [message #666100 is a reply to message #665658] |
Tue, 19 April 2011 07:06 |
Neikius Mising name Messages: 43 Registered: April 2011 |
Member |
|
|
I got this weird error
javax.servlet.ServletException: Exception [EclipseLink-4021] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Unable to acquire a connection from driver [null], user [null] and URL [null]. Verify that you have set the expected driver class and URL. Check your login, persistence.xml or sessions.xml resource. The jdbc.driver property should be set to a class that is compatible with your database platform
but then I somehow managed to punch through in a test project no.2... I guess its all about the settings. And the finese must play a large part too, so its not really all that friendly for someone trying for the first time.
I can get something to work, add a few things and I have to retrace and retry a few times to get even the most basic programs through.
So I will take your advice:
1) Always JTA, I guess I botched at jumping to more advanced ways of managing persistence context, gone back to the roots and it works now.
2) Still have trouble here though, for now I have persistence.xml in ejb bean, can I just put it into the jpa utility jar? It was my original intention to do this, but do I have to export the jar and include it? I was thinking of just referencing the jpa project under java build path of the ejb project. Om, seems to work now too, at least in my test project. And I don't have a clue how since I've been doing much the same thing for a while now. I guess I will have to figure this out.
3) Ye, this solved it for me. Not that my project was much more complex, but I guess @PersistenceContext is simpler than @Injecting produced EntityManager, though that should still works simply from what I gather...
Thanks for now, hope I can start with this finally.
edit: Om, I still cannot debug the main project. If I set a breakpoint in EJB it gets hit but I cannot step by step the execution after that... any clues regarding this?
edit2: So, any ideas why do I randomly get that null null errors? Then I just refresh a few times and a few of them it works and a few I get nulls... (nulls to datasource? what?)
[Updated on: Wed, 20 April 2011 08:41] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03458 seconds