使用Web服务的Eclipse提供了java.lang.reflect.InvocationTargetException

时间:2013-05-02 22:42:28

标签: java eclipse web-services apache axis

想要一些帮助。我已经花了很多时间试图解决这个问题,在网上搜索,一些网站 - 以及一些问题 - 但仍然没有答案。任何帮助将不胜感激。

我不是那个意味着专家,所以有些信息可能含糊不清我会尽量用最好的术语来描述问题。

当我尝试使用Eclipse时使用Eclipse创建的Web服务,使用Apache Tomcat 6时,它会给我一个错误:

  

正文内容无法在表单视图中显示。请切换到源视图以检查原始内容。

我测试了webservice(11种方法)作为Java应用程序和JUnit测试,它很好。这些方法在MYSQL上的数据库中删除,添加,修改和搜索某些信息。正如我所说,这些方法可以作为Java应用程序正常运行。

我尝试在不同的项目上生成客户端。如果我尝试从客户端使用Web服务,它会给我这个错误:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: java.lang.reflect.InvocationTargetException
 faultActor: 
 faultNode: 
 faultDetail: 
    {http://xml.apache.org/axis/}hostname:Mauricio-PC

java.lang.reflect.InvocationTargetException
    at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)  at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at client.ServicioSoapBindingStub.ingresarAlumnoCurso(ServicioSoapBindingStub.java:488)
at client.ServicioProxy.ingresarAlumnoCurso(ServicioProxy.java:80)
at client.Prueba.main(Prueba.java:19) 

我记得有人说这是因为我的主机名称为“Mauricio-PC”而Tomcat无法识别它。但我真的不知道这是不是真的。

所以,非常感谢任何帮助。随意提出任何问题。

感谢。

编辑:我创建了另一个名为ServicioCapacitacion而不是SistemaCapacitacion的项目。相同的文件。我重新导入了.jars。

所以我有这个库:

Library Apache Tomcat v6.0:
  annotations-api.jar
  catalina-ant.jar
  catalina-ha.jar
  catalina-tribes.jar
  catalina.jar
  ecj-3.7.2.jar
  el-api.jar
  gson-2.2.3.jar
  jasper-el.jar
  jasper.jar
  jsp-api.jar
  mysql-connector-java-5.1.25-bin.jar
  orm.jar
  servlet-api.jar
  tomcat-coyote.jar
  tomcat-dbcp.jar
  tomcat-i18n-es.jar
  tomcat-i18n-fr.jar
  tomcat-i18n-ja.jar

JRE System Library:
  resources.jar
  rt.jar
  jsse.jar
  jce.jar
  charsets.jar
  jfr.jar
  access-bridge-64.jar
  dnsns.jar
  jaccess.jar
  localedata.jar
  sunec.jar
  sunjce_provider.jar
  sunmscapi.jar
  zipfs.jar

JUnit 4:

  junit.jar
  org.hamcrest.core_1.1.0.v20090501071000.jar

Web App Libraries:
  axis.jar
  commons-discovery-0.2.jar
  commons-logging.jar
  jaxrpc.jar
  saaj.jar
  wsdl4j.jar



gwt-dev.jar    <- These are alone, not inside any Library
gwt-servlet.jar
mail.jar

AND目录WebContent&gt; WEB-INF&gt; lib中有以下库:

axis.jar
commons-discovery-0.2.jar
commons-logging.jar
jaxrpc.jar
saaj.jar
wsdl4j.jar

我知道这些库已经重复了,我的问题是,我是否必须删除其中一个组?我可以消除/移动哪个组以及我保留哪个组?是否有“好”的方法来删除它们?

本地主机的新显示:8080 / ServicioCapacitacion / index.jsp

Estado HTTP 500 - javax.servlet.ServletException: java.lang.ExceptionInInitializerError

type Informe de Excepción

mensaje javax.servlet.ServletException: java.lang.ExceptionInInitializerError

descripción El servidor encontró un error interno que hizo que no pudiera rellenar este requerimiento.

excepción

org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.ExceptionInInitializerError
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:412)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
causa raíz

javax.servlet.ServletException: java.lang.ExceptionInInitializerError
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:865)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:71)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
causa raíz

java.lang.ExceptionInInitializerError
    negocio.Capacitacion.verActa(Capacitacion.java:329)
    servicio.Servicio.verActa(Servicio.java:70)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:62)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
causa raíz

org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.) (Caused by org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.))
    org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
    org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
    org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
    org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
    org.orm.PersistentManager.<clinit>(PersistentManager.java:34)
    negocio.Capacitacion.verActa(Capacitacion.java:329)
    servicio.Servicio.verActa(Servicio.java:70)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:62)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
causa raíz

org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.)
    org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
    org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
    org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
    org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
    org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
    org.orm.PersistentManager.<clinit>(PersistentManager.java:34)
    negocio.Capacitacion.verActa(Capacitacion.java:329)
    servicio.Servicio.verActa(Servicio.java:70)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:62)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
causa raíz

org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.
    org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:385)
    org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
    org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
    org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
    org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
    org.orm.PersistentManager.<clinit>(PersistentManager.java:34)
    negocio.Capacitacion.verActa(Capacitacion.java:329)
    servicio.Servicio.verActa(Servicio.java:70)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:62)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
nota La traza completa de la causa de este error se encuentra en los archivos de diario de Apache Tomcat/6.0.36.

Apache Tomcat/6.0.36

1 个答案:

答案 0 :(得分:1)

JSP文件:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Test JSP</title>
</head>
<body>
HI THERE!
<%= new servicio.Servicio().verActa("1", "1") %>
</body>
</html>

将其命名为index.jsp 将其添加到您的WebContent\文件夹中。确保没有其他名为indexdefault的文件。

现在转到:http://youserver/SistemaCapacitacion/