I have created a very simple model in AnyLogic consisting of source, Service, sink and resourcepool blocks. The source is connected to service which is then connected to sink. The source block generates agents of type 1 and resourcepool has agent type 2. When I run the model, I am getting following runtime error. There are no attributes to both the agent types. Also, agent types are created and not population.
java.lang.NullPointerException
at com.anylogic.engine.Port.connect(Unknown Source)
at com.anylogic.libraries.processmodeling.Seize.doCreate(Unknown Source)
at com.anylogic.engine.Agent.createAsEmbedded(Unknown Source)
at com.anylogic.libraries.processmodeling.Service.doCreate(Unknown Source)
at com.anylogic.engine.Agent.createAsEmbedded(Unknown Source)
at model.Main.doCreate(Main.java.619)
at com.anylogic.engine.Agent.createAsEmbedded(Unknown Source)
at com.anylogic.engine.Agent.create(Unknown Source)
at com.anylogic.engine.Engine.start(Unknown Source)
I tried debugging the model but no success and also verified that all the initializations are not null.
Model:
enter image description here
Source properties:
enter image description here
Service properties:
enter image description here
Resourcepool properties:
enter image description here
Related
My road traffic model is throwing null pointers with a very cryptic stacktrace:
Exception during discrete event execution:
NullPointerException
java.lang.NullPointerException
at com.anylogic.libraries.road.Car_xjal.g(Unknown Source)
at com.anylogic.libraries.road.Car_xjal.al(Unknown Source)
at com.anylogic.libraries.road.Car_xjal.a(Unknown Source)
at com.anylogic.libraries.road.Car_xjal.on_SegmentEndEvent_xjal(Unknown Source)
at com.anylogic.libraries.road.Car_xjal$SegmentEndEvent.execute(Unknown Source)
at com.anylogic.engine.Engine.n(Unknown Source)
at com.anylogic.engine.Engine.cl(Unknown Source)
at com.anylogic.engine.Engine$n.run(Unknown Source)
The null pointer also doesn't happen immediately, I am able to see the model run for varying lengths of time(60-800 model seconds).
When a breakpoint is created, it says the following:
The JAR file C:\Program Files\AnyLogic 8.8 Professional\plugins\com.anylogic.road_traffic_library_8.8.1.202210270952\lib\RoadTrafficLibrary.jar
has no source attachment. You can attach a source by clicking Attach Source below
It also occasionally throws the same error, but citing a different path("C:\Program Files\AnyLogic 8.8 Professional\jre\lib\jrt-fs.jar") as having no source attachment instead.
Any help is appreciated.
I am trying to integrate bing translator in my java application. I have registered to Microsoft azure cognitive service and Microsoft market place.
while executing below code
import com.memetix.mst.language.Language;
import com.memetix.mst.translate.Translate;
public class Main {
public static void main(String[] args) {
try{
Translate.setClientId(/* my Client Id */);
Translate.setClientSecret(/* my Client Secret */);
String translatedText = Translate.execute("Bonjour le monde", Language.FRENCH, Language.ENGLISH);
System.out.println(translatedText);
}
catch(Exception e) {
System.err.println("Exception: " + e.getMessage());
}
}
}
I am getting below exception:
Page NoException in thread "main" java.lang.Exception: [microsoft-translator-api] Error retrieving translation : Server returned HTTP response code: 400 for URL: https://datamarket.accesscontrol.windows.net/v2/OAuth2-13
at com.memetix.mst.MicrosoftTranslatorAPI.retrieveString(MicrosoftTranslatorAPI.java:202)
at com.memetix.mst.translate.Translate.execute(Translate.java:61)
at test.SimpleExcelTranalator.main(SimpleExcelTranalator.java:44)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://datamarket.accesscontrol.windows.net/v2/OAuth2-13
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at com.memetix.mst.MicrosoftTranslatorAPI.getToken(MicrosoftTranslatorAPI.java:139)
at com.memetix.mst.MicrosoftTranslatorAPI.retrieveResponse(MicrosoftTranslatorAPI.java:160)
at com.memetix.mst.MicrosoftTranslatorAPI.retrieveString(MicrosoftTranslatorAPI.java:199)
... 2 more
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://datamarket.accesscontrol.windows.net/v2/OAuth2-13
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
at com.memetix.mst.MicrosoftTranslatorAPI.getToken(MicrosoftTranslatorAPI.java:138)
... 4 more
The datamarket url is where you get your client id and secret from. Is that where you're sending your translation request to? Should be something like
http://api.microsofttranslator.com/v2/Http.svc/Translate?
Also datamarket is being deprecated. You have to switch to Azure Cognitive Services
http://docs.microsofttranslator.com/text-translate.html
According to your referenced package com.memetix.mst.language.* in your code, I searched and found its source code on GitHub, repository on Maven, and an old repository on GoogleCode. I reviewed its source code, and discovered it wrappered the MS Translator Text API from Azure old datamarket web site. The library is out of date with the old REST API, the old website shows "THE MICROSOFT TRANSLATOR API IS NOW AVAILABLE ON THE AZURE PORTAL" and "IMPORTANT: An Azure account is required. Read the steps to get started on the portal here." So first you need to have an Azure subscription to create a Translator Text API service on Azure portal, then write code to call the new REST API. You can refer to my answer for the two other SO threads as below to know how to use the new REST API and call it via my sample code.
My answer for MS Translator returns empty response when used with Azure token shows the new REST API usage.
My answer for Microsoft Translator API Java, How to get client new ID with Azure which includes my sample code, it shows how to call the new REST API in Java.
Hope it helps.
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.
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)
Bit of a specific one this..
I'm having trouble using the Openblox diameter stack when using Spring MVC, specifically the init method call on the transport stack:
import com.traffix.openblox.core.transport.TransportStack;
Stack stack = new TransportStack();
stack.init(configureStack());
I'm getting a null pointer exception on the call to init - note that the Configuration returned from configureStack() is valid and works on non-Spring MVC projects. Heres the stack trace:
2776 [pool-2-thread-1] WARN com.traffix.openblox.core.fsm.StateMachine - Idle failed to process <Initiate Transport Stack( Idle)
java.lang.NullPointerException
at com.traffix.openblox.core.utils.logging.StackLogger.init(Unknown Source)
at com.traffix.openblox.core.transport.Stack.g(Unknown Source)
at com.traffix.openblox.core.transport.TransportStack.g(Unknown Source)
at com.traffix.openblox.core.transport.u.N(Unknown Source)
at com.traffix.openblox.core.transport.c$a.processEvent(Unknown Source)
at com.traffix.openblox.core.fsm.StateMachine.a(Unknown Source)
at com.traffix.openblox.core.fsm.StateMachine.a(Unknown Source)
at com.traffix.openblox.core.transport.u.a(Unknown Source)
at com.traffix.openblox.core.transport.Stack.init(Unknown Source)
at com.rory.services.pcrf.simulator.PcrfSimulator.initialize(PcrfSimulator.java:131)
at com.rory.services.pcrf.simulator.PcrfSimulator.<init>(PcrfSimulator.java:113)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
There is some sort of conflict between Openblox and Tomcat. Workaround for now is by removing conf/logging.properties from the Tomcat directory.