java.lang.NoClassDefFoundError:org / apache / commons / discovery / tools / DiscoverSingleton [英] java.lang.NoClassDefFoundError: org/apache/commons/discovery/tools/DiscoverSingleton

查看:564
本文介绍了java.lang.NoClassDefFoundError:org / apache / commons / discovery / tools / DiscoverSingleton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用jsf在jsp文件中创建了一个注册表单,我尝试将其与Web服务连接,以便将这些元素传递给数据库。



当我按下提交按钮时,我收到错误消息。我不认为问题涉及连接代码,但我不确定。



有人能告诉我一些可能在某种程度上对我有帮助吗?



错误:

  javax.servlet.ServletException:#{formabean.submitdetails}:java.lang.NoClassDefFoundError:org / apache / commons / discovery / tools / DiscoverSingleton 
javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

我的表格jsp:

 <%@ page contentType =text / htmlpageEncoding =UTF-8%> 

<%@ taglib prefix =furi =http://java.sun.com/jsf/core%>
<%@ taglib prefix =huri =http://java.sun.com/jsf/html%>

<!DOCTYPE HTML PUBLIC - // W3C // DTD HTML 4.01 Transitional // EN
http://www.w3.org/TR/html4/loose。 DTD>

< f:view>
< html>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = UTF-8/>
< title>表单< / title>
< / head>
< body>
< div align =right>
< p>
< br> .............
< h:commandButton value =submittype =submit
action =#{formabean .submitdetails}/>


< / h:form>

< / body>
< / html>
< / f:view>

我的Bean类formavar:

  package org.forma; 

import org.imigrant.Migration.MigrationResult;
import org.imigrant.Migration.MigrationWS_PortType;
import org.imigrant.Migration.MigrationWS_Service;
import org.imigrant.Migration.MigrationWS_ServiceLocator;

/ **用于Web服务的库* /
/ **
*
* @author USER
* /
公共类formavar {

私人字符串名称;
private String lastname; .....
public String getName(){
return name;
}

/ **
* @param将名称设置为
* /
public void setName(String name){
this.name = name;
}

/ **
* @return姓氏
* /
public String getLastname(){
return lastname;
}

/ **
* @param surname姓氏设置
* /
public void setLastname(String lastname){
this.lastname = lastname;
} ......
public String submitdetails(){
String migrationURL =http:// localhost:8080 / mule-tomcat / ESB / Migration?wsdl;
MigrationResult registrationResult = new MigrationResult();

try {

MigrationWS_Service service = new MigrationWS_ServiceLocator(migrationURL);
MigrationWS_PortType port = service.getMigrationImplPort();

registrationResult = port.registerDoc(
null,
this.granting,
this.expire_date,
this.name,
this。姓氏,.............

);


返回OK;

} catch(Exception ex){


返回ERROR+ ex.getMessage();
}


//返回OK;
}
}

和config xml:

 < managed-bean> 
< managed-bean-name> formabean< / managed-bean-name>
< managed-bean-class> org.forma.formavar< / managed-bean-class>
< managed-bean-scope> request< / managed-bean-scope>
< / managed-bean>


解决方案


java.lang。 NoClassDefFoundError:org / apache / commons / discovery / tools / DiscoverSingleton


这只是意味着提到的类(或包含的JAR文件) Web应用程序的运行时类路径中缺少类。



当包名称提示时,该类是Apache Commons Discovery的一部分,可从 http://commons.apache.org/discovery 。如果您只是将其JAR文件放在您的webapp的 / WEB-INF / lib 中(由webapp的运行时类路径覆盖),则此错误应该消失。 / p>

请注意,这个问题与JSF / JSP有很多没有,更不用说Java EE了。它只是基本的Java。异常的根本原因也暗示;它是 java.lang 包。


I have create a registration form in jsp file with jsf and I try to connect it with a web service in order to pass through this the elements to a database.

When I press submit button I get an error. I don't think that the problem concerns the connection code but I'm not sure.

Can anybody tell me something that maybe helps me in some way?

error:

javax.servlet.ServletException: #{formabean.submitdetails}: java.lang.NoClassDefFoundError: org/apache/commons/discovery/tools/DiscoverSingleton
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
     org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

my form jsp:

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>Form</title>
        </head>
        <body>
            <div align="right" >
                <p>
                    <br>.............
<h:commandButton value="submit" type="submit" 
                                 action="#{formabean.submitdetails}" />


            </h:form>

        </body>
    </html>
</f:view>

my Bean class "formavar":

package org.forma;

import org.imigrant.Migration.MigrationResult;
import org.imigrant.Migration.MigrationWS_PortType;
import org.imigrant.Migration.MigrationWS_Service;
import org.imigrant.Migration.MigrationWS_ServiceLocator;

/** libraries for Web Service*/
/**
 *
 * @author USER
 */
public class formavar {

    private String name;
    private String lastname;.....
 public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the surname
     */
    public String getLastname() {
        return lastname;
    }

    /**
     * @param surname the surname to set
     */
    public void setLastname(String lastname) {
        this.lastname = lastname;
    }......
 public String submitdetails() {
        String migrationURL = "http://localhost:8080/mule-tomcat/ESB/Migration?wsdl";
        MigrationResult registrationResult = new MigrationResult();

        try {

            MigrationWS_Service service = new MigrationWS_ServiceLocator(migrationURL);
            MigrationWS_PortType port = service.getMigrationImplPort();

            registrationResult = port.registerDoc(
                null,
                this.granting,
                this.expire_date,
        this.name,
        this.lastname,.............

                    );


            return "OK";

        } catch (Exception ex) {


            return "ERROR "+ex.getMessage();
        }


        //return "OK";
    }
}

and the config xml:

 <managed-bean>
        <managed-bean-name>formabean</managed-bean-name>
        <managed-bean-class>org.forma.formavar</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>

解决方案

java.lang.NoClassDefFoundError: org/apache/commons/discovery/tools/DiscoverSingleton

This just means that the mentioned class (or a JAR file containing the class) is missing in the webapp's runtime classpath.

As the package name hints, the class is part of Apache Commons Discovery which is available for download at http://commons.apache.org/discovery. If you just drop its JAR file(s) in /WEB-INF/lib of your webapp (which is covered by webapp's runtime classpath), then this error should disappear.

Note that this problem has nothing to do with JSF/JSP, let alone Java EE. It's just basic Java. The root cause of the exception also hints that; it's of the java.lang package.

这篇关于java.lang.NoClassDefFoundError:org / apache / commons / discovery / tools / DiscoverSingleton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