-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: problem with Persistence.createEntityManagerFactory
PostPosted: Mon Dec 21, 2009 8:15 pm 
Newbie

Joined: Mon Sep 29, 2008 7:18 pm
Posts: 5
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.