简体   繁体   English

不兼容的魔法值 1008813135

[英]Incompatible magic value 1008813135

I am writing a Java applet and embedding it in a web page.我正在编写一个 Java 小程序并将其嵌入到网页中。 It used to run Mac and Windows in different browsers without problem.它曾经在不同的浏览器中运行 Mac 和 Windows,没有问题。 I was using NetBeans on the Mac to build the .jar file the applet used.我在 Mac 上使用 NetBeans 来构建小程序使用的 .jar 文件。

For some reason or another I decided to load the project on the Windows' NetBeans - I started getting the following error on the Windows machine when accessing the web page from any browser:出于某种原因,我决定在 Windows 的 NetBeans 上加载项目 - 从任何浏览器访问网页时,我开始在 Windows 机器上收到以下错误:

java.lang.ClassFormatError: Incompatible magic value 1008813135 in class file

Fearing that it must have been my decision to open the project on Windows that caused this error - I tried to build from the Mac's NetBeans - but the error persisted.担心一定是我决定在 Windows 上打开项目导致了这个错误——我试图从 Mac 的 NetBeans 构建——但错误仍然存​​在。

I started a while new project on the Mac and imported the existing source code: still same problem.我在 Mac 上启动了一个新项目并导入了现有的源代码:仍然是同样的问题。

I was doing some reading about this error and it seems that the magic number expected is 0xCAFEBABE in hex which is 3405691582 in decimal, not 1008813135. So it looks like the Mac version of Java doesn't produce this file header any more?我正在阅读有关此错误的一些信息,似乎预期的幻数是十六进制的 0xCAFEBABE,即十进制的 3405691582,而不是 1008813135。所以看起来 Mac 版本的 Java 不再生成此文件头了? Hoe can that be?锄头可以吗? I didn't do any updates or anything.我没有做任何更新或任何事情。

Yes, 0xCAFEBABE is the usual first 4 bytes of a Java file.是的, 0xCAFEBABE通常是 Java 文件的前 4 个字节。

1008813135 is <!DO in Latin encoding, which is, in all probability, the start of <!DOCTYPE... . 1008813135是拉丁语编码中的<!DO ,很可能是<!DOCTYPE...的开始。

It is therefore likely the start of a 404 error , or some other error page.因此,它很可能是404 error或其他一些错误页面的开始。

I have not experienced this problem, but Googling this error yields several possible solutions:我没有遇到过这个问题,但谷歌搜索这个错误会产生几种可能的解决方案:

forum.sun.com - Java Applet Development - Incompatible magic value 1008813135 in class file MyApplet forum.sun.com - Java Applet 开发 - 类文件 MyApplet 中不兼容的魔法值 1008813135

Thanks God the problem is solved.感谢大神,问题解决了。

Its the Java cache, so the solution go to Java Control Panel, "General" tab, and under "Temporary Internet Files" click "Settings", then click "Delete Files".它是 Java 缓存,因此解决方案转到 Java 控制面板,“常规”选项卡,然后在“Internet 临时文件”下单击“设置”,然后单击“删除文件”。 Try using the applet again.再次尝试使用小程序。

"Incompatible magic value 1008813135" Error? “不兼容的魔法值 1008813135”错误?

The problem is now solved: I found out that the website host I was using didn't support .jar files at all.现在问题解决了:我发现我使用的网站主机根本不支持 .jar 文件。 I mass-uploaded the files with my ftp program and didn't notice that it ignored the .jar files completely.我用我的 ftp 程序批量上传了这些文件,并没有注意到它完全忽略了 .jar 文件。

Errors on java initialization java初始化错误

Alright, so it was an apache configuration issue, removed this line from my httpd.conf file:好吧,这是一个 apache 配置问题,从我的 httpd.conf 文件中删除了这一行:

# DefaultType application/x-httpd-php

Fixed the issue.修复了问题。

If you are using Spring security or some sort of custom Servlet Filters, make sure, that the archive or codebase location is in "permitAll" access.如果您使用 Spring 安全或某种自定义 Servlet 过滤器,请确保存档或代码库位置在“permitAll”访问中。 This was to problem in my case这对我来说是个问题

The incompatible magic number is the first four bytes of a html file that has some error message in it, probably a message that the file isn't found.不兼容的幻数是 html 文件的前四个字节,其中包含一些错误消息,可能是找不到文件的消息。

I encountered this phenomenon when I didn't take case sensitivity into account in the codebase element of the applet tag.当我在小程序标签的代码库元素中没有考虑区分大小写时,我遇到了这种现象。 Things worked well on Windows, but the internet server I was using was running UNIX where filename case sensitivity is important.事情在 Windows 上运行良好,但我使用的 Internet 服务器运行的是 UNIX,其中文件名区分大小写很重要。 Making the case of all file and directory names in the code and codebase elements solved the problem.使代码和代码库元素中的所有文件和目录名称的大小写解决了问题。

I was facing the same problem.The reason in my case was all dependency library that Applet uses was not signed and also applet not able to locate them .我遇到了同样的问题。在我的案例中,原因是Applet 使用的所有依赖库都没有签名,而且 Applet 也无法找到它们

So i Have added all the dependent library along with main applet in jsp file like below :所以我在jsp文件中添加了所有依赖库以及主小程序,如下所示:

app.archive = '/esense/resources/lib/Applet.jar, /esense/resources/lib/jasypt-1.7.jar, /esense/resources/lib/mysql-connector-java-5.1.30.jar, /esense/resources/lib/runtime-api-1.0.jar'; app.archive = '/esense/resources/lib/Applet.jar, /esense/resources/lib/jasypt-1.7.jar, /esense/resources/lib/mysql-connector-java-5.1.30.jar, /esense /resources/lib/runtime-api-1.0.jar';

I have also signed all the jar.我也签了所有的罐子。

Hope this may work in your case.希望这可能适用于您的情况。

我只是点击了 maven->update project->include snapshot release in my spring boot 就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM