TynyVM exception working with legOS - java

so I'm working with legOS (the little legos robots) and basically what I'm doing is finding a solution to a maze with A* and I wanna use that to tell the robot where to move around the maze.
But the problem that I've been having is that when I try to initiate the priotiry queue it gives me this exception
js.tinyvm.TinyVMException: Invalid byte tag in constant pool: 15
at js.tinyvm.ClassRecord.getClassRecord(ClassRecord.java:871)
at js.tinyvm.ClassRecord.storeReferredClasses(ClassRecord.java:394)
at js.tinyvm.Binary.processClasses(Binary.java:381)
at js.tinyvm.Binary.createFromClosureOf(Binary.java:309)
at js.tinyvm.TinyVMTool.link(TinyVMTool.java:97)
at js.tinyvm.TinyVMTool.link(TinyVMTool.java:48)
at lejos.pc.tools.NXJLink.start(NXJLink.java:134)
at lejos.pc.tools.NXJLink.run(NXJLink.java:101)
at lejos.pc.tools.NXJLink.start(NXJLink.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at lejos.pc.tools.ToolStarter.startTool(ToolStarter.java:31)
at lejos.pc.tools.NXJLink.main(NXJLink.java:28)
Caused by: org.apache.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 15
at org.apache.bcel.classfile.Constant.readConstant(Constant.java:146)
at org.apache.bcel.classfile.ConstantPool.<init>(ConstantPool.java:67)
at org.apache.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:222)
at org.apache.bcel.classfile.ClassParser.parse(ClassParser.java:136)
at js.tinyvm.ClassRecord.getClassRecord(ClassRecord.java:865)
... 14 more
Linking the file failed with exit status 1
I know is with the priority queues because I've commented those lines and the program links successfully
here's where I start the queues
PriorityQueue<State> frontier;
frontier = new PriorityQueue<State>(new CostComparator());
PriorityQueue<State> visited;
visited = new PriorityQueue<State>(new CostComparator());
Can someone tell me why this happens?
I'm using everything in 32-bit env and nothing works..

Hope this helps for future reference, the runtime library for lejOS does not support Priority queue class, only queue so I had to implement my own queue with this library.

Related

Getting org.springframework.remoting.RemoteAccessException Could not access JMS invoker queue [QueueName] at random times?

I am getting this exception at random times, couldnt detect any specific patterns when this comes up. The occurrences of this exception reduce after sometime by itself. We checked the broker is always running properly so queue seems to be available when this exception comes.
org.springframework.remoting.RemoteAccessException: Could not access JMS invoker queue [QueueName]; nested exception is javax.jms.JMSException: edu.emory.mathcs.backport.java.util.concurrent.TimeoutException
at my.data.message.bus.MyJmsInvoker.convertJmsInvokerAccessException(MyJmsInvoker.java:92)
at org.springframework.jms.remoting.JmsInvokerClientInterceptor.invoke(JmsInvokerClientInterceptor.java:204)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy203.invoke(Unknown Source)
at sun.reflect.GeneratedMethodAccessor868.invoke(Unknown Source)
I am new to Java EE, if someone has faced this and know the reason/fix for this please help.

Error : java.lang.OutOfMemoryError: unable to create new native thread : gemfire

