Truncated class file Error

579 views
Skip to first unread message

Anro le Roux

unread,
Oct 24, 2011, 11:27:07 AM10/24/11
to FBDK
Hi,

Can anyone please tell me what is the reason for this error below. I
get it sometimes when I want to run a FB in test mode and sometimes
when I want to run a system. I have once corrected it when I randomly
saved my FB's.

I am working on both Win7 and Linux(Ubuntu) and don’t know if and how
this can cause problems, but al have worked perfectly so far.

Thank you
Anro

Exception in thread "Thread-8" java.lang.ClassFormatError: Truncated
class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at fb.rt.FBManager.createFB(FBManager.java:259)
at fb.rt.FBManager.create(FBManager.java:233)
at fb.rt.FBManager.executeRequest(FBManager.java:383)
at fb.rt.Resource.transmitCommand(Resource.java:103)
at fb.rt.Resource.transmitCommand(Resource.java:113)
at fb.rt.tools.SystemManager.transmitCommand(SystemManager.java:589)
at fb.rt.tools.SystemManager.sendCommand(SystemManager.java:477)
at fb.rt.tools.SystemManager.createFB(SystemManager.java:321)
at fb.rt.tools.SystemManager.test(SystemManager.java:525)
at fb.rt.tools.SystemManager.create(SystemManager.java:303)
at fb.rt.tools.SystemManager.launch(SystemManager.java:446)
at fb.tools.swing.editor.actions.RunAction$1.run(RunAction.java:58)

James Christensen

unread,
Oct 24, 2011, 2:03:35 PM10/24/11
to fb...@googlegroups.com
The key call is:

>        at java.lang.Class.forName(Class.java:186)
>        at fb.rt.FBManager.createFB(FBManager.java:259)
FBManager was trying to create an FB at this point, and the class
loader encountered a defective .class file. This probably resulted
from a compiler error at some point.

By turning on the logging from the "Preferences" dialog, you should be
able to see which FB it was trying to create.
--
Best regards,
Jim Christensen

Anro le Roux

unread,
Nov 10, 2011, 2:47:53 PM11/10/11
to FBDK
Mr Christensen, thank you for your response. Sorry to only get back to
this now.

As you suggested, I looked at the log and saw that whenever an
IN_EVENT FB must be created, the progress bar just keeps on running
and the log stops at:

SERVER_1_TEST.IO: <Request ID="7" Action="CREATE" >
<FB Name="$_INIT" Type="IN_EVENT" />
</Request>

Then I tried to open the IN_EVENT FB and tried to compile but get the
following:

Saving IN_EVENT.java...Done.
Compiling IN_EVENT.java...
/home/anro/Documents/Active/Studies/MscEngProject/Work/IECFB/fbdk/java/
fb/rt/hmi/IN_EVENT.java:11: fb.rt.hmi.IN_EVENT is not abstract and
does not override abstract method
actionPerformed(java.awt.event.ActionEvent) in
java.awt.event.ActionListener
public class IN_EVENT extends FBInstance implements ActionListener {
^
1 error

This problem is only on my Ubuntu linux PC. In windows everything
works fine. I don’t understand because everything worked fine in
Ubuntu and suddenly I started getting this problem. I did try it with
freshly unpacked files but still get the problem.

I would really appreciate any help.
Thank you
Anro

On Oct 24, 8:03 pm, James Christensen <james.h.christen...@gmail.com>
wrote:
> The key call is:>        at java.lang.Class.forName(Class.java:186)
> >        at fb.rt.FBManager.createFB(FBManager.java:259)
>
> FBManager was trying to create an FB at this point, and the class
> loader encountered a defective .class file. This probably resulted
> from a compiler error at some point.
>
> By turning on the logging from the "Preferences" dialog, you should be
> able to see which FB it was trying to create.
> --
> Best regards,
> Jim Christensen
>

James Christensen

unread,
Nov 10, 2011, 3:37:17 PM11/10/11
to fb...@googlegroups.com
You shouldn't try to compile IN_EVENT or to create a new copy of its
.fbt file in someplace other than src/hmi/IN_EVENT.fbt, as its .class
file is provided in the fbrt.jar file and the runtime will get very
confused with trying to find the correct class file. If you dd this,
the map.ini file will be mixed up. The way to fix this is to remove
any extra copies of IN_EVENT.fbt that you may have lying around,
delete the map.ini file and open any *.sys file to force
re-initialization of the map.ini file.

This still may not work in Ubuntu Linux as the file delimiters are
different from Windows, but give it a try and let me know if it works.


--
Best regards,
Jim Christensen

Anro le Roux

unread,
Nov 11, 2011, 3:38:05 AM11/11/11
to FBDK
Thank you, makes sence.

I have removed all the IN_EVENT .java and.class files and deleted the
map.ini file. In Ununtu, the map file does not get re-initialized when
I open a *.sys file so I just copied a map.ini file from the working
windows files.

My problem is not solved yet so any more suggestions are welcome.

I do now know its the IN_EVENT FB and just removed them from my system
and can work on my Ubuntu running computer again.
So thanks for all the help Mr Christensen.

Anro

On Nov 10, 10:37 pm, James Christensen <james.h.christen...@gmail.com>
wrote:
> You shouldn't try to compile IN_EVENT or to create a new copy of its
> .fbt file in someplace other than src/hmi/IN_EVENT.fbt, as its .class
> file is provided in the fbrt.jar file and the runtime will get very
> confused with trying to find the correct class file. If you dd this,
> the map.ini file will be mixed up. The way to fix this is to remove
> any extra copies of IN_EVENT.fbt that you may have lying around,
> delete the map.ini file and open any *.sys file to force
> re-initialization of the map.ini file.
>
> This still may not work in Ubuntu Linux as the file delimiters are
> different from Windows, but give it a try and let me know if it works.
> --
> Best regards,
> Jim Christensen
>

James Christensen

unread,
Nov 11, 2011, 9:08:53 AM11/11/11
to fb...@googlegroups.com
Wow, that's strange! Why would IN_EVENT.class in the fbrt.jar file be
truncated in the Linux system but not in the Windows system? Maybe the
problem is in the Linux unzipping of fbdk.zip? Maybe you could copy
the fbrt.jar file from the Windows system over to the Linux system and
see if IN_EVENT then works?

--
Best regards,
Jim Christensen
Reply all
Reply to author
Forward
0 new messages