This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes How to access PersistenceUnit from servlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "How to access PersistenceUnit from servlet?" Watch "How to access PersistenceUnit from servlet?" New topic
Author

How to access PersistenceUnit from servlet?

Alejandro Dominguez
Greenhorn

Joined: Jun 01, 2007
Posts: 28
Hello to all,
I have been trying to access a persistence unit from a servlet in JBoss 4.2.2, but I always get a "not bound" exception.

My directories are as follows:
.ear
-META-INF
--MANIFEST.MF
--application.xml
-.jar (persitence.xml)
-.war (web.xml, jboss-app.xml)

In my web.xml I have:


and in my servlet (inside the .war file) I have:


However, by looking at JMX Console I don't see the persistence/context being created, and when I try to lookup the manager, I get "persistence not bound".

Am I missing something here?

Regards


Alejandro<br /> <br />SCJP 5 (SAI)
Alejandro Dominguez
Greenhorn

Joined: Jun 01, 2007
Posts: 28
Nevermind, I upgraded to JBoss 5 (RC1) and it works perfectly

Nice to see a popular request being taken care of!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to access PersistenceUnit from servlet?
 
Similar Threads
Using EntityManager from a servlet?
Referencing EJBs in a JAR file from a WAR
How dos the application will know the path of persistence.xml file
Multiple persistance unit simultaneously, issue.
Confusion in accessing ENTITY bean