Please before marking this duplicate read this : I have gone through all the answers provided for this error and nothing helped in my scenario.
I am doing a server migration where the same thing works well in 32 bit and 64 bit runs out of memory.
I have a windows service which internally points to .exe that spawns java process : I have made all the possible memory improvements in the config file of my .exe :Below:
I am not sure what different behavior is causing this out of memory for 64 bit server.(my java version is 1.8.xx)
#Java Additional Parameters
wrapper.java.additional.1=-XX:+UseConcMarkSweepGC
wrapper.java.additional.2=-XX:+UseParNewGC
wrapper.java.additional.3=-XX:ParallelGCThreads=8
wrapper.java.additional.4=-verbose:gc
# wrapper.java.additional.!!! should be sequence !!!=-Xloggc:D:\apps\Logs\gc.log
# wrapper.java.additional.!!! should be sequence !!!=-XX:+PrintGCDetails
# wrapper.java.additional.!!! should be sequence !!!=-XX:+PrintGCTimeStamps
wrapper.java.additional.5=-XX:MaxDirectMemorySize=128m
wrapper.java.additional.6=-XX:+HeapDumpOnOutOfMemoryError
wrapper.java.additional.7=-Dcom.sun.management.jmxremote.port=34001
wrapper.java.additional.8=-Dcom.sun.management.jmxremote.ssl=false
wrapper.java.additional.9=-Dcom.sun.management.jmxremote.authenticate=false
wrapper.java.additional.10=-XX:CMSInitiatingOccupancyFraction=55
wrapper.java.additional.11=-XX:NewSize=474m
wrapper.java.additional.12=-XX:MaxNewSize=474m
#wrapper.java.additional.13=-XX:PermSize=128m
#wrapper.java.additional.14=-XX:MaxPermSize=128m
wrapper.java.additional.15=-Xss128k
wrapper.java.additional.16=-XX:+CMSIncrementalMode
wrapper.java.additional.17=-XX:+UseCompressedOops
# Initial Java Heap Size (in MB)
wrapper.java.initmemory=1638
# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=1638
Still i am ending up to have :
[severe 2016/10/24 06:27:46.192 java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Unknown Source)
at com.gemstone.gemfire.internal.SocketCreator.asyncClose(SocketCreator.java:688)
Reading done for the concept here :
Error reading
I am not much into Java things but tried all the things from my side , any help on this will be highly appreciated , i spend huge amount of time on this but not able to reach to any conclusion.
***********Update***************
So basically could figure out that this problem was coming due to excessive creation of thread from Gemfire which exceeds the threshold ~800 threads for Gemfire Java Process.
Here Jconsole tool helped to calculate the thread count , i could see around 200-300 threads from different pool getting created with no purpose apart from usual threads and they have discription as :
Name: pool-9-thread-1
State: WAITING on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject#163b285
Total blocked: 0 Total waited: 2
Stack trace:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(Unknown Source)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unknown Source)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
I'll add more details if i can find more on this !
*******Update 2 : ************
I could manage to see all the threads created by gemfire using Jconsole:
And this number keeps on increasing and after certain point of time i am seeing the OOM issue.Is there any way i can stop this unnecessary threads creation and memory conumption !

gridsim-Exception in thread "router2" java.lang.NullPointerException

I'm working on gridsim Min-Min project for workflow in Java Netbeans,i have 3 entities:user,broker and GridResources.
user send application with form of workfllow to broker
broker send gridlets to GridResource;
i implement the network topology for this entities with helping of example "auction" in example folder of Gridsim's pakage.
when run my programe,sometime its run without error and every thing is ok,
but after 3 run or some time after 8 run its failed with error and stop.
i checked network topology with another example but the logic of my programe is ok but im confiusing with this,i searched but not found anything.
anyone help me?
Exception in thread "router1" java.lang.NullPointerException
at gridsim.net.RIPRouter.dequeue(Unknown Source)
at gridsim.net.RIPRouter.processInternalEvent(Unknown `enter code here`Source)
at gridsim.net.RIPRouter.processEvent(Unknown Source)
at gridsim.net.Router.body(Unknown Source)
at eduni.simjava.Sim_entity.run(Sim_entity.java:605)
Exception in thread "router2" java.lang.NullPointerException
at gridsim.net.RIPRouter.dequeue(Unknown Source)
at gridsim.net.RIPRouter.processInternalEvent(Unknown Source)
at gridsim.net.RIPRouter.processEvent(Unknown Source)
at gridsim.net.Router.body(Unknown Source)
at eduni.simjava.Sim_entity.run(Sim_entity.java:605)

Problems using javazoom's Player

