Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003760 [Resin] major always 11-13-09 01:52 02-15-10 15:30
Reporter georgbuschbeck View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 4.0.1
Summary 0003760: multipe persistence units in persistence.xml
Description We have multiple persistences units in one persistence.xml specified.
These units are then used bei our wicket web application, which one should be used is choosen by the Application on start up, due to the environment.

In resin 4.0.1 the container seems try to startup every persistence unit there is, which in some cases, simply doesnt work, because these services needed aren't available.

1) is this the intended way?
2) why does the application server check every persistence unit?
3) can i disable this behavior?

i tried putting this persistence.xml to classes/WEB-INF/classes/META-INF, outside the war, but this is then simply ignored.
Additional Information System Env:

* Debian Lenny (AMD64) , SUN JVM 1.6.0_12 as provided by Debian Project
* MySQL Database
* memcached (for 2nd level caching)
Attached Files

- Relationships

- Notes
11-25-09 01:35

Just Checked, Problem persists in 4.0.2
02-12-10 16:32

I'm working through the JavaEE specs on this one for 4.0.4.

I'm not sure it's possible to have a non-activated persistence-unit because of bytecode enchancement (basically, Resin needs to activate the provider before any class could possibly be loaded).

However, it may be possible to catch the exception and only throw it when the application requests the EntityManager or EntityManagerFactory.
02-15-10 02:34

well main problem is, we are using memcached for 2nd level caching this way:

                        <property name="hibernate.memcached.servers" value="memcached.service:11211 memcached1.service:11211" />
                        <property name="hibernate.cache.provider_class" value="com.googlecode.hibernate.memcached.MemcachedCacheProvider" />

this caching has the problem, that it will block, till it can establish a connection to theses memcached servers ....
02-15-10 15:29


Resin 4.0.4 will have a com.caucho.env.jpa.DisabledPersistenceProvider that you can use as the <provider> tag in the persistence.xml. You can selectively enable the persistence units with a <jpa-persistence-unit name="foo"> in the resin-web.xml (you'll need to add the actual <provider>.)

Looking through the JPA 2.0 specification, I can't see any way to avoid calling a PersistenceProvider for each persistence-unit, because those need to be configured before the classloaders are live (because of bytecode enhancemtn.) But it is possible to create a dummy PersistenceProvider that does nothing on startup.

- Issue History
Date Modified Username Field Change
11-13-09 01:52 georgbuschbeck New Issue
11-23-09 02:46 georgbuschbeck Issue Monitored: georgbuschbeck
11-25-09 01:35 georgbuschbeck Note Added: 0004313
02-12-10 16:32 ferg Note Added: 0004427
02-15-10 02:34 georgbuschbeck Note Added: 0004428
02-15-10 15:29 ferg Note Added: 0004429
02-15-10 15:30 ferg Assigned To  => ferg
02-15-10 15:30 ferg Status new => closed
02-15-10 15:30 ferg Resolution open => fixed
02-15-10 15:30 ferg Fixed in Version  => 4.0.4

Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
36 total queries executed.
29 unique queries executed.
Powered by Mantis Bugtracker