ClassFormatError: 154>, Exception caught in Display class - java

I am running a midlet application already deployed & run on Nokia S60 sdk. I want to make my app run on every java & symbian device. I tried to run the application on Java_ME_platform_SDK_3.4 but getting an error in the code when i am trying to switch the screen from Login to Home
HomeForm homeForm=new HomeForm(objLoginMidlet, objCommonBean);
Display.getDisplay(objLoginMidlet).setCurrent(homeForm);
Code in Home Form is as follows-
class HomeForm extends Form
{
public HomeForm(LoginMidlet objLoginMidlet,CommonBean objCommonBean)
{
this.objLoginMidlet=objLoginMidlet;
this.objCommonBean=objCommonBean;
setTimer();
initHomeForm();
}
}
My MIDP is set to 2.1. Even I changed it to 2.0 but still getting exception as follows
warning**
*Untrusted user classes must never be put
***on the system class path
TRACE: <at java.lang.Error: ClassFormatError: 154>, Exception caught in Display class
java.lang.Error: ClassFormatError: 154
- java.lang.Class.invoke_verify(), bci=0
- java.lang.Class.initialize(), bci=100
- ezypoint.forms.LoginForm.register(LoginForm.java:202)
- ezypoint.forms.LoginForm.commandAction(LoginForm.java:91)
Even I tried to change compilance level but still exception appears.

I don't know the Nokia S60, but this usually happens on CLDC devices when compiled Java class files are being deployed without having them "preverified". This is an additional build step that is required to run them on embedded JavaME devices. See this StackOverflow question.
If you hava a full-blown development environment, this is usually set up automatically (maybe you need to choos the correect target device). However, if you try to compile the Java files by yourself and then run them on your device, it will crash. In this case, you need to call %YOUR_WTK_HOME%\bin\preverify.exe with your class files (and probably add to your ANT script or similar):
%YOUR_WTK_HOME%\bin\preverify.exe -classpath <your-classpath> -d <your-destination-dir> <your-source-directory>

Related

System.TypeLoadException in windows app development

