I looked at the demos and built my own zombie simulator as described in the documentation, but an error keeps coming up and I'm pretty sure its not to do with my code since I just copied it from the docs for the zombie simulator and opened the demos repast provides.
when I run the simulator it gives me this error
2014/10/03 16:05:19,354: Scenario Load Error
repast.simphony.scenario.ScenarioLoadException: ParseError at [row,col]:[5,21]
Message: Open quote is expected for attribute "{1}" associated with an element type "type".
at repast.simphony.scenario.ScenarioLoader.load(ScenarioLoader.java:220)
at repast.simphony.ui.RSApplication.open(RSApplication.java:353)
at repast.simphony.ui.RSAppConfigurator.postWindowOpen(RSAppConfigurator.java:39)
at saf.core.ui.GUICreatorDelegate.runDisplay(GUICreatorDelegate.java:188)
at saf.core.ui.GUICreator$1.run(GUICreator.java:18)
at simphony.util.ThreadUtilities$Runner.run(ThreadUtilities.java:33)
at simphony.util.ThreadUtilities.runInEventThread(ThreadUtilities.java:47)
at saf.core.ui.GUICreator.runDisplay(GUICreator.java:16)
at repast.simphony.ui.RSUIPlugin$1.run(RSUIPlugin.java:104)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[5,21]
Message: Open quote is expected for attribute "{1}" associated with an element type "type".
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
at com.sun.xml.internal.stream.XMLEventReaderImpl.nextEvent(Unknown Source)
at repast.simphony.scenario.data.ContextFileReader.read(ContextFileReader.java:40)
at repast.simphony.scenario.ScenarioLoader.load(ScenarioLoader.java:126)
... 22 more
Also on the eclipse console it gives me this error before repast starts
Oct 03, 2014 4:05:01 PM java.util.prefs.WindowsPreferences
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
I just can't figure out what is going on but I need to solve the problem soon because I need to work with repast for a uni project.
Thank you for any help :)
The first error is not a coding error but a parsing error - it is likely a typo in your context.xml file (the error message indicates line 5, column 21). Did you edit it as advised on pages 18-20 of the repast getting started guide? Without seeing your context.xml file, I can't say exactly what the error is in it - if you want to add the first 5 lines of it then we can probably diagnose.
The second message (warning, not error) on the console window is common and is not associated with the first error. This answer might help if you want to get rid of it - however I have not experienced any problems with leaving it there.
Related
I am using Netbeans 7.3, JRE 1.7.0_11, Java SE 7 update 40, on Mac 10.8.5.
I have created a JApplet GUI form which I have embedded in a applet tag within a HTML doc,
which I have created in a Java Wed application.
When I try to run in Safari I get the following error:
java.lang.NoClassDefFoundError org/jdesktop/layout/GroupLayout$Group
I have searched the net, it seems a common issue, ive found that some people resolved this error by changing :
Preferences-Java-GUI Builder - Layout Generation Style from Automatic to Swing Layout Extension Library. (from Automatic) & also tried importing swing.groupLayout but netbeans flags as a unused import.
But I am still getting the same error.
Any feedback appreciated.
I have also posted this same question on code ranch and submitted it to netbeans forum but have had no luck to date.
Update:
So scratched that for now idea for now and tried a basic app with a simple paint method that paints 'Hello', did not load on a Mac OS 10.8 and on windows 7 got the following error:
Exception in thread "AWT-EventQueue-2"
java.lang.IllegalStateException: Applet's parent container not set up
at sun.plugin2.applet.Plugin2Manager.start(Unknown Source)
at sun.plugin2.main.client.PluginMain$StartAppletRunner.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Update:
Confirmed these basic applets are working on other PCs on all browsers so it has to be the settings of my own Mac 10.8, i have already check the security settings for java and they are set a medium, any ideas?
As the other post indicated, AjaxSwing supports all layouts (because it simply reads components coordinates).
If you get NoClassDefFoundError that means you haven't copied the .jar files to the right directory. You can either copy it to a directory on AjaxSwing CLASSPATH or specify them via agent.classPath. See documentation for more information.
Any fix to avoid this exception while starting WLDF Console? Thanks.
java.lang.ClassFormatError: Incompatible magic value 218762506 in class file com/bea/diagnostics/dashboard/ChartPanelApplet
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.ClassFormatError: Incompatible magic value 218762506 in class file com/bea/diagnostics/dashboard/ChartPanelApplet
There is an earlier Sun bug report on this issue, with JDK 1.4
you are mostly running JDK 1.6 but take a look at the bug report.
Short Summary (gleaned from this forum) :
The Java plug-in of your browser tries
to get some .class file from the
current location (your server) and
fails because your server returns some
custom 404 page. Let's try to check
the Java console to see what really is
requested. Please, run the Java
console, set the trace level to 5
(highest level).
Enable the Java console on Windows for IE browser and see if it gives a detail on which URL is giving the 404 or some other error.
Further Reading
Oracle forum question
I cleaned my project in Eclipse and because of that, I think, I started to get the following error message:
at check.GameWindow$12.run(MyWindow.java:1253)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
So, I would like to ask why cleaning can cause error messages? I mean, the code before and after the cleaning is the same. Why it works differently before and after the cleaning.
In my opinion, something has changed in your code that you are not aware of. When you clean your project, the only thing Eclipse does is to delete .class files in your build/ directory and recompile all sources.
If you don't have compilation errors, there should be something wrong in an an anonymous inner class in check.GameWindow.
Please check.
I chose ProGuard and here's the options I configured it with:
Shrinking
Options:
Shrink
Keep:
Applications
Applets
Also keep:
Enumerations
Database drivers
Swing UI L&F
Obfuscation
Options:
Obfuscate (duh! :P)
Overload aggressively
Use unique class member names
Use mixed-casee class names
Flatten package hierarchy
Repackage classes
Keep names:
native method names
.class method names
Optimization
Options:
Optimize
Merge interfaces aggressively
Remove:
[All boxes checked]
Information
Preverifiaction and targeting:
Preverify
Consistency and correctness:
Note potential mistakes in the configuration
Warn about possibly errornous input
Skip non-public library class members
and when I take the jar and put it as:
I get this applet error upon launch:
java.lang.RuntimeException: java.lang.NoClassDefFoundError: b
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: b
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: b
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 14 more
Caused by: java.io.IOException: open HTTP connection failed:http://mystikrpg.com/b.class
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 17 more
Exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError: b
Here is what is INSIDE the jar file BEFORE the obfuscation clientOffline.jar:
line_tile/
META-INF/
and here is what that jar file is AFTER the obfuscation to newOne.jar:
line_tile/
META-INF/
weapon/
me.gif
a.class
b.class
I hope this is good enough to help me solve this. What am I doing wrong?
I guess that b.class is generated from the GamePanel inner class. So there can be a problem with inner classes. Here at Stackoverflow Tom mentioned that he could not obfuscate inner classes correctly. The suggestion there also applies here: try to obfuscate with verbose=true (or with java -jar proguard.jar #myconfig.pro -verbose).
I would also suggest to use -keepnames option (see manual) for GamePanel and/or tileOffline since it will leave these classes unchanged by the obfuscation (at least for finding the root cause of the problem).
A side note is try to use CamelCase class names when programming in Java.
I need Vecmath, so I went to Oracle to get the latest version of Java 3D. I didn't see a place to download a JAR, but it had an installer. I downloaded and ran it. I assume that the installer added the JAR as a JDK extension
I restarted Eclipse, and it sees that VecMath is present. However, it still complains:
Access restriction: The type Vector3f
is not accessible due to restriction
on required library C:\Program
Files\Java\jre6\lib\ext\vecmath.jar
Bummer. I am able to change it from a compiler error to a warning, but it crashes as soon as I try to run it. Although, I'm using this in conjunction with OpenGL, and the crash could have nothing to do with vecmath. I'm not sure. Here is the exception:
Exception in thread "Timer-0" javax.media.opengl.GLException: java.lang.RuntimeException: javax.imageio.IIOException: Can't read input file!
at com.jogamp.opengl.impl.awt.AWTThreadingPlugin.invokeOnOpenGLThread(AWTThreadingPlugin.java:101)
at com.jogamp.opengl.impl.ThreadingImpl.invokeOnOpenGLThread(ThreadingImpl.java:192)
at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:164)
at javax.media.opengl.awt.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:591)
at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:301)
at com.jogamp.opengl.util.AnimatorImpl.display(AnimatorImpl.java:50)
at com.jogamp.opengl.util.Animator.display(Animator.java:154)
at com.jogamp.opengl.util.FPSAnimator$1.run(FPSAnimator.java:95)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
Caused by: java.lang.RuntimeException: javax.imageio.IIOException: Can't read input file!
at cs4620.nth23.assignment1.GraphicsApp.loadTextures(GraphicsApp.java:98)
at cs4620.nth23.assignment1.GraphicsApp.init(GraphicsApp.java:65)
at com.jogamp.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:111)
at com.jogamp.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:124)
at javax.media.opengl.awt.GLCanvas$InitAction.run(GLCanvas.java:643)
at com.jogamp.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:273)
at javax.media.opengl.awt.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:674)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: javax.imageio.IIOException: Can't read input file!
at javax.imageio.ImageIO.read(Unknown Source)
at cs4620.nth23.assignment1.GraphicsApp.loadTextures(GraphicsApp.java:95)
... 14 more
I'm using:
x84 Windows 7
Eclipse Helios
JavaSE-1.6
JDK 1.6
What am I doing wrong here?
The exception was caused by being unable to find a file referenced in the code - it has nothing to do with VecMath.
The app runs fine, despite the access restrictions. I don't know if it'll come back to bite me later or what.