EAR中,有EJB和WAR工程,war中的servlet调用EJB提示下面错误:
GatewayService threw exception: java.lang.VerifyError: (class: xxx/xxx/xxx, method: init signature: ()V) Incompatible object argument for function call
在EAR的LIB目录下,存在包含xxx/xxx/xxx的jar,并且初步进行check,没有发现存在相同名称的类。xxx/xxx/xx部分代码如下:
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.xerces.parsers.AbstractDOMParser;
import org.apache.xerces.parsers.DOMParser;
import org.apache.xml.serialize.BaseMarkupSerializer;
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
import org.hibernate.lob.SerializableBlob;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import org.xml.sax.InputSource;
import slot.base64.Base64Encoder;
import slot.common.Log;
import slot.exception.GeneralException;
import slot.util.DateUtil;
public class MessageObject
implements MsgConstant, Serializable
{
private DOMParser parser = new DOMParser();
private Document document;
private DocumentBuilder builder = null;
private Element root;
private Node header = null;
private Node extAttrs = null;
private Node request = null;
private Node response = null;
private Node body = null;
private boolean bindingRequest = false;
static Class class$0;
public MessageObject()
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
this.builder = factory.newDocumentBuilder();
DOMImplementation impl = this.builder.getDOMImplementation();
this.document = impl.createDocument(null, “Message”, null);
this.root = this.document.getDocumentElement();
this.header = setChildValueByName(this.root, “”, “Header”);
this.body = setChildValueByName(this.root, “”, “Body”);
this.extAttrs = setChildValueByName(this.header, “”, “ext_attributes”);
this.request = setChildValueByName(this.body, “”, “request”);
this.response = setChildValueByName(this.body, “”, “response”);
impl = null;
this.builder = null;
}
catch (Exception e) {
e.printStackTrace();
}
}
public MessageObject(byte[] bytesinput)
throws Exception
{
ByteArrayInputStream bais = new ByteArrayInputStream(bytesinput);
InputSource ins = new InputSource(bais);
ins.setEncoding(“UTF-8”);
this.parser.parse(ins);
bais.close();
ins = null;
init();
}
在调用 MessageObject(byte[] bytesinput)构造函数出现上面的错误,无解。
初步判断是类加载器问题,根据网上资料加了
jboss-app.xml和jboss-web.xml(前者放在ear压缩包中的META-INF目录下,后者是放到WAR包中META-INF目录下)
GatewayService threw exception: java.lang.VerifyError: (class: xxx/xxx/xxx, method: init signature: ()V) Incompatible object argument for function call
在EAR的LIB目录下,存在包含xxx/xxx/xxx的jar,并且初步进行check,没有发现存在相同名称的类。xxx/xxx/xx部分代码如下:
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.xerces.parsers.AbstractDOMParser;
import org.apache.xerces.parsers.DOMParser;
import org.apache.xml.serialize.BaseMarkupSerializer;
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
import org.hibernate.lob.SerializableBlob;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import org.xml.sax.InputSource;
import slot.base64.Base64Encoder;
import slot.common.Log;
import slot.exception.GeneralException;
import slot.util.DateUtil;
public class MessageObject
implements MsgConstant, Serializable
{
private DOMParser parser = new DOMParser();
private Document document;
private DocumentBuilder builder = null;
private Element root;
private Node header = null;
private Node extAttrs = null;
private Node request = null;
private Node response = null;
private Node body = null;
private boolean bindingRequest = false;
static Class class$0;
public MessageObject()
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
this.builder = factory.newDocumentBuilder();
DOMImplementation impl = this.builder.getDOMImplementation();
this.document = impl.createDocument(null, “Message”, null);
this.root = this.document.getDocumentElement();
this.header = setChildValueByName(this.root, “”, “Header”);
this.body = setChildValueByName(this.root, “”, “Body”);
this.extAttrs = setChildValueByName(this.header, “”, “ext_attributes”);
this.request = setChildValueByName(this.body, “”, “request”);
this.response = setChildValueByName(this.body, “”, “response”);
impl = null;
this.builder = null;
}
catch (Exception e) {
e.printStackTrace();
}
}
public MessageObject(byte[] bytesinput)
throws Exception
{
ByteArrayInputStream bais = new ByteArrayInputStream(bytesinput);
InputSource ins = new InputSource(bais);
ins.setEncoding(“UTF-8”);
this.parser.parse(ins);
bais.close();
ins = null;
init();
}
在调用 MessageObject(byte[] bytesinput)构造函数出现上面的错误,无解。
初步判断是类加载器问题,根据网上资料加了
jboss-app.xml和jboss-web.xml(前者放在ear压缩包中的META-INF目录下,后者是放到WAR包中META-INF目录下)
解决方案
40
GatewayService threw exception: java.lang.VerifyError: (class: xxx/xxx/xxx, method: init signature: ()V) Incompatible object argument for function call
是参数类型不匹配 ,看看调用ejb的代码怎么写的
是参数类型不匹配 ,看看调用ejb的代码怎么写的