[JBoss jBPM] - [CachedConnectionManager] Closing a connection for you
by sylobsa
JBoss4.2.0.GA
jBPM 3.2.0.GA
Hi,
I'm trying to use jBPM 3 in an existing application. I can deploy processes definitions, but when I try to get the process list, I get an error message :
[CachedConnectionManager] Closing a connection for you
Investigating on this error I found that :
- The error occurs in "org.jbpm.persistence.db.DbPersistenceService" when the "Connection getConnection(boolean resolveSession)" method is called
- The connection hasn't been closed because when the "Exception closeConnection()" method is called, the variable mustConnectionBeClosed is set to false
Looking for the reason why "mustConnectionBeClosed", here is the code executed :
In my class :
jbpmContext.getGraphSession().findLatestProcessDefinitions()
In DbPersistenceService :
public GraphSession getGraphSession() {
if (graphSession==null) {
Session session = getSession(); //-- 1
...
public Session getSession() {
if ( (session==null)
&& (getSessionFactory()!=null)
) {
Connection connection = getConnection(false); //-- 2
if (isCurrentSessionEnabled) {
...
} else if (connection!=null) {
log.debug("creating hibernate session with connection "+connection);
session = getSessionFactory().openSession(connection);
mustSessionBeClosed = true;
mustSessionBeFlushed = true;
mustConnectionBeClosed = false; //-- 4
...
public Connection getConnection(boolean resolveSession) {
if (connection==null) {
if (persistenceServiceFactory.getDataSource()!=null) {
try {
log.debug("fetching jdbc connection from datasource");
connection = persistenceServiceFactory.getDataSource().getConnection();
mustConnectionBeClosed = true; //-- 3
...
"mustConnectionBeClosed" is first set to true (//-- 3) getting the connection, then set to false (//-- 4) some lines further, after opening the session.
Is this normal ? How to avoid the error message ? Did I miss something in the configuration ?
Regards
A. ROY
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069676#4069676
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069676
17Â years, 3Â months
[Security & JAAS/JBoss] - Re: stick authentication info to EJB handle?
by nlmarco
After some further investigation, I saw sth. very interesting:
| EjbOfPartnerHome home1 = EjbOfPartnerUtil.getHome(getInitCtxProps(partner1));
| EjbOfPartner ejbOfPartner1 = home1.create();
| EjbOfPartnerHome home2 = EjbOfPartnerUtil.getHome(getInitCtxProps(partner2));
| EjbOfPartner ejbOfPartner2 = home2.create();
| EjbOfPartnerHome home3 = EjbOfPartnerUtil.getHome(getInitCtxProps(partner3));
| EjbOfPartner ejbOfPartner3 = home3.create();
Even though, home1, home2 and home3 are all different objects, the above create() methods return every time the same instance of EjbOfPartner - i.e. ejbOfPartner1 == ejbOfPartner2 == ejbOfPartner3. And this happens, even though my initial-context-properties are different! To be more precise, these properties look like this:
Properties props = new Properties();
| props.put(InitialContext.INITIAL_CONTEXT_FACTORY, initialContextFactory);
| props.put(InitialContext.PROVIDER_URL, initialContextURL);
| props.put(InitialContext.SECURITY_PRINCIPAL, username);
| props.put(InitialContext.SECURITY_CREDENTIALS, password);
| props.put(InitialContext.SECURITY_PROTOCOL, "jfire");
The two properties InitialContext.SECURITY_PRINCIPAL and InitialContext.SECURITY_CREDENTIALS differ while the others are the same.
Is there any possibility to force JBoss to create different EJBs for different initial-context-properties? That might already solve my problem.
Best regards, Marco :-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069670#4069670
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069670
17Â years, 3Â months
[JBoss jBPM] - Re: EjbSchedulerServiceFactory - Exception
by estaub
Well, looking at the exception,
anonymous wrote : java.lang.ClassCastException: org.jbpm.scheduler.ejbtimer.EjbSchedulerServiceFactory
| org.jbpm.svc.Services.getServiceFactory(Services.java:122)
|
then looking at the source it points at...
| public ServiceFactory getServiceFactory(String name) {
| return (ServiceFactory) getServiceFactories().get(name);
| }
|
I'd guess that EjbSchedulerServiceFactory is not an instance of ServiceFactory... but looking at EjbSchedulerServiceFactory.java, I find:
public class EjbSchedulerServiceFactory implements ServiceFactory {...}
So... it looks like a classloader problem of some kind, where there are two class instantiations of ServiceFactory competing for your affection.
At this point, I'd look for competing JBPM deployments in the WAR, EAR (if any), appserver, and anywhere else you can think of.
-Ed Staub
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4069668#4069668
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4069668
17Â years, 3Â months