[JBoss jBPM] - Re: jbpm 3.2 Session Is Closed exception in JobSession
by srLucas
Hi,
I am experiencing the same issue here. I haven't found the solution yet (I might try the posted solution here) but wanted to post the problem for future reference...
the error I am getting is the following:
17:53:07,343 [http-8080-4] INFO ContextAdvice : ----------> ContextAdvice in action, opening ctx
| 17:53:21,234 [http-8080-4] DEBUG JbpmContextInfo : creating jbpm context with service factories '[tx, message, scheduler, logging, persistence, authentication]'
| 17:53:21,250 [http-8080-4] DEBUG JbpmContext : creating org.jbpm.JbpmContext@93f17f
| 17:53:21,250 [http-8080-4] INFO ContextAdvice : --------------> reusing existing jbpmContext: org.jbpm.JbpmContext@93f17f
| 17:53:26,281 [http-8080-4] DEBUG DbPersistenceServiceFactory : creating persistence service
| 17:53:26,296 [http-8080-4] DEBUG DbPersistenceService : creating hibernate session
| 17:53:26,296 [http-8080-4] DEBUG DbPersistenceService : beginning hibernate transaction
| 17:53:31,343 [http-8080-4] DEBUG DbPersistenceService : begun hibernate transaction org.hibernate.transaction.JDBCTransaction@537c91
| 17:53:31,531 [http-8080-4] INFO ContextAdvice : ----------> ContextAdvice in action, closing ctx
| 17:53:51,562 [http-8080-4] DEBUG JbpmContext : closing jbpmContext org.jbpm.JbpmContext@93f17f
| 17:53:51,578 [http-8080-4] DEBUG Services : closing service 'persistence': org.jbpm.persistence.db.DbPersistenceService@362a7b
| 17:53:51,593 [http-8080-4] DEBUG DbPersistenceService : committing hibernate transaction org.hibernate.transaction.JDBCTransaction@537c91
| 17:53:51,625 [http-8080-4] DEBUG DbPersistenceService : closing hibernate session
| 17:53:51,640 [http-8080-4] DEBUG Services : closing service 'tx': org.jbpm.tx.TxService@384d34
| 17:53:51,812 [http-8080-4] ERROR LoggingSession : org.hibernate.SessionException: Session is closed!
And here is a bit of explanation.
I have a ContextAdvice Object that opens/closes the context when you enter/leave the service logic.
package com.ea.dc.jbpm.context;
|
| import java.lang.reflect.Method;
|
| import org.apache.log4j.Logger;
| import org.jbpm.JbpmConfiguration;
| import org.jbpm.JbpmContext;
| import org.springframework.aop.AfterReturningAdvice;
| import org.springframework.aop.MethodBeforeAdvice;
|
| /** Class used to intercept calls to services and initialize the jbpmContext
| * in order to make it transparent to the coder.
| *
| * @author lucas.gonzalezp
| */
| public class ContextAdvice
| implements MethodBeforeAdvice, AfterReturningAdvice {
|
| /** The class logger. */
| private static final Logger LOGGER = Logger.getLogger(ContextAdvice.class);
|
| /** jbpm configuration. */
| private JbpmConfiguration jbpmConfiguration = null;
|
| /** Opens the context. */
| public void before(Method method, Object[] args, Object target)
| throws Throwable {
| LOGGER.info("----------> ContextAdvice in action, opening ctx");
| getContext();
| }
|
|
| /** Closes the context. */
| public void afterReturning(Object returnValue, Method method,
| Object[] args, Object target) throws Throwable {
| LOGGER.info("----------> ContextAdvice in action, closing ctx");
|
| JbpmContext jbpmContext = jbpmConfiguration.getCurrentJbpmContext();
| if (jbpmContext != null) {
| jbpmContext.close();
| } else {
| // TODO: throw exception?
| LOGGER.fatal("----------> CONTEXT NOT FOUND, SOMEONE ELSE CLOSED IT");
| }
| }
|
| /** Looks for a current JBPMContext. If it does not exists it will create
| * a new one.
| * @return a jbpm context
| */
| private JbpmContext getContext() {
| // Lookup the pojo persistence context-builder that is configured above
| JbpmContext jbpmContext = jbpmConfiguration.getCurrentJbpmContext();
|
| if (jbpmContext == null) {
| jbpmContext = jbpmConfiguration.createJbpmContext();
| LOGGER.info("--------------> creating new jbpmContext: "
| + jbpmContext);
| }
| return jbpmContext;
| }
|
| /** Sets the jbpmConfiguration for this bean.
| * @param config the jbpm configuration to set
| */
| public void setJbpmConfiguration(final JbpmConfiguration config) {
| jbpmConfiguration = config;
| }
| }
|
and here is one of the failing methods:
public List<JobDTO> getJobs() {
| List<JobDTO> result = new ArrayList<JobDTO>();
|
| // Lookup the pojo persistence context-builder that is configured above
| JbpmContext jbpmContext = getContext();
|
| // let's obtain a graph session to get the process instances
| GraphSession graphSession = jbpmContext.getGraphSession();
| // now let's get the process instance
| ProcessDefinition procDef = graphSession.findLatestProcessDefinition(
| WorkFlowServiceImpl.PROCESS_NAME);
|
| List<ProcessInstance> instances =
| graphSession.findProcessInstances(procDef.getId());
|
| for (Iterator iterator = instances.iterator(); iterator.hasNext();) {
| ProcessInstance processInstance = (ProcessInstance) iterator.next();
| result.add(populateJob(processInstance));
| }
|
| return result;
| }
|
So I understand that ContextAdvice closes the jbpmContext --> HibernateSession and then the LogSession throws the error.
Is it possible to flush/close the LogSession before the context is closed?
thanks,
Lucas
- I am using springmodules 0.8a
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205393#4205393
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205393
17 years, 2 months
[Installation, Configuration & DEPLOYMENT] - JVM Container Configuration
by brijoyj
Hello
We are using JBoss Enterprise 4.3 GA as our development server. We would like to know how to achieve call-by-reference configuration in this version of the server. Previously we had <container-invoker-conf> where Optimization attribute determines the behaviour of the objects. Please see below taken from the JBoss prev version. I would like to know how to achieve this in 4.3
-------------------------------------------
<container-invoker-conf> configuration of the container invoker.
There are several elements which can nest within container-invoker-conf, one of which is . This controls the behavior of bean method calls within the Java VM in which jboss is running. If the value of Optimized is "false" then the container will behave per the EJB spec and all objects passed into and out of bean remote methods will be marshalled over RMI regardless of whether the client is running remotely or in the same VM as jboss.
If the value of Optimized is "true" then objects passed between bean methods and clients in the jboss java VM will be passed by reference rather than by value. This is much more efficient (and can result in substantial performance improvements) but can result in unexpected behavior. For example, if a bean has a member object and returns that object from a get() method then the EJB-specified behavior is to make a copy of that object which is returned over RMI to the caller. Therefore if the caller modifies the returned object in any way she will modify the copy of the object. If Optimized is "true" then the caller will modify the original object per se, rather than a copy.
-----------------------------------
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205391#4205391
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205391
17 years, 2 months
[Installation, Configuration & DEPLOYMENT] - JVM Container Configuration
by brijoyj
Hello
We are using JBoss Enterprise 4.3 GA as our development server. We would like to know how to achieve call-by-reference configuration in this version of the server. Previously we had <container-invoker-conf> where Optimization attribute determines the behaviour of the objects. Please see below taken from the JBoss prev version. I would like to know how to achieve this in 4.3
-------------------------------------------
<container-invoker-conf> configuration of the container invoker.
There are several elements which can nest within container-invoker-conf, one of which is . This controls the behavior of bean method calls within the Java VM in which jboss is running. If the value of Optimized is "false" then the container will behave per the EJB spec and all objects passed into and out of bean remote methods will be marshalled over RMI regardless of whether the client is running remotely or in the same VM as jboss.
If the value of Optimized is "true" then objects passed between bean methods and clients in the jboss java VM will be passed by reference rather than by value. This is much more efficient (and can result in substantial performance improvements) but can result in unexpected behavior. For example, if a bean has a member object and returns that object from a get() method then the EJB-specified behavior is to make a copy of that object which is returned over RMI to the caller. Therefore if the caller modifies the returned object in any way she will modify the copy of the object. If Optimized is "true" then the caller will modify the original object per se, rather than a copy.
-----------------------------------
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205390#4205390
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205390
17 years, 2 months
[Beginners Corner] - Re: How to configure XA Datasource for JBoss 4.2.2 and Postg
by allapetrova
Ok, I figured it out and documenting for those who come later. Below is an example of XA Datasource configuration for Postgres: postgres-xa-ds.xml
Also you need to have Postgress .jar with org.postgresql.xa.PGXADataSource in your JBoss classpath. I am using postgresql-8.3-604.jdbc3.jar. I put it in my application lib directory.
The database I am connecting to is legacy version 7.2 So I am not sure if I would have any problems with it, but it is a separate issue.
<datasources>
| <xa-datasource>
| <jndi-name>DefaultDS</jndi-name>
| <track-connection-by-tx/>
| <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
| <xa-datasource-property name="ServerName">MyTestDBServer</xa-datasource-property>
| <xa-datasource-property name="DatabaseName">MyDBName</xa-datasource-property>
| <user-name>X</user-name>
| <password>Y</password>
| <!-- sql to call when connection is created -->
| <new-connection-sql>select count(*) from pd_status</new-connection-sql>
|
| <!-- sql to call on an existing pooled connection when it is obtained from pool -->
| <check-valid-connection-sql>select count(*) from pd_status</check-valid-connection-sql>
|
| <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
| <metadata>
| <type-mapping>PostgreSQL 7.2</type-mapping>
| </metadata>
| </xa-datasource>
|
| .....
|
| </datasources>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205389#4205389
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205389
17 years, 2 months
[Installation, Configuration & DEPLOYMENT] - problem with datasource + mysql + jboss
by rhinosystemsinc
Hi,
I've configured two datasources in /server/default/deploy, as shown below, and one goes to oracle, and the other goes to mysql.
Problem is this... I can connect to mysql via a java test program, but it won't connect from jboss. Funny thing is that it is using a username that I've taken out of the datasource definitions all together... (It is one of my usernames, but just not in the ds config files).. Please help... Thanks!
Env:
MySQL: Server version: 5.0.32-Debian_7etch8-log
Connector: mysql-connector-java-5.1.7-bin.jar
jboss-4.2.2.GA
Debian/Unix
Error:
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
| at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:171)
| ... 158 more
| Caused by: java.sql.SQLException: Access denied for user 'gs'@'localhost' (using password: YES)
| at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
| at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
| at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
| at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
| at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:911)
| at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3953)
| at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1276)
| at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2198)
| ... 162 more
|
::::::::::::::
GSModel-ds.xml
::::::::::::::
<?xml version="1.0" encoding="UTF-8"?>
| <datasources>
| <local-tx-datasource>
| <jndi-name>GSModelDS</jndi-name>
| <connection-url>jdbc:oracle:thin:@localhost:1521:xe</connection-url>
| <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
| <user-name>gsora</user-name>
| <password>xxxxx</password>
| </local-tx-datasource>
| </datasources>
|
::::::::::::::
GSMySQL-ds.xml
::::::::::::::
<?xml version="1.0" encoding="UTF-8"?>
| <datasources>
| <local-tx-datasource>
| <jndi-name>GSMySQLModelDS</jndi-name>
| <!--<connection-url>jdbc:mysql://localhost:3306/gsTemp</connection-url> -->
| <connection-url>jdbc:mysql://localhost/gstemp1</connection-url>
| <driver-class>com.mysql.jdbc.Driver</driver-class>
| <user-name>gs2</user-name>
| <password>xxxxx</password>
| <connection-property name="autoReconnect">true</connection-property>
| <!-- Typemapping for JBoss 4.0 -->
| <metadata>
| <type-mapping>mySQL</type-mapping>
| </metadata>
| </local-tx-datasource>
|
| </datasources>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205388#4205388
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205388
17 years, 2 months
[EJB 3.0] - Re: MDB redeploy with ...-service.xml
by Wolfgang Knauf
Hi jaikiran,
the -service.xml in META-INF instead of the JAR root results only in this error:
| javax.naming.NameNotFoundException: MessageBeanQueue not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
| ...
| 21:14:01,335 INFO [QueueService] Queue[queue/MessageBeanQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
The first error (javax.management.InstanceAlreadyExistsException) is gone.
So I assume that -service.xml files MUST be placed in META-INF? Is this correct? Or is there some problem that those files are deployed twice now? My MDB sample for JBoss 4.2 worked with this file in JAR root.
For the "NameNotFoundException": is there some dependency of the MDB deployer to the service deployer, which is in the wrong order?
Thanks
Wolfgang
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205381#4205381
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205381
17 years, 2 months