Tuesday, August 4, 2009

Letter Leave Apartment

System.setProperty () using Spring

problem of how to call System.setProperty Spring occurred when the zdeployowaniu two applications on one server, the logs of one of them appeared the following entry:

"A C3P0Registry MBean is already registered. This Means That probably an application using c3p0 was undeployed, but not all were closed Priority PooledDataSources This undeployment. This May lead to resource leaks over time. Please take care to close all PooledDataSources. "

the hibernate forums, I found the information that you need to set a variable in the system:
com.mchange.v2.c3p0.management.ManagementCoordinator = com.mchange.v2.c3p0.management.NullManagementCoordinator
Unfortunately
this solution is not out of the question (all customers would have to modify your script that runs Tomcat). The only sensible solution that came to my mind, is forcing the Spring Trip.
naszukaƂem A little, until I finally found a (bad) solution to my problem. After the changes and simplifications obtained acting bean'a :)

Oto on:

  
<bean id="sysprops" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass">
<value>java.lang.System</value>
</property>
<property name="targetMethod">
<value>setProperty</value>
</property>
<property name="arguments">
<list>
\u0026lt;value> com.mchange.v2.c3p0.management.ManagementCoordinator \u0026lt;/ value>
\u0026lt;value> com.mchange.v2.c3p0.management.NullManagementCoordinator \u0026lt;/ value>
\u0026lt;/ list>
\u0026lt;/ property> ;
\u0026lt;/ bean>


If someone was interested, so why not have another variable to be set, then I invite you to the forum hibernate.