[JBoss JIRA] Created: (JBPM-1914) Problem in retrieving variables of Serializable objects
by Mauro Molinari (JIRA)
Problem in retrieving variables of Serializable objects
-------------------------------------------------------
Key: JBPM-1914
URL: https://jira.jboss.org/jira/browse/JBPM-1914
Project: JBoss jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Core Engine
Affects Versions: jBPM 3.3.0 GA
Reporter: Mauro Molinari
Priority: Critical
I have encountered a serious problem working with variables whose value is a serializable object.
The problem is that sometimes (not always!) an error like the following is given when retrieving a variable:
java.lang.ClassCastException: org.jbpm.bytes.ByteArray$$EnhancerByCGLIB$$cc67d06e
The code is like:
MySerializableClass obj = (MySerializableClass) contextInstance.getVariable("myVariable");
(of course, "myVariable" is a variable that I previously have set with a MySerializableClass object)
Apart from the CGLIB awful problem with proxies, even if I extract the value from the proxy with the following:
public static Object getCGLIBProxiedObject(final Object proxy)
{
if(proxy instanceof HibernateProxy)
{
final LazyInitializer initializer =
((HibernateProxy) proxy).getHibernateLazyInitializer();
return initializer.getImplementation();
}
return proxy;
}
the problem is that the variable value is retrieved as a org.jbpm.bytes.ByteArray instead of a MyClass instance!
I did some debugging and discovered that:
- in org.jbpm.context.exe.VariableContainer.getVariable(String), when org.jbpm.context.exe.VariableContainer.hasVariableLocally(String) is called, Hibernate lazily retrieves a org.jbpm.context.exe.variableinstance.ByteArrayInstance instance from the database and creates it using its empty constructor
- unfortunately, when a org.jbpm.context.exe.VariableInstance (extended by ByteArrayInstance) is constructed using its constructor, its converter instance variable remains null
- the VariableInstance converter instance variable is set to something only when a VariableInstance is created using org.jbpm.context.exe.JbpmType.newVariableInstance(), but this is not the case when a VariableInstance is lazily loaded by Hibernate; in fact, in my case, org.jbpm.context.exe.JbpmType.newVariableInstance() is never called and the converter field of my ByteArrayInstance instance is always null!
- this causes org.jbpm.context.exe.VariableInstance.getValue() to return the value given by org.jbpm.context.exe.variableinstance.ByteArrayInstance.getObject() without applying the necessary conversion (deserialization)
Please note that my variable values are stored in jBPM database in JBPM_VARIABLEINSTANCE table with the CONVERTER column correctly populated with "R".
I think this is a critical problem. By now, the only workaround I have found is to always apply the following utility method when retrieving variable values, before returning them to the client code:
public static Object extractVariableValue(final Object rawValue)
{
Object result = CardinisJbpmUtilities.getCGLIBProxiedObject(rawValue);
if(result instanceof ByteArray)
try
{
result =
new ObjectInputStream(new ByteArrayInputStream(((ByteArray) result)
.getBytes())).readObject();
}
catch(final Exception e)
{
throw new RuntimeException(e);
}
return result;
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years
[JBoss JIRA] Created: (JBPM-2345) javax/el/ExpressionFactory Linkage error
by Tom Vleminckx (JIRA)
javax/el/ExpressionFactory Linkage error
-----------------------------------------
Key: JBPM-2345
URL: https://jira.jboss.org/jira/browse/JBPM-2345
Project: JBoss jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Environment: Leopard 10.5,Tomcat6, Spring 2.5
Reporter: Tom Vleminckx
I'm having the following error when trying to integrate JBPM4 with spring. This is a runtime error when trying to deploy to tomcat.
-----------------
SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.LinkageError: loader constraint violation: when resolving interfacemethod "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExressionFactory;" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, com/sun/faces/config/ConfgureListener, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicatonContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature
at com.sun.faces.config.ConfigureListener.registerELResolverAndListenerWithJsp(ConfigureListener.java:1570)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:403)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:850)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:518)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1473)
at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:250)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Unknown Source)
...
-------------------
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years
[JBoss JIRA] Created: (JBPM-2151) no environment to get org.jbpm.session.RepositorySession
by Heiko Braun (JIRA)
no environment to get org.jbpm.session.RepositorySession
--------------------------------------------------------
Key: JBPM-2151
URL: https://jira.jboss.org/jira/browse/JBPM-2151
Project: JBoss jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Console
Reporter: Heiko Braun
Assignee: Heiko Braun
Fix For: jBPM 4.0.0.Beta1
Caused by: org.jbpm.JbpmException: no environment to get org.jbpm.session.RepositorySession
at org.jbpm.env.Environment.getFromCurrent(Environment.java:195)
at org.jbpm.env.Environment.getFromCurrent(Environment.java:188)
at org.jbpm.pvm.internal.model.ExecutionImpl.getProcessDefinition(ExecutionImpl.java:1026)
at org.jbpm.pvm.internal.model.ExecutionImpl.getProcessDefinition(ExecutionImpl.java:79)
at org.jbpm.integration.console.ModelAdaptor.adoptExecution(ModelAdaptor.java:66)
at org.jbpm.integration.console.ProcessManagementImpl.adoptTopLevelExecutions(ProcessManagementImpl.java:123)
at org.jbpm.integration.console.ProcessManagementImpl.getProcessInstances(ProcessManagementImpl.java:104)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years