Hi all,
I have an application that runs fine in the netbeans IDE. I have compiled it and run it from the command line (java -jar jarfile.jar), but it dies at
Persistence.createEntityManagerFactory(). When I say dies, I mean nothing happens - no exceptions are being thrown that I can see and the method returns null. I have set up a logger that prints to a file and the last thing in the file is "
INFO Getting an EntityManagerFactory"
Here is part of the code:
Code:
myLogger.log(Level.INFO, "Getting an EntityManagerFactory");
EntityManagerFactory entityManagerFactory =
Persistence.createEntityManagerFactory(myPersistenceUnit,
new HashMap<String, String>() {
private static final long serialVersionUID = 1L;
{
put("hibernate.show_sql", "false");
put("hibernate.connection.url", myUrl);
put("hibernate.connection.username", myUsername);
put("hibernate.connection.password", myPassword);
}
});
myLogger.log(Level.INFO, "Setting myEntityManager");
This code is never called when running from a jar (
java -jar jarfile.jar):
Code:
myLogger.log(Level.INFO, "Setting myEntityManager");
Its almost like it cannot find the persistence.xml file (at least that is what I am assuming from my trolling on the web.) One clue may be that it was working fine (from the jar file) until I upgraded my netbeans to 6.8 recently (it only just now occurred to me that this may be the root of the problem - I had made many code changes (none of them relating to the entities) and I assumed that I had broken something. Now I don't know where to start.
Any suggestions would be most welcome
thanks in advance,
Jordan