安装Vaadin后获取NoClassDefFoundError

时间:2013-10-28 03:33:38

标签: java eclipse vaadin vaadin7 ivyde

我想使用Vaadin做一个项目并面临一些问题。这就是我所做的。

我下载了Eclipse并安装了Vaadin for Eclipse插件。然后,我创建了一个新的Vaadin 7项目。它下载了一些常春藤依赖项,但是当我按下Run时,我收到此错误:java.lang.NoClassDefFoundError:com / vaadin / server / VaadinServlet。

我在互联网上搜索了一下但无济于事。有一点是在web-app的WEB-INF / lib文件夹中,没有jar。我附上了错误的屏幕截图以及web.xml和ivy.xml。

enter image description here

的ivy.xml:

<?xml version="1.0"?>
<!DOCTYPE ivy-module [
    <!ENTITY vaadin.version "7.1.7">
]>

<ivy-module version="2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
    <info organisation="com.example" module="v7proj" />
    <configurations>
        <!-- The default configuration, which should be deployed to the server -->
        <conf name="default" />
        <!-- A configuration only needed when compiling the widget set. Should 
            not be deployed to the server -->
        <conf name="widgetset-compile" />
        <!-- A configuration used in compilation of server side classes only.
            Should be deployed to the server -->
        <conf name="nodeploy" />
    </configurations>
    <dependencies defaultconf="default" defaultconfmapping="default->default">
        <!-- The core server part of Vaadin -->
        <dependency org="com.vaadin" name="vaadin-server" rev="&vaadin.version;" />

        <!-- Vaadin themes -->
        <dependency org="com.vaadin" name="vaadin-themes" rev="&vaadin.version;" />

        <!-- Push support -->
        <dependency org="com.vaadin" name="vaadin-push" rev="&vaadin.version;" />

        <!-- Servlet 3.0 API -->
        <dependency org="javax.servlet" name="javax.servlet-api" rev="3.0.1" conf="nodeploy->default" />

        <!-- Precompiled DefaultWidgetSet -->
        <dependency org="com.vaadin" name="vaadin-client-compiled"
            rev="&vaadin.version;" />

        <!-- Vaadin client side, needed for widget set compilation -->
        <dependency org="com.vaadin" name="vaadin-client" rev="&vaadin.version;"
             conf="widgetset-compile->default" />

        <!-- Compiler for custom widget sets. Should not be deployed -->
        <dependency org="com.vaadin" name="vaadin-client-compiler"
            rev="&vaadin.version;" conf="widgetset-compile->default" />
    </dependencies>
</ivy-module>

ivysettings.xml:

<?xml version="1.0" encoding="UTF-8"?>
<ivysettings>
    <settings defaultResolver="default" />
    <resolvers>
        <chain name="default">
            <!-- Public Maven repository -->
            <ibiblio name="public" m2compatible="true" />

            <!-- Vaadin Add-on repository -->
            <ibiblio name="vaadin-addons" usepoms="true" m2compatible="true"
                root="http://maven.vaadin.com/vaadin-addons" />

            <!-- Vaadin snapshots repository -->
            <ibiblio name="vaadin-snapshots" usepoms="true" m2compatible="true"
                root="https://oss.sonatype.org/content/repositories/vaadin-snapshots" />
            <!-- Repository used for Vaadin modified smartsprites library -->
            <dual name="custom-smartsprites">
                <filesystem name="smartsprites-ivy">
                    <ivy pattern="${basedir}/ivymodule/[module]-ivy-[revision].xml" />
                </filesystem>
                <url name="smartsprites-artifact">
                    <artifact
                        pattern="http://dev.vaadin.com/svn/versions/6.8/build/smartsprites/lib/[artifact](-[revision]).[ext]" />
                </url>
            </dual>
        </chain>
    </resolvers>
    <modules>
        <!-- Vaadin patched SmartSprites -->
        <module organisation="com.carrotsearch" name="smartsprites"
            revision="0.2.3-itmill" resolver="custom-smartsprites" />
    </modules>


</ivysettings>

的web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>ScanAir</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

请帮忙。我基本上没有开始编码。我使用的是带有Java 7u45,Eclipse Kepler SR1和Vaadin 7.1.7的Windows 8.1 Pro x64

2 个答案:

答案 0 :(得分:6)

在stackoverflow上,有许多关于此错误异常的问题和更多答案。

看一下这个好的网页:http://javareferencegv.blogspot.ch/2013/10/debugging-javalangnoclassdeffounderror.html

  

有一点是在web-app的WEB-INF / lib文件夹中,没有   广口瓶中。

这是一个很好的起点。

在eclipse中看看你的项目属性。有一个称为“部署程序集”的点,它至少应包含这两个条目:

/src          -> WEB-INF/classes
/WebContent   -> /

此外,您必须将项目添加到tomcat服务器实例。

答案 1 :(得分:1)

https://vaadin.com/forum/message/2534863

你能做的是

1)右键单击项目并选择属性 2)选择部署程序集 3)单击“添加” 4)选择Java Build Path Entries 5)加入常春藤图书馆。