Jbpm4 error Summary

Source: Internet
Author: User
Tags parse error jbpm

1. Deploying errors in tomcat6.0
Jbpm4-based Web project JSP page publishing Error
Symptom:
Javax. servlet. servletexception: Java. lang. linkageerror: loader Constraint Violation: when resolving interface method "javax. servlet. JSP. jspapplicationcontext. getexpressionfactory () ljavax/El/expressionfactory; "The Class Loader (instance of org/Apache/Jasper/servlet/jasperloader)
Of the current class, org/Apache/JSP/onduty/wfmanage_jsp, and the class loader (instance of org/Apache/Catalina/loader/standardclassloader) for resolved class, javax/servlet/JSP/jspapplicationcontext, have different class objects for the Type javax/El/expressionfactory
Used in the signature
Org. Apache. Jasper. servlet. jspservlet. Service (jspservlet. Java: 275)
Javax. servlet. http. httpservlet. Service (httpservlet. Java: 717)
...
 
Cause:
The Three jar packages (juel. jar, WEB-INF, juel-engine.jar) in the juel-impl.jar/lib in the project conflict with the jar package (el-api.jar) in the Lib under tomcat6

Solution:
Method 1: replace tomcat5.5 with no problem
Method 2: Set juel. jar, juel-engine.jar, juel-impl.jar these three packages to tomcat6 Lib, and delete the original el-api.jar, remember to put the WEB-INF/lib in juel. jar, juel-engine.jar, juel-impl.jar Delete. Otherwise, conflict is still required.

2. Unable to save (deploy) process definition files containing Chinese Characters
Symptom:
Save the process definition file
<? XML version = "1.0" encoding = "GBK"?>
<Process name = "leave" xmlns = "http://jbpm.org/4.0/jpdl">
<Start G = ",,14, 48, 48" name = "">
<Transition G = "-42,-10" name = "" to = ""/>
</Start>
...
Error message:
Malformedbytesequenceexception: Invalid byte 1 of 1-byte UTF-8 sequence.

Cause:
The XML string is parsed to Dom after the following methods:
Org. jbpm. PVM. Internal. repository. deploymentimpl:
Public newdeployment addresourcefromstring (string resourcename, string text ){
Addresourcefromstreaminput (resourcename, new stringstreaminput (text ));
Return this;
}
Public newdeployment addresourcefromstring (string resourcename, string text ){
Addresourcefromstreaminput (resourcename, new stringstreaminput (text ));
Return this;
}

Org. jbpm. PVM. Internal. Stream. stringstreaminput:
Public class stringstreaminput extends streaminput {
String string;
Public stringstreaminput (string ){
This. Name = "string ";
This. String = string;
}
Public inputstream openstream (){
Byte [] bytes = string. getbytes ();
Return new bytearrayinputstream (bytes );
}
}
Public class stringstreaminput extends streaminput {
String string;
Public stringstreaminput (string ){
This. Name = "string ";
This. String = string;
}
Public inputstream openstream (){
Byte [] bytes = string. getbytes ();
Return new bytearrayinputstream (bytes );
}
}

Org. jbpm. PVM. Internal. xml. parse:
Protected inputsource getinputsource (){
If (inputsource! = NULL ){
Return inputsource;
}
If (streaminput! = NULL ){
Inputstream = streaminput. openstream ();
Return new inputsource (inputstream );
}
Addproblem ("no source specified to parse ");
Return NULL;
}
Protected inputsource getinputsource (){
If (inputsource! = NULL ){
Return inputsource;
}
If (streaminput! = NULL ){
Inputstream = streaminput. openstream ();
Return new inputsource (inputstream );
}
Addproblem ("no source specified to parse ");
Return NULL;
}

Org. jbpm. PVM. Internal. xml. Parser:
Protected document builddom (PARSE ){
Document document = NULL;
Try {
Saxparser = saxparserfactory. newsaxparser ();
Xmlreader = saxparser. getxmlreader ();
//...

Inputsource = parse. getinputsource ();
Xmlreader. parse (inputsource );

} Catch (exception e ){
Parse. addproblem ("couldn't parse XML Document", e );
}

Return document;
}
After layers of packaging, unpacking, packaging, and unpacking, the poor string finally came to the hands of the SAX Parser. The problem is that jbpm calls string in the middle. getbytes (): This method converts the Java string (UNICODE) to the system default encoding and returns the corresponding byte []. However, when the encoding information is not set in inputsource, by default, saxparser reads the input stream in UTF-8 encoding. The default encoding of my development machine system is GBK, so there is a problem.

