Mantis - Resin
|
Viewing Issue Advanced Details |
|
ID:
|
Category:
|
Severity:
|
Reproducibility:
|
Date Submitted:
|
Last Update:
|
3760 |
|
major |
always |
11-13-09 01:52 |
02-15-10 15:30 |
|
Reporter:
|
georgbuschbeck |
Platform:
|
|
|
Assigned To:
|
ferg |
OS:
|
|
|
Priority:
|
normal |
OS Version:
|
|
|
Status:
|
closed |
Product Version:
|
4.0.1 |
|
Product Build:
|
|
Resolution:
|
fixed |
|
Projection:
|
none |
|
|
|
ETA:
|
none |
Fixed in Version:
|
4.0.4 |
|
|
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. |
Steps To Reproduce:
|
|
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) |
Relationships | |
Attached Files:
|
|
Notes |
|
(0004313)
|
georgbuschbeck
|
11-25-09 01:35
|
|
Just Checked, Problem persists in 4.0.2 |
|
|
(0004427)
|
ferg
|
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. |
|
|
(0004428)
|
georgbuschbeck
|
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 .... |
|
|
(0004429)
|
ferg
|
02-15-10 15:29
|
|
env/0e13
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. |
|