ClassNotFoundException的只有JAR签署 [英] ClassNotFoundException only if JAR is signed

查看:123
本文介绍了ClassNotFoundException的只有JAR签署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个难题!

我有一个JAR的小程序。当JAR签署 - 无论是自签署的或与DigiCert sertificate - 我收到了的ClassNotFoundException 主applet类。
当我的的签名Applet,它加载就好了 - (不包括预期的 SecurityException异常由于code不被签名)。

但我可以解压签名的JAR和发现一切是它应该是。

最奇怪的是,直到上周的设立工作就好了。
同一主类,自签名,JS / HTML等。

的相同的部署结构

有什么想法?

以下是错误消息:

 抛出java.lang.ClassNotFoundException:com.spraklab.ilos.applet.Applet
在sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:195)
在sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:249)
在sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:179)
在sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:160)
在java.lang.ClassLoader.loadClass(ClassLoader.java:247)
在sun.plugin2.applet.Plugin2ClassLoader.load code(Plugin2ClassLoader.java:690)
在sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:3045)
在sun.plugin2.applet.Plugin2Manager $ AppletExecutionRunnable.run(Plugin2Manager.java:1497)
在java.lang.Thread.run(Thread.java:680)


解决方案

短版:
没有连字符在JAR-名字!

戏剧性的故事:
最后!问题后,许多工作日内被发现了。
签约时,小应用程序加载的罚款不签字的时候,花苞的ClassNotFoundException。
关于类加载器的切换的答案使我相信,有一些我已经在我的code改变。所以我剥夺我的code降到minumum。
但要避免重新启动我的浏览器所有的时间和清空缓存等等,我只是用Chrome浏览器隐身模式。我重建了code。而一切都在最后的罚款。不!
当我再测试了隐姓埋名之外,我再次得到了错误。

那么是什么区别?服务器日志的检查表明,该罐没有被从服务器请求只需在普通模式下!
我再次相比,我的code针对不同的应用程序类似嵌入code,看见只有一个区别:我是用连字符在JAR名下划线代替 - 这应该是允许的,并它已经工作得很好,直到大约两周前。
但不是还有约2周前一个Java更新...?!?!

It is a conundrum!

I have an applet in a JAR. When JAR is signed - be it self-signed or with a DigiCert sertificate - I get a ClassNotFoundException on the main applet class. When I don't sign the applet, it loads just fine - (not counting the expected SecurityException due to the code not being signed).

But I can unpack the signed JAR and find everything to be where it is supposed to be.

The strangest part is that up until last week the set-up worked just fine. Same main class, self-signed, same deployment mix of JS/HTML etc.

Any thoughts?

Here is the error message:

java.lang.ClassNotFoundException: com.spraklab.ilos.applet.Applet
at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:195)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:249)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:179)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plugin2ClassLoader.java:690)
at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:3045)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1497)
at java.lang.Thread.run(Thread.java:680)

解决方案

Short version: No hyphens in JAR-names!

The dramatic story: Finally! Many work-days after the problem was discovered. The applet loaded fine when not signed, bud ClassNotFoundException when signed. The answer about the switching of classloaders led me to believe that there was something I had changed in my code. So I stripped my code down to a minumum. But to avoid having to restart my browser all the time and empty the cache etc, I simply used the incognito-mode of Chrome. I rebuilt the code. And everything was fine in the end. Not! When I then tested it outside of incognito, I got the error again.

So what was the difference? An examination of the server logs showed that the Jar simply wasn't being requested from the server when in regular mode! I compared my code once again against an different app with similar embed-code, and saw only one difference: I was using a hyphen in stead of an underscore in the JAR-name - which should be allowed, and which had worked fine up until about 2 weeks ago. But wasn't there also a Java update about 2 weeks ago ...?!?!

这篇关于ClassNotFoundException的只有JAR签署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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