wood burning stoves 2.0*
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
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!
 
Don't get me started about those stupid light bulbs.
 
subject: How to access PersistenceUnit from servlet?