I've a project which followed the hibernate example here:
http://wiki.caucho.com/Hibernate
I'm now trying to do the same but with eclipselink as supplied with
Resin 4.0.14 pro. I extended that hibernate example to perform commits
using UserTransaction and EntityManager instances but when I used the
same code with eclipselink I get
"[EL Severe]: 2011-02-02
23:23:52.406--ServerSession(4188490)--java.lang.IllegalStateException:
Can't allocate connection because the connection pool is closed."
I'm sure this is a newbie db config problem. The servlet code is
@PersistenceUnit(unitName="contact")
EntityManagerFactory emf;
@Inject
private UserTransaction ut;
private EntityManager em;
public void service(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException {
PrintWriter out = res.getWriter();
res.setContentType("text/html");
Contact contact;
try {
ut.begin();
em = emf.createEntityManager();
...
and the exception occurs at that last line. I defined my db in
resin-web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://caucho.com/ns/resin">
<system-property service.version.id='LnJPA 1.00'/>
<database>
<jndi-name>jdbc/contact</jndi-name>
<driver type="org.gjt.mm.mysql.Driver">
<url>jdbc:mysql://localhost:3306/Contact</url>
<user>root</user>
<password/>
</driver>
</database>
</web-app>
And thought the <jta-data-source> entry in persistence.xml was all I
needed to wire it up:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="contact">
<provider>org.eclipse.persistence..PersistenceProvider</provider>
<jta-data-source>jdbc/contact</jta-data-source>
<class>com.otamate.jee.contact.Contact</class>
<exclude-unlisted-classes/>
</persistence-unit>
</persistence>
Is there something else I should be doing please?
-- Carl Whalley http://www.androidacademy.com
_______________________________________________
resin-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/resin-interest