Solution:
String xmlstr = "<? XML version =/"1.0/" encoding =/"" + system. getproperty ("file. encoding") + "/"?> <Test name =/"name/"> </test> ";
In this example, system. getproperty ("file. encoding") is used to obtain the default system encoding so that string. getbytes () can be matched.
If you can ensure that the character set running on your Web server is GBK, you can also write
<? XML version = "1.0" encoding = "GBK"?>
<Process name = "leave" xmlns = "http://jbpm.org/4.0/jpdl">
<Start G = ",,14, 48, 48" name = "">
<Transition G = "-42,-10" name = "" to = ""/>
</Start>
...

3. Unable to save (deploy) process definition files containing Chinese Characters
Symptom:
The process definition has been successfully saved to the database, but cannot be executed,
The task name in the database table jbpm4_execution is garbled

Cause:
The root cause of the Database Job name being garbled is not the blob_value field stored in jbpm4_lob by hiberate. It is caused by a Chinese transcoding error when the JSP page is passed to the servlet process definition text. The received servlet is garbled.

Solution
1) Chinese garbled characters are displayed on the JSP page.
Use the page command in the JSP file to specify the MIME type of the response result, for example, <% @ page Language = "Java" contenttype = "text/html; charset = GBK" %>
2) garbled form submission
When submitting a form (post and get methods), use request. the getparameter method gets garbled characters because the default iso-8859-1 is used when Tomcat processes the submitted parameters. The problem of Form submission get and post processing garbled characters is different.
(1) Post Processing
You can write a filter to resolve the form submitted by post. The filter is called before the data submitted by the user is processed. You can change the parameter encoding method here. The filter code is as follows:
Java code
Package example. util;

Import java. Io. ioexception;
Import javax. servlet. filter;
Import javax. servlet. filterchain;
Import javax. servlet. filterconfig;
Import javax. servlet. servletexception;
Import javax. servlet. servletrequest;
Import javax. servlet. servletresponse;

Public class setcharacterencodingfilter implements filter {
Protected string encoding = NULL;
Protected filterconfig = NULL;
Protected Boolean ignore = true;

Public void destroy (){
This. Encoding = NULL;
This. filterconfig = NULL;
}

Public void dofilter (servletrequest request, servletresponse response,
Filterchain chain) throws ioexception, servletexception {
If (ignore | (request. getcharacterencoding () = NULL )){
String encoding = selectencoding (request );
If (encoding! = NULL ){
Request. setcharacterencoding (encoding );
}
}

// Pass control on to the next Filter
Chain. dofilter (request, response );

}
Public void Init (filterconfig) throws servletexception {

This. filterconfig = filterconfig;
This. Encoding = filterconfig. getinitparameter ("encoding ");
String value = filterconfig. getinitparameter ("Ignore ");
If (value = NULL ){
This. Ignore = true;
} Else if (value. inclusignorecase ("true ")){
This. Ignore = true;
} Else if (value. inclusignorecase ("yes ")){
This. Ignore = true;
} Else {
This. Ignore = false;
}

}

Protected string selectencoding (servletrequest request ){

Return (this. Encoding );

}

}