I'm trying to play mp3-files using the JLayer Class Player. After starting the Thread containing
myPlayer.play()
you can hear some hundred milliseconds of the beginning of the song and then the player interrupts and I get the following error messages:
> javazoom.jl.decoder.BitstreamException: Bitstream errorcode 102 at
> javazoom.jl.decoder.Bitstream.newBitstreamException(Unknown Source)
> at javazoom.jl.decoder.Bitstream.readFrame(Unknown Source) at
> javazoom.jl.player.Player.decodeFrame(Unknown Source) at
> javazoom.jl.player.Player.play(Unknown Source) at
> javazoom.jl.player.Player.play(Unknown Source) at
> controller.PlayController.run(PlayController.java:51) at
> java.lang.Thread.run(Thread.java:724)
I've searched the internet for solutions and I've read that this error could occur due to problems with certain .mp3-files, but .wav- or .wma-files weren't either accepted.
Does anyone know how I can get the player working? Thanks in advance
I've gotten some distortion using Javazoom on Linux. a comment above about interrupting the input stream prompted me to keep the Player class instantiated and close the buffered input stream before opening every time, That seemed to help, but I'm not sure. It came back but less often and now goes away if I close Firefox.
Thanks for the insight about the input streams getting interrupted.

Java 7 update 25 makes our java web start application fail with no logging

Since the java 7 update 25 launched by Oracle our application no longer functions.
Initially we got some warning about codebase & sercurity tags missing in the Manifest file, which we fixed.
The problem we now end up with is that in the Console we only get the following lines:
#### Java Web Start Error:
#### null
We also get an application Error dialog with the message: Unable to launch the application.
The details button gives the following details in the Exception:
java.lang.NullPointerException
at com.sun.jnlp.JNLPClassLoader.getPermissions(Unknown Source)
at java.security.SecureClassLoader.getProtectionDomain(SecureClassLoader.java:206)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at desktop.DesktopProxySelector.<init>(DesktopProxySelector.java:24) <- code smippet below
at desktop.Main.main(Main.java:139) <- code smippet below
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Thread.java:724)
The relevant code parts are:
Desktop.Main.main
/**
* Main method, starts the application
*/
public static void main(String[] args) {
System.setProperty("java.net.useSystemProxies", "true");
//Logger.getLogger("httpclient.wire.header.level").setLevel(Level.FINEST);
//Logger.getLogger("org.apache.commons.httpclient.level").setLevel(Level.FINEST);
java.net.ProxySelector.setDefault(new DesktopProxySelector(java.net.ProxySelector.getDefault()));
(The last line is line number 139)
desktop.DesktopProxySelector:
public class DesktopProxySelector extends ProxySelector {
public DesktopProxySelector(ProxySelector defaultSelector) {
URI httpsUri = new CentralConfigurationService().getCentralLocation();
(The last line is line number 24 where the exception occures)
Can someone give us some clues hints (or better a solution) for this new behaviour of java caused by this 'minor' update.
When we run the application straight from the cli using java -jar Desktop.jar the application wil run file, so the issue has clearly something todo with the changes in java web start.
#trashgod: the error clearly has something to do with the Permissions change in 7u25, since the NullPointerException occurs in com.sun.jnlp.JNLPClassLoader.getPermissions.
Just to explain what I think happens (I am a colleague of Wouter):
desktop.Main instantiates a desktop.DesktopProxySelector (our class),
desktop.DesktopProxySelector instantiates desktop.configuration.CentralConfigurationService
desktop.configuration.CentralConfigurationService instantiates a java.net.URI.
On the first line of the DesktopProxySelector init where the CentralConfigurationService is instantiated the getPermissions method, called by the JNLPClassLoader, throws the NullPointerException. So something is going wrong while loading the CentralConfigurationService class by java webstart with getting the permissions for the class. Could that have anything to do with the fact that a URI class is instantiated, which requires extra permissions (a connection to a remote uri is setup)?
Eventually the problem was solved.
The problem was caused between a mismatch in the included jar files in the main MANIFEST.MF file vs the jar files mentioned in the launch.jnlp.
Apperently it is now required to have all jar files that will be used also be present in the launch.jnlp file.
(In the past it was decided to keep this file manually in sink, which obviously was not always maintained in a propper way. Now this process is automated, so the problem should no longer happen to us.)

Categories