本文介绍了Wicket Jetty与Quickstart中的Start.java集成停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将我(正在工作)的检票口项目签到了新的开发机器上,每当尝试启动码头时,突然出现此错误.

I just checked out my (working) wicket project to a new development machine and all of a sudden I get this error whenever I try to start jetty.

java.lang.NoClassDefFoundError: net/unbewaff/Start
Caused by: java.lang.ClassNotFoundException: net.unbewaff.Start
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Exception in thread "main" 

类文件在那里,当我删除文件时,eclipse会重建它.未找到的类是包含我要尝试运行并应启动嵌入式码头的主要方法的类.甚至将其CD到目录中,查看文件并在命令行上键入java Start.class都会产生相同的错误,但措辞略有不同.

The class file is there and eclipse rebuilds it, when I delete the file. The class not found is the one containing the main method I'm trying to run and supposed to start the embedded jetty. Even cd'ing to the directory, seeing the file and typing java Start.class onto the command line gives the same error with a slightly different wording.

检票口和嵌入式码头-classNotFoundException 似乎相关,但与那里描述的错误是在加载Start-class之后发生的.

Wicket and embedded jetty - classNotFoundException seems to be related but isn't as the error described there happens later and after loading the Start-class.

我做了什么:

  1. 从存储库中签出项目
  2. 运行mvn全新安装
  3. 运行mvn eclipse:eclipse
  4. 在eclipse中创建了项目
  5. 试图启动应用
  6. 撞墙

老实说,我不认为这是一个检票口或码头问题,但是由于他们都以某种方式参与其中,所以我希望有人解决了这个问题...

I honestly don't think that this is a wicket or jetty problem, but since they're both involved somehow, I hope there is someone who had and solved this problem...

我检查过的事情:

  • 该文件确实确实存在,它是当前文件并且可读
  • 我试图看看没有运气(ERROR:Could not find Start.class)的调用javap Start.class的字节码
  • 使用文本编辑器打开类文件(看起来是正确的二进制文件")
  • 运行mvn jetty:run(与网络应用程序一起启动并运行码头)
  • The file is really really there, it's current and readable
  • I tried to have a look at the bytecode calling javap Start.class without luck (ERROR:Could not find Start.class)
  • opened the class file using a text editor (looks 'propperly binary')
  • running mvn jetty:run (Starts and runs jetty along with the webapp)

什么帮助了:

正如Martijn所建议的,我获得了一个全新的快速入门,并比较了入门班.快速入门中的一个很好用,我的差异工具和我发现的唯一区别是更改了连接器上的端口,但是快速入门中的类接受了这些,没有任何问题.然后,我将类从快速入门复制到我的项目中,并且在Dummy.java的名称下运行良好.删除有问题的类之后,清理工作区并将其重命名为Start.java,它将停止工作.将其重命名为Dummy可以使其恢复工作状态.

As Martijn suggested, I grabbed a fresh quickstart and compared the Start-classes. The one from the quickstart worked just fine and the only differences my diff-tool and I could find were changed ports on the connector but the class from the quickstart accepted these without any issues. Then I copied the class from the quickstart to my project and it worked fine under the name of Dummy.java. After deleting the offending class, cleaning the workspace and renaming it to Start.java it stopped working. Renaming it back to Dummy put it back to working conditions.

所以我有了一个可行的解决方法,尽管仍然不知道出什么问题了.

So I got a working workaround, while still not knowing, what was wrong.

推荐答案

在您的Start类中没有找到您引用的东西:它是ClassDefNotFoundException,这是最难解决的错误之一.这样可以防止类加载器加载您的Start类.

There is something you reference in your Start class that is not being found: it is a ClassDefNotFoundException, which is one of the hardest errors to solve. It prevents the class loader from loading your Start class.

前进的最佳方法是IMO生成一个新的快速入门,运行它,然后将内容从您自己的入门班级转移到快速入门班,直到其中断.

The best way to go forward would IMO be to generate a new quick start, run it, and move stuff from your own start class to the quick start one until it breaks.

这篇关于Wicket Jetty与Quickstart中的Start.java集成停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 16:45