Add a web. xml file to the filter
<Filter>
<Filter-Name> encoding </filter-Name>
<Filter-class>
Example. util. setcharacterencodingfilter
</Filter-class>
<Init-param>
<Param-Name> encoding </param-Name>
<Param-value> GBK </param-value>
<! -- GBK, gb2312 or UTF-8 -->
</Init-param>
<Init-param>
<Param-Name> ignore </param-Name>
<Param-value> true </param-value>
</Init-param>
</Filter>
<Filter-mapping>
<Filter-Name> encoding </filter-Name>
<Servlet-Name>/* </servlet-Name>
</Filter-mapping>

(2) Get Method Processing
Tomcat has different processing methods for post and get, so the filter cannot solve the get garbled problem. It needs to be set elsewhere.
Open the server. xml file in the <tomcat_home>/conf directory, find the Settings section of the connector component for the service on port 8080, and add a property for this component: uriencoding = "GBK ". The changed ctor settings are as follows:

<Connector Port = "8080" maxhttpheadersize = "8192"
Maxthreads = "150" minsparethreads = "25" maxsparethreads = "75"
Enablelookups = "false" redirectport = "8443" acceptcount = "100"
Connectiontimeout = "20000" disableuploadtimeout = "true" uriencoding = "GBK"/>
* After modification, restart tomcat.

4. When an error occurs, all data in the database is lost.
Symptom:
After an error occurs, all data in the database is lost, including the process definition file.

Cause:
There is a configuration in the jbpm. hibernate. cfg. xml file.
<Property name = "hibernate. hbm2ddl. Auto" value = "Create-drop"/>

The meanings of several parameters are explained as follows:
Verify the structure of the created database table when loading hibernate in validate.
Create loads hibernate each time and re-creates the database table structure, which is the cause of data loss in the database table.
Create-drop is created when Hibernate is loaded. Exit is to delete the table structure
Update load hibernate automatically updates the database structure
None

The default configuration of jbpm4 is create-drop.

Solution:
Modify the jbpm. hibernate. cfg. xml file as follows:
<Property name = "hibernate. hbm2ddl. Auto" value = "NONE"/>

5. garbled characters appear in Chinese when designing the process on eclipse3.5 flow designer
Symptom:
After designing the process, click "save" and check the code. The Chinese characters are garbled.

Cause:
It should be a plug-in bug.

Solution:
After the process is designed, do not click Save. Switch the interface to the code window first. Then you can see Chinese and then click Save.

6. Unable to deploy the zip process definition file
Symptom:
The following error message is displayed:
Streams type cannot be used in batching
15:58:07 org. hibernate. event. Def. abstractflushingeventlistener extends mexecutions
Severe: cocould not synchronize database state with Session
Org. hibernate. Exception. genericjdbcexception: cocould not insert: [org. jbpm. PVM. Internal. lob. lob]

Cause:
When the data value is increased by more than 100, the hiberate exception occurs -- this means that Oracle JDBC does not allow stream operations to be executed in batches.

Solution:
Under <session-factory> In the jbpm. hibernate. cfg. xml file, add
<Property name = "hibernate. JDBC. batch_size"> 0 </property>
You can.

7. Unable to deploy zip process definition files
Symptom:
Error Message
Cocould not synchronize database state with Session
Org. hibernate. Exception. genericjdbcexception: cocould not insert: [org. jbpm. PVM. Internal. lob. lob]

Cause:
When a zip process definition file is deployed, hiberate cannot insert blob
Add the following configuration using the proposed method on the network:
<Property name = "hibernate. JDBC. batch_size"> 0 </property>
<Property name = "hibernate. JDBC. use_streams_for_binary"> true </property>
No.

Solution:
If the above method is used, it still fails. After the operating system is restarted, it will be solved, Grandma.

8. The zip process definition file is deployed successfully, but Chinese characters in the database are garbled.
Symptom:
<? XML version = "1.0" encoding = "GBK"?>
<Process name = "leave" xmlns = "http://jbpm.org/4.0/jpdl">
<Start G = ",,14, 48, 48" name = "">
<Transition G = "-42,-10" name = "" to = ""/>
</Start>
...
The XML file header is <? XML version = "1.0" encoding = "GBK"?>
The process definition ZIP file containing Chinese characters has been successfully saved to the Blob field, but the Chinese name is garbled
Or an XML Parse error is prompted, which cannot be saved to the database.

Cause:
Repositoryservice. createdeployment (). addresourcesfromzipinputstream (New zipinputstream (item. getinputstream (). Deploy ();
In the previous sentence alone, I don't know how many codes have been transferred. After testing, I found that the encoding method is still a problem. Finally, I decided to copy the source code of jbpm4.2 to the Project for debugging.

Solution:
I found this article on the Internet: compression and decompression in Java-solutions to garbled Chinese file names
The problem still persists.
Finally, after testing, modify the methods in the org. jbpm. PVM. Internal. repository. deploymentimpl class.
Public newdeployment addresourcesfromzipinputstream (cnzipinputstream zipinputstream ){
Try {
Zipentry = zipinputstream. getnextentry ();
While (zipentry! = NULL ){
String entryname = zipentry. getname ();
Byte [] bytes = ioutil. readbytes (zipinputstream );

// If it is a process definition file (not an image), recode and generate a byte array.
If (entryname. endswith (". xml ")){
String S = new string (bytes, "UTF-8 ");
Bytes = S. getbytes ();
}

If (Bytes! = NULL ){
Addresourcefromstreaminput (entryname, new bytearraystreaminput (bytes ));
}
Zipentry = zipinputstream. getnextentry ();
}
} Catch (exception e ){
Throw new jbpmexception ("couldn't read ZIP Archive", e );
}
Return this;
}
Solution to the problem, it is certainly the beginning of a step encoding method is to use UTF-8, in the middle of you is how to use GBK transcoding, will not succeed, here first use UTF-8 encoding to generate a string, encode the code again.

References
1. dzq2008. jbpm4 project and tomcat6.0 compatibility issues-http://dzq0371.javaeye.com/blog/509632
2. encountered the jbpm encoding problem. http://rednaxelafx.javaeye.com/blog/522436
3. How to Solve Tomcat Chinese garbled problem. http://www.javaeye.com/topic/251743? Page = 1
4. About hibernate a configuration parameter hibernate. hbm2ddl. Auto. http://linshiquan.javaeye.com/blog/263170

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.