Results 1 to 1 of 1
Thread: createEntityManager stuck
- 12-10-2010, 12:07 AM #1Member
- Join Date
- Dec 2010
- Rep Power
Hi, not sure if this is the right place to post this problem but since it is related to javax.Persistence, this looks to be the most appropriate category. I have a very strange problem that I do not know how to solve. I have an application that creates a thread, does something, and then calls another application:
App1 --- thread 1 ----> does something ----> Finish
|---- thread 2 ----> does something ----> calls App2 ----> Finish
Now in App2, it has the following code:
em = emfUser.createEntityManager();
Scenario 1 - running App2 by itself
If I run App2 by itself (App1 does not call App2), then the above code executes perfectly fine. No problem there.
Scenario 2 - calling App2 through App1
However, if I invoke App2 from App1 by:
Process pr = Runtime.getRuntime().exec(App2);
Then I get "here 1" but does not get to "here 2" UNLESS I kill App1 whether by task manager or stopping the ide. As soon as App1 is killed, it goes through createEntityManager() and then "here 2" is printed. And no exception is thrown by createEntityManager() because as soon as App1 is killed, the method continues on its merry way.
Please note that App1 does not do anything to the database. It has no database related tasks.
In production, App2 does need to be invoked by App1 so the simple solution of calling App2 by itself is not possible.
I would really appreciate some help on this as I am at my wit's end. The tasks that App1 does is totally unrelated to App2 so I have no idea why App2 is stuck at createEntityManager() when invoked by App1.
- By nobody58 in forum Advanced JavaReplies: 2Last Post: 03-18-2010, 03:52 PM
- By programmer_007 in forum JDBCReplies: 1Last Post: 09-17-2009, 05:00 AM
- By clanboru15 in forum New To JavaReplies: 5Last Post: 03-13-2009, 02:44 AM
- By shongo in forum Advanced JavaReplies: 2Last Post: 11-09-2008, 03:56 AM
- By Zombie_Leg! in forum New To JavaReplies: 1Last Post: 09-23-2008, 03:22 AM