I am implementing liblinear in windows app using visual studio express 2013 for windows. After installing liblinear using nuget package manager(link is https://www.nuget.org/packages/Liblinear/) I was trying to use it:
using de.bwaldvogel.liblinear;
And in the code I typed :
Parameter para = new Parameter(SolverType.MCSVM_CS, 1.0 , 0.01);
but it gives error while running, stating:
An exception of type 'System.TypeLoadException'occured in FileExplorer.DLL but was not
handled in the user code.
Additional Information: Could not load type 'System.Runtime.Serialization.Iserializable
' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
If there is a handler for this exception, the program may be safely continued.
Also when nuget package is installed there are no errors but there are warnings stating
Reference to type 'System.Runtime.Serialization.ISerializable' claims it is defined in
'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhone\v8.0\mscorlib.dll',
but it could not be found (in IKVM.OpenJDK.Core.dll)
Reference to type 'System.Runtime.Serialization.SerializationInfo' claims it is defined
in 'c:\Program Files (x86)\ReferenceAssemblies\Microsoft\Framework\WindowsPhone\v8.0
\mscorlib.dll', but it could not be found (in IKVM.OpenJDK.Core.dll)
Could anyone help me out with this? I am developing app for windows phone 8.0.
Unfortunately, the ISerializable interface is not available for Windows Phone 8.x. :( Check out the Platforms section here. This thread has additional info as well.
Is the liblinear NuGet package supposed to be supported on Windows Phone? If so, I would get in contact with the author of the package directly.

Run java applet offline: Exception in thread "main" java.lang.NoClassDefFoundError

I just downloaded some java applets from this site: http://www.surendranath.org/Apps.html to run them offline on my laptop. Take for example this one: http://www.surendranath.org/Applets/Oscillations/Lissajous/Lissajous.html
By inspecting the source code I downloaded the file: wget http://www.surendranath.org/Applets/Oscillations/Lissajous/LissajousApplet.class
Then I tried it to run it on my ubuntu box via gappletviewer-4.8 -code LissayousApplet.class
However I got the following error message:
Exception in thfully qualifiedread "main" java.lang.NoClassDefFoundError: loaded class LissajousApplet was in fact named Applets.Oscillations.Lissajous.LissajousApplet
at java.lang.VMClassLoader.defineClass(libgcj.so.14)
at java.lang.ClassLoader.defineClass(libgcj.so.14)
at java.security.SecureClassLoader.defineClass(libgcj.so.14)
at java.net.URLClassLoader.findClass(libgcj.so.14)
at java.lang.ClassLoader.loadClass(libgcj.so.14)
at java.lang.ClassLoader.loadClass(libgcj.so.14)
at java.lang.ClassLoader.loadClass(libgcj.so.14)
at gnu.classpath.tools.appletviewer.Main.createApplet(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.StandaloneAppletWindow.<init>(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.StandaloneAppletViewer.createWindows(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.StandaloneAppletViewer.<init>(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.Main.main(libgcj-tools.so.14)
So what is the correct way to run this applet offline? Running it online within my browser and the icetea plugin works. However I need a way to run it offline.
Edit
Trying the fully qualified class-name results in:
gappletviewer-4.8 -code Applets.Oscillations.Lissajous.LissajousApplet.class -codebase codebase="../../../"
WARNING: CURRENTLY GAPPLETVIEWER RUNS WITH NOSECURITY MANAGER.
THIS MEANS THAT APPLETS YOU LOAD CAN DO ANYTHING A JAVA APPLICATION
THAT YOU DOWNLOAD AND RUN CAN DO. BE *VERY* CAREFUL WHICH APPLETS YOU RUN.
DO NOT USE GAPPLETVIEWER ON YOUR SYSTEM IF YOUR SYSTEM STORES IMPORTANTDATA.
THIS DATA CAN BE DESTROYED OR STOLEN IF YOU LOAD A MALICIOUS APPLET.
[press 'c' or 'C' to continue or anything else to quit]
c
java.lang.ClassNotFoundException: Applets.Oscillations.Lissajous.LissajousApplet not found in gnu.classpath.tools.appletviewer.AppletClassLoader{urls=[file:/home/null,file:/home/], parent=gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}}
at java.net.URLClassLoader.findClass(libgcj.so.14)
at gnu.classpath.tools.appletviewer.AppletClassLoader.findClass(libgcj-tools.so.14)
at java.lang.ClassLoader.loadClass(libgcj.so.14)
at java.lang.ClassLoader.loadClass(libgcj.so.14)
at gnu.classpath.tools.appletviewer.Main.createApplet(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.StandaloneAppletWindow.<init>(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.StandaloneAppletViewer.createWindows(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.StandaloneAppletViewer.<init>(libgcj-tools.so.14)
at gnu.classpath.tools.appletviewer.Main.main(libgcj-tools.so.14)
Try using the fully qualified classname
gappletviewer-4.8 -code Applets.Oscillations.Lissajous.LissajousApplet.class -codebase codebase="http://www.surendranath.org/"
Read: gappletviewer Man page

UnsatisfiedLinkError and NoClassDefFoundError : Running Java Mapscript on Ubuntu 11.10

We have coded and run a dynamic web application using MAPSERVER(Version 6.0.1) on windows platform using Java Technology. Now, there is need of deploying it on Ubuntu 11.10. We have installed Apache Tomcat 6.0, Mapserver 6.0.1, Apache 2.0, and FWTools-2.0.1(As this package contain all required tools for mapserver if I am not wrong, so I didn't feel any other tools to be installed). We have deployed the war file(and put application without) in Apache Tomcat 's Webapps folder. I even got the index page which dont have code related with mapscript api. But while fetching the other servlet with mapscript we are getting following error...
java.lang.UnsatisfiedLinkError: no mapscript in java.library.path
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
java.lang.Runtime.loadLibrary0(Runtime.java:840)
java.lang.System.loadLibrary(System.java:1047)
edu.umn.gis.mapscript.mapscriptJNI.<clinit>(mapscriptJNI.java:23)
edu.umn.gis.mapscript.mapObj.<init>(mapObj.java:283)
Again while refreshing the browser page where the above error was displayed, I got a change,
java.lang.NoClassDefFoundError: Could not initialize class
edu.umn.gis.mapscript.mapscriptJNI
edu.umn.gis.mapscript.mapObj.<init>(mapObj.java:283)
I searched on net about the above problem. But finally blank. Please, provide idea about the above problem.
I'm not going to explain why you're getting the UnsatisfiedLinkError, but instead I'll explain why you are getting the NoClassDefFoundError when you reload the page.
A NoClassDefFoundError with a message Could not initialize class ... is thrown by the JVM when it attempts to initialize a class that it has already tried and failed to initialize.
The first of your two stacktraces contains the line
edu.umn.gis.mapscript.mapscriptJNI.<clinit>(mapscriptJNI.java:23)
The method name <clinit> denotes the static initializer, of the class mapscriptJNI. So, at the point that the UnsatisfiedLinkError was thrown, the JVM was trying to initialize this class. Looking at the error message, it seems that this static initializer tried to load the native code library mapscript but failed.
This UnsatisfiedLinkError causes the mapscriptJNI class to fail to initialize successfully. The JVM keeps a record of all classes that fail to initialize, and if you attempt to initialize one of those classes again, you'll get a NoClassDefFoundError with a message saying that it could not initialize that class.
When you refresh the page, you end up causing the JVM to attempt to initialize the class mapscriptJNI a second time. Of course, this class failed to initialize the previous time. Your second stacktrace contains exactly the error I've described.
In short, the UnsatisfiedLinkError is the real error here. Fix that and the other one will go away.
I would check the following 2 items:
Is the mapscript.jar file on Tomcat or at least your webapp's classpath? (NoClassDefFoundError is your big clue here)
Is the libmapscript.so on either your LD_LIBRARY_PATH or -Djava.library.path? (UnsatisfiedLinkError since the shared object cannot be found)
Try having a look at this post, near the Running Java Mapscript (on Linux) section.
Hope that helps!

Java EE "JDI Event Dispatch" error

When I try to debug any project in Java EE INDIGO (64 bit) in win 7 and place a breakpoint somewhere the program acts as expected but when I hit f6 or f5 to go further eclipse throws an error which reads (I have Spring installed):
An internal error occurred during: "JDI Event Dispatch".
com.springsource.sts.groovy.debug.core.GroovyDebugProvider.isAlwaysInteretingLaunch()Z
(No typo, "Z" does appear)
Now I can't debug any program because it always gives this error. Can anyone help?
From the eclipse error log:
!MESSAGE com.springsource.sts.groovy.debug.core.GroovyDebugProvider.isAlwaysInteretingLaunch()Z
!STACK 0
java.lang.AbstractMethodError: com.springsource.sts.groovy.debug.core.GroovyDebugProvider.isAlwaysInteretingLaunch()Z
at org.eclipse.contribution.jdt.debug.DebugHooksAspect.isInterestingLaunch(DebugHooksAspect.aj:253)
at org.eclipse.contribution.jdt.debug.DebugHooksAspect.ajc$inlineAccessMethod$org_eclipse_contribution_jdt_debug_DebugHooksAspect$org_eclipse_contribution_jdt_debug_DebugHooksAspect$isInterestingLaunch(DebugHooksAspect.aj:1)
at org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget.getStepFilters_aroundBody1$advice(JDIDebugTarget.java:195)
at org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget.getStepFilters(JDIDebugTarget.java:1)
at org.eclipse.jdt.internal.debug.core.model.JDIThread$StepHandler.attachFiltersToStepRequest(JDIThread.java:2154)
at org.eclipse.jdt.internal.debug.core.model.JDIThread$StepHandler.createStepRequest(JDIThread.java:2065)
at org.eclipse.jdt.internal.debug.core.model.JDIThread$StepHandler.createStepRequest(JDIThread.java:2040)
at org.eclipse.jdt.internal.debug.core.model.JDIThread$StepHandler.step(JDIThread.java:1989)
at org.eclipse.jdt.internal.debug.core.model.JDIThread.stepOver(JDIThread.java:1412)
at org.eclipse.jdt.internal.debug.core.model.JDIStackFrame.stepOver(JDIStackFrame.java:418)
at org.eclipse.debug.internal.core.commands.StepOverCommand.step(StepOverCommand.java:27)
at org.eclipse.debug.internal.core.commands.StepCommand.doExecute(StepCommand.java:34)
at org.eclipse.debug.core.commands.AbstractDebugCommand$1.run(AbstractDebugCommand.java:213)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
This seems to be a similar bug to this bug in codehaus jira (see comments section). I was able to switch back to an older eclipse installation (from two weeks ago) to get rid of the current problem and will upgrade to Eclipse 3.7 as soon as time permits.
As crazy as this sounds, I too was getting this error when debugging an Android App and trying to step into a specific method, and resolved it by renaming the method I was trying to step into.
I had tried:
completely reinstalling the app
cleaning in Eclipse
reboot of device (phone), OS, and restart of Eclipse
increasing debug timeouts in Preferences | Java | Debug
My method was called "getMessageInfoFromDb"... and was in a class that didn't extend anything, but implemented Serializable ;-)
Try disabling simple step filtering, especially filtering of simple getters.
delete the Temp folder from yourlocalpath\domainfolder\server\AdminServer
domains\base_domain\servers\AdminServer
Have you done any DB import twice or more time on the same DB that you use for the application in which you are running in debug mode. Because I am also getting similar error with the caption JDI while starting Application Server with deployed .ear in Eclipse based IDE as a popup.
When db is imported twice user created tables gets imported if it's been tried in the same kind of databases. But Oracle App & System Specific tables throws error in process of importing. And some crash in that....
I hope this is what scenario yours as well....
In my scenario I had imported Oracle db from UNIX environment to Oracle XE in Windows environment.

Quartz API error

When I compile and run my application on my local machine with specs Windows XP sp2, JDK 5u11, I get no error. But when I try to run this application (compiled on Windows XP) on a Linux Debian distro, JDK 5 I get the following error:
Unable to instantiate class load helper class: null
What can I do to get rid of this exception message?
Yes, this isn't really enough info to help, but a simple Google search led me to the source code which explalins it a bit:
Quartz has a "ClassLoadHelper" interface and you can specify the class name of the implementation of this to use. You've not configured it, or there's an error in creating it. Perhaps it's complaining it doesn't have the name of a class to instantiate.
In any event the code apparently logs a stack trace with this, so you should provide that.

Categories