Cannot construct java type from string error


#1

Hi,

I deployed a process before and worked well. But now I change in BPMN and when deploying this new version and start a process instance with REST-API, I got 500 internal server error with below message:

"Cannot instantiate process definition first-archive:2:1adca1f5-53f1-11e7-ac84-6451060de7a8: Error while evaluating expression:Get file of ${session.getSessionName()}. Cause: Cannot deserialize object in variable 'session': SPIN/JACKSON-JSON-01007 Cannot construct java type from string 'com.bayan.bpm.firstarchive.models.ArchiveSession'"

I have ArchiveSession in my war file too and this worked before without any problems.

I run Tomcat with SQL-Server and version 7.7 on Camunda

Thanks in advanced


#2

Hi @Sadegh,

what did you change in your BPMN diagram?
It seems like ArchiveSession class is not visible.

Cheers,
Tassilo


#3

Hi @tasso94 ,

I recheck it, my class is public and it exists in WEB-INF/classes. and I didn’t any change to this file or another Java class in my project just change in BPMN file.

I think that my problem is bigger than it because when I deploy exactly same war file this error occurred too.

And for solving this I must reset Camunda service on my server and delete all deploys and deploy the last one again. and with this work, all process instances will be deleted.

But after deleting before deploys and reset the server and deploy the new version everything works well.

This is full error log from Catalina: https://pastebin.com/kjxi94u9

I change SQL-Server to H2 and check it again and this problem is there too.

This problem makes very bad situations for me.

Thanks for your reply in advance


#4

And another problem is when I restart the Camunda service, deploy the new version and last version again.

I mean after each restart Definition Version shows new deploy (For example after 3 restarts I have below situation)

Please help me for solving this problem.

Thanks


#5

Hi @Sadegh,

So your problem occurs again after a while? Could you provide me a minimal project which reproduces the problem?

This is an expected behaviour. Whenever you redeploy your process definition, a new version will be created.

Cheers,
Tassilo


#6

Hi Dear @tasso94 ,

Thanks for your reply.

The BPMN file is first-archive.bpmn (53.9 KB)

The class that Camunda can’t find that for deserializing is below:

package com.bayan.bpm.firstarchive.models;

public class ArchiveSession {

protected String sessionName;

protected long clientId;

protected String firstArchiveOwner;

private boolean useForDVD;
private boolean useForAudioCD;
private boolean useForMP3;
private boolean useForMP4;
private boolean useForSpecialTips;



public long getClientId() {
	return clientId;
}

public void setClientId(long clientId) {
	this.clientId = clientId;
}

public String getFirstArchiveOwner() {
	return firstArchiveOwner;
}

public void setFirstarchiveowner(String firstarchiveowner) {
	this.firstArchiveOwner = firstarchiveowner;
}

public String getSessionName() {
	return sessionName;
}

public void setSessionName(String sessionName) {
	this.sessionName = sessionName;
}

public boolean isUseForDVD() {
	return useForDVD;
}

public void setUseForDVD(boolean useForDVD) {
	this.useForDVD = useForDVD;
}

public boolean isUseForAudioCD() {
	return useForAudioCD;
}

public void setUseForAudioCD(boolean useForAudioCD) {
	this.useForAudioCD = useForAudioCD;
}

public boolean isUseForMP3() {
	return useForMP3;
}

public void setUseForMP3(boolean useForMP3) {
	this.useForMP3 = useForMP3;
}

public boolean isUseForMP4() {
	return useForMP4;
}

public void setUseForMP4(boolean useForMP4) {
	this.useForMP4 = useForMP4;
}

public boolean isUseForSpecialTips() {
	return useForSpecialTips;
}

public void setUseForSpecialTips(boolean useForSpecialTips) {
	this.useForSpecialTips = useForSpecialTips;
}
}

And below is application file:

package com.bayan.bpm.firstarchive;

import org.camunda.bpm.application.ProcessApplication;
import org.camunda.bpm.application.impl.ServletProcessApplication;

@ProcessApplication("First Archive App")
public class FirstArchiveApplication extends ServletProcessApplication{

}

the processes.xml is:

<?xml version="1.0" encoding="UTF-8" ?>

<process-application
	xmlns="http://www.camunda.org/schema/1.0/ProcessApplication"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <process-archive name="first-archive">
	<process-engine>default</process-engine>
	<properties>
	  <property name="isDeleteUponUndeploy">false</property>
	  <property name="isScanForProcessDefinitions">true</property>
	</properties>
  </process-archive>

</process-application>

and the POM.xml file:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.bayan.bpm.firstarchaive</groupId>
  <artifactId>first-archive</artifactId>
  <version>0.1.2</version>
  <packaging>war</packaging>
  
	<dependencyManagement>
	<dependencies>
	  <dependency>
		<groupId>org.camunda.bpm</groupId>
		<artifactId>camunda-bom</artifactId>
		<version>7.7.0</version>
		<scope>import</scope>
		<type>pom</type>
	  </dependency>
	</dependencies>
  </dependencyManagement>

  
  <dependencies>
  <dependency>
	  <groupId>org.camunda.bpm</groupId>
	  <artifactId>camunda-engine</artifactId>
	  <scope>provided</scope>
	</dependency>
	
	<dependency>
	  <groupId>javax.servlet</groupId>
	  <artifactId>javax.servlet-api</artifactId>
	  <version>3.0.1</version>
	  <scope>provided</scope>
	</dependency>
  </dependencies>

  <build>
	<plugins>
	  <plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-war-plugin</artifactId>
		<version>2.3</version>
		<configuration>
		  <failOnMissingWebXml>false</failOnMissingWebXml>
		</configuration>
	  </plugin>
	</plugins>
  </build>
  </project>

Thanks in advanced.


#7

Hi @Sadegh,

sorry for my late reply and thank you for providing the project sources.

At the first glance I cannot see any problem regarding your project sources.
Does your problem appear on a periodical basis or arbitrary?

Cheers,
Tassilo