Not logged in. · Lost password · Register

Member since Aug 2011
14 posts
Subject: Database connection via JPA and JNDI
I have a problem to connect to my localdatabase via JNDI and tha Java JPA Persistence Unit usind EclipseLink.
The database with JPA only works fine. But when i try to connect via JNDI, there is no connection and our webapp says
'HTTP Status 500 - com.vaadin.server.ServiceException: java.lang.NoClassDefFoundError: Could not initialize class com.fau.amos.team2.WoundManagement.WoundManagementUI'

I did the following:

1) Changed my tomcat7 context.xml as described in lecture:
     Used the credentials of my local running postgresql server.

2) Configured the persistance.xml of our webapp

<persistence-unit name="testdb" transaction-type="JTA">
           <class>com.fau.amos.team2.WoundManagement "..."</class> <!-- classes used for OR-Mapper -->
             <property name="eclipselink.logging.level" value="FINE"/>
             <property name="eclipselink.ddl-generation" value="create-or-extend-tables"/>
             <property name="eclipselink.ddl-generation.output-mode" value="database"/>

3) Created a web.xml File for our webapp

<web-app xmlns=""

4) Tried to create an EntityManagerFactory:
EntityManagerFactory emf = Persistence.createEntityManagerFactory("testdb");

Does anyone have an idea, why it doesnt connect to the database?
Member since Jan 2007
103 posts

I have a feeling that JNDI is not directly responsible for your exception.

Are you sure your web.xml file is correct? Not in respect to JNDI but in respect to Vaadin. I think you are missing some important entries:

Usually, if your JNDI configuration doesn't work you'll get an exception as soon as you do the first access to the DataSource, but that wouldn't be a NoClassDefFoundError. Maybe a NamingException.

4) Can you be more specific? How were you able to test this if your application doesn't even start?

Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Datenschutz | Kontakt
Powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2011 by Yves Goergen