We recently upgraded from JBoss 7.1.3-Final to 7.2.0-Final. Since we upgraded one of our applications, that uses the Java CLI public API, throws NullPointerExceptions every time a connection is terminated through the CLI API.
The following is our code to set up and close the connection to the JBoss CLI:
private CommandContext ctx;
private ModelControllerClient client;
public JBossCLITool() {
try {
ctx = CommandContextFactory.getInstance().newCommandContext();
} catch(CliInitializationException e) {
throw new IllegalStateException("Failed to initialize CLI context", e);
}
}
public void establishConnection() {
try {
ctx.connectController("localhost", 9999);
client = ctx.getModelControllerClient();
} catch (CommandLineException e) {
LOG.debug(e.toString());
}
}
public void terminateConnection() {
try {
if (!ctx.isTerminated()){
ctx.terminateSession();
}
} catch (Exception e) {
LOG.debug(e.toString());
}
}
when calling ctx.terminateSession() the following Exception is thrown:
13:46:58,691 ERROR [org.jboss.remoting.handler-errors] (Remoting "cli-client" read-1) Close handler threw an exception: java.lang.NullPointerException
at org.jboss.as.cli.impl.CommandContextImpl.handleClose(CommandContextImpl.java:1206) [org-jboss-as-jboss-as-cli-7.2.0.Final.jar:7.2.0.Final]
at org.jboss.as.cli.impl.CLIModelControllerClient$4.handleClose(CLIModelControllerClient.java:156) [org-jboss-as-jboss-as-cli-7.2.0.Final.jar:7.2.0.Final]
at org.jboss.as.cli.impl.CLIModelControllerClient$4.handleClose(CLIModelControllerClient.java:153) [org-jboss-as-jboss-as-cli-7.2.0.Final.jar:7.2.0.Final]
at org.jboss.remoting3.spi.SpiUtils.safeHandleClose(SpiUtils.java:54) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA]
at org.jboss.remoting3.spi.AbstractHandleableCloseable$CloseHandlerTask.run(AbstractHandleableCloseable.java:501) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA]
at org.jboss.remoting3.spi.AbstractHandleableCloseable.runCloseTask(AbstractHandleableCloseable.java:406) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA]
at org.jboss.remoting3.spi.AbstractHandleableCloseable.closeComplete(AbstractHandleableCloseable.java:277) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA]
at org.jboss.remoting3.ConnectionImpl.access$000(ConnectionImpl.java:38) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA]
at org.jboss.remoting3.ConnectionImpl$1.handleClose(ConnectionImpl.java:55) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA]
at org.jboss.remoting3.ConnectionImpl$1.handleClose(ConnectionImpl.java:53) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA]
at org.jboss.remoting3.spi.SpiUtils.safeHandleClose(SpiUtils.java:54) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA]
at org.jboss.remoting3.spi.AbstractHandleableCloseable$CloseHandlerTask.run(AbstractHandleableCloseable.java:501) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA]
at org.jboss.remoting3.spi.AbstractHandleableCloseable.runCloseTask(AbstractHandleableCloseable.java:406) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA]
at org.jboss.remoting3.spi.AbstractHandleableCloseable.closeComplete(AbstractHandleableCloseable.java:277) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA]
at org.jboss.remoting3.remote.RemoteConnectionHandler.handleConnectionClose(RemoteConnectionHandler.java:117) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA]
at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:78) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA]
at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:45) [org-jboss-remoting3-jboss-remoting-3.2.14.GA.jar:3.2.14.GA]
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA]
at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA]
at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA]
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA]
at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA]
at org.xnio.ssl.JsseConnectedSslStreamChannel.handleReadable(JsseConnectedSslStreamChannel.java:180) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA]
at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA]
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72) [org-jboss-xnio-xnio-api-3.0.7.GA.jar:3.0.7.GA]
at org.xnio.nio.NioHandle.run(NioHandle.java:90) [org-jboss-xnio-xnio-nio-3.0.7.GA.jar:3.0.7.GA]
at org.xnio.nio.WorkerThread.run(WorkerThread.java:187) [org-jboss-xnio-xnio-nio-3.0.7.GA.jar:3.0.7.GA]
Using the 7.1.3 API and JBoss AS the same code works fine. Even with 7.2 the connection seems to be closed correctly (after calling terminateSession() no further calls to the CLI can be made until I establish a new connection).
I asked the same question in the JBoss community, just repeating it hear in hope of somebody else seeing it. Here's the link: https://community.jboss.org/message/828608
Well, I had the same problem.
To be serious, I haven't analyzed it in detail. Seems that it has something to do with the execution of composite DMRs - maybe in combination with a reload-required.
The parsedCommandLine in the CommandContext class is null. This is not checked by the close handler method.
As a first workaround I added a non invasive command before closing the context. I added the following line in my close method:
// Workaround for a strange NPE by jboss-cli I do not completely understand...
if (cmdCtx.getParsedCommandLine() == null
|| cmdCtx.getParsedCommandLine().getFormat() == null) {
cmdCtx.handle("/:read-attribute(name=launch-type)");
}
if (!cmdCtx.isTerminated()) {
cmdCtx.terminateSession();
}
Maybe not the best solution, but works on a first try...
Related
I am getting the below error when trying to download file in liferay
05:03:35,867 ERROR [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'][PortletRequestDispatcherImpl:115] org.springframework.web.util.NestedServletException: View rendering failed; nested exception is java.lang.IllegalStateException: Cannot obtain Writer because OutputStream is already in use
org.springframework.web.util.NestedServletException: View rendering failed; nested exception is java.lang.IllegalStateException: Cannot obtain Writer because OutputStream is already in use
at org.springframework.web.servlet.ViewRendererServlet.processRequest(ViewRendererServlet.java:96)
at org.springframework.web.servlet.ViewRendererServlet.doGet(ViewRendererServlet.java:67)
Caused by: java.lang.IllegalStateException: Cannot obtain Writer because OutputStream is already in use
at com.liferay.portlet.MimeResponseImpl.getWriter(MimeResponseImpl.java:90)
at com.liferay.portlet.PortletServletResponse.getWriter(PortletServletResponse.java:207)
at com.netcracker.portal.framework.spring.templates.view.SoyDataView.renderMergedOutputModel(SoyDataView.java:93)
and below is the code, i tried searching online but none of them have worked
String defaultFileName = "hello.pdf";
resourceResponse.setContentType("application/octet-stream");
resourceResponse.addProperty(GenericServiceTransport.CONTENT_DISPOSITION, "attachment; filename= hello.pdf" );
resourceResponse.flushBuffer();
try {
out = resourceResponse.getPortletOutputStream();
out.write(backendFile.getContent());
out.flush();
out.close();
} catch (IOException e) {
logger.error(e.getMessage());
}
return;
As first item I'd try to remove the flushBuffer call. You probably get the exception in the line following it, and flushing the buffer surely will use the output stream.
If that doesn't help, please add mute code, e.g. the complete method including its signature
I'm using logback 1.7.5 with play framework 2.2.4, during working I'm getting such error:
Exception in thread "Thread-5" java.lang.ExceptionInInitializerError
at controllers.db.SyncDBManager.createDeviceCollectionsIfNotExists(SyncDBManager.scala)
at server.impl.logic.controller.DeviceInitializer.checkAuthenticationResponse(DeviceInitializer.java:226)
at server.impl.logic.controller.DeviceInitializer.processReceivedFrames(DeviceInitializer.java:117)
at server.impl.logic.controller.DeviceController.onReceivedPackets(DeviceController.java:77)
at server.impl.logic.io.DeviceReader.run(DeviceReader.java:130)
Caused by: java.util.NoSuchElementException: None.get
at scala.None$.get(Option.scala:313)
at scala.None$.get(Option.scala:311)
at controllers.base.MongoSyncHelper$class.$init$(MongoSyncHelper.scala:16)
at controllers.db.SyncDBManager$.<init>(SyncDBManager.scala:32)
at controllers.db.SyncDBManager$.<clinit>(SyncDBManager.scala)
... 5 more
But only on console, how can I catch such exception and write it to file?
Seems like an ordinary stack trace in a console printed with the sysout. Depending on your design if you want to log an exception with the Play logger you should do it in a catch block with one of logger's methods by passing an exception as one of parameters. For example:
try {
// code
} catch {
case e: Exception => play.api.Logger.error("An error occurred", e)
}
The logger level is up to you. If you don't have a catch block and want to log an unexpected exception that occurs in any place of an application you should log it in the Global object by overriding onError method.
override def onError(request: RequestHeader, e: Throwable): Future[SimpleResult] = {
play.api.Logger.error("An error occurred", e)
super.onError(request, e)
}
Remember that onError method is called only in the production mode.
I am trying to login Facebook by using multiple sets of login cridential from external excel sheet using TestNG but in between the code what i have written throws:
FAILED: f
java.lang.NullPointerException
at DataDriven.loginRetesting.f(loginRetesting.java:31)
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:601)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Code:
#Test
public void f() throws Exception{
FileInputStream fi=new FileInputStream("E:\\workspace99\\SeleniumAutomations\\testdata\\LoginData.xls");
Workbook w=Workbook.getWorkbook(fi);
Sheet s=w.getSheet(0);
for (int i = 1; i < 8; i++) {
driver.findElement(By.id("email")).sendKeys(s.getCell(0,i).getContents());
driver.findElement(By.id("pass")).sendKeys(s.getCell(1,i).getContents());
driver.findElement(By.id("u_0_1")).click();
Thread.sleep(1000);
if (selenium.isElementPresent("id=userNavigationLabel")) {
//driver.findElement(By.cssSelector("span.gb_V.gbii")).click();
driver.findElement(By.id("userNavigationLabel")).click();
driver.findElement(By.cssSelector("input.uiLinkButtonInput")).click();
Thread.sleep(1000);
}
else{
System.out.println("invalid cridential");
driver.findElement(By.id("email")).clear();
driver.findElement(By.id("pass")).clear();
}
}
}
I am not able to find out where the problem is? so how to solve it.
For one thing, don't use "throws Exception" in the method declaration. Instead, have a try block inside the method with a "not null assertion".
Keep in mind that you never want to throw typical exceptions in a test method because it will drop you out of the test lifecycle too early and skip your #After phases. An exception thrown in a #Before annotated method will probably cause a SkipAssertion.
So, what you want to do instead is fail assertions. So, if you have a exception condition that occurs sometimes, swallow the exception (don't throw it) and use an assertion to handle it.
For example:
try {
} catch ( NullPointerException e ) {
Assert.assertTrue( "There was an error in blah.", false );
}
Null pointer means, exepected value of variable is null.
Please check the file exists at the specified path "E:\workspace99\SeleniumAutomations\testdata\LoginData.xls" and you get the value correctly from the file.
The stack trace says the issue is line 31 in your code but your snippet does not allow us to work out where line 31 is .
you are calling "selenium.isElementPresent". Could "selenium" be nil?
Error receiving connection: java.net.SocketException: Invalid argument
Exception in thread "Thread-698" java.lang.RuntimeException: Did not
establish input/output at
Handin2.ConnectionHandlerImpl.run(ConnectionHandlerImpl.java:124) at
java.lang.Thread.run(Thread.java:722)
I have been searching a lot on this exception. Everywhere it seems to be the conclusion that if you compile with the JVM option -Djava.net.preferIPv4Stack=true it will solve the problem. It doesn't for me though. I am running IntelliJ and trying to implement a Chord system with Sockets and Threads. This is where the above mentioned exception is caught and thrown:
if(this.remote == null || this.node == null) {
throw new RuntimeException("Connection handler has not been properly "
+ "initalialized");
}
try{
if(this.out == null) {
this.out = new ObjectOutputStream(remote.getOutputStream());
}
if(this.in == null) {
this.in = new ObjectInputStream(remote.getInputStream());
}
} catch(IOException e) {
System.out.println("Trying to make input/output for remote " + remote);
System.err.println(node.getKey()/Constants.NORMALIZE_KEY+": Error receiving connection: " + e.toString());
return false;
}
I don't know if more code snippets are needed in order to help, but I am simply lost on this exception since the solutions when searching are not helping at all.
Any hints on what triggers this error? The socket exception is caught by the given try-catch block as a special case of an IO exception
if you compile with the JVM option -Djava.net.preferIPv4Stack=true it will solve the problem.
No. If you execute with that JVM option. Nothing to do with the compiler.
I'm developing a framework that, as one of its features, enables robots to use a rule based system. We began with Jess as the RBS, and now wanted to implement drools (using Drools 5.2.0 final), which works on our development machines running on OpenJDK 6.
Our robot controller runs ARM Linux and JamVM, previously 1.4.3, but I recently compiled 1.5.4 because it was missing classes needed by drools. After failures, I installed JamVM in a virtual machine using the same configurations as when I compiled it for the controller, and there it failed with the same exceptions.
A little research showed that there are bug reports for Drools + JamVM, but this also means that it generally does work.
When Running the framework with precompiled rules with the following code...
kBase = KnowledgeBaseFactory.newKnowledgeBase();
ObjectInputStream in;
Collection<KnowledgePackage> kpkgs;
try {
in = new ObjectInputStream(Thread.currentThread().getContextClassLoader().getResourceAsStream(
packageFile));
kpkgs = (Collection<KnowledgePackage>) in.readObject();
in.close();
} catch(IOException e) {
throw new DisboticsException("Couldn't read drools knowledge package file!", e);
} catch(ClassNotFoundException e) {
throw new DisboticsException("Drools knowledge package file didn't contain expected instance.", e);
}
kBase.addKnowledgePackages(kpkgs);
kSession = kBase.newStatefulKnowledgeSession();
...I got this exception:
java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:131)
at java.util.AbstractList.add(AbstractList.java:152)
at org.drools.rule.JavaDialectRuntimeData.write(JavaDialectRuntimeData.java:383)
at org.drools.rule.JavaDialectRuntimeData.merge(JavaDialectRuntimeData.java:266)
at org.drools.rule.JavaDialectRuntimeData.clone(JavaDialectRuntimeData.java:251)
at org.drools.rule.DialectRuntimeRegistry.merge(DialectRuntimeRegistry.java:110)
at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:496)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:427)
at org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:149)
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:76)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
Exception in thread "main" org.drools.RuntimeDroolsException: java.lang.UnsupportedOperationException
at org.drools.rule.JavaDialectRuntimeData.write(JavaDialectRuntimeData.java:386)
at org.drools.rule.JavaDialectRuntimeData.merge(JavaDialectRuntimeData.java:266)
at org.drools.rule.JavaDialectRuntimeData.clone(JavaDialectRuntimeData.java:251)
at org.drools.rule.DialectRuntimeRegistry.merge(DialectRuntimeRegistry.java:110)
at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:496)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:427)
at org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:149)
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:76)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
Caused by: java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:131)
at java.util.AbstractList.add(AbstractList.java:152)
at org.drools.rule.JavaDialectRuntimeData.write(JavaDialectRuntimeData.java:383)
...9 more
...which works in OpenJDK. weirdly, it turns out that the list in question in JavaDialectRuntimeData is obtained via Collections.emptyList() and is never changed again (or so eclipse suggests...).
When running with bare .drl files using this code:
Properties props = new Properties();
props.put("drools.dialect.java.compiler", "JANINO");
KnowledgeBuilderConfiguration kbConfig = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(props,
(ClassLoader[]) null);
KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(kbConfig);
kBuilder.add(ResourceFactory.newClassPathResource("disbotics/core/rules/drools/function.drl",
DroolsRulesPlugin.class), ResourceType.DRL);
kBuilder.add(ResourceFactory.newClassPathResource(rulesFile, DroolsRulesPlugin.class), ResourceType.DRL);
if(kBuilder.hasErrors()) {
String errorMessage = "";
for(KnowledgeBuilderError error:kBuilder.getErrors())
errorMessage = errorMessage + error.getMessage() + "\n";
throw new DisboticsException(errorMessage);
}
kBase = KnowledgeBaseFactory.newKnowledgeBase();
kBase.addKnowledgePackages(kBuilder.getKnowledgePackages());
kSession = kBase.newStatefulKnowledgeSession();
... I get these (unexpected) exceptions from the rules compiler:
Exception in thread "main" disbotics.core.common.DisboticsException: Line 2:8 unexpected exception at input '"mvel"'. Exception: java.lang.UnsupportedOperationException. Stack trace:
java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:131)
at java.util.AbstractList.add(AbstractList.java:152)
at org.drools.lang.descr.PackageDescr.addAttribute(PackageDescr.java:138)
at org.drools.lang.api.impl.PackageDescrBuilderImpl.attribute(PackageDescrBuilderImpl.java:93)
at org.drools.lang.ParserHelper.start(ParserHelper.java:684)
at org.drools.lang.DRLParser.stringAttribute(DRLParser.java:1289)
at org.drools.lang.DRLParser.attribute(DRLParser.java:1062)
at org.drools.lang.DRLParser.statement(DRLParser.java:276)
at org.drools.lang.DRLParser.compilationUnit(DRLParser.java:155)
at org.drools.compiler.DrlParser.compile(DrlParser.java:225)
at org.drools.compiler.DrlParser.parse(DrlParser.java:136)
at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:352)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:538)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:55)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
[ERR 107] Line 2:8 mismatched input '"mvel"' expecting one of the following tokens: '[package, import, global, declare, function, rule, query]'.
Line 4:0 unexpected exception at input 'global'. Exception: java.util.EmptyStackException. Stack trace:
java.util.EmptyStackException
at java.util.Stack.pop(Stack.java:109)
at org.drools.lang.ParserHelper.popParaphrases(ParserHelper.java:421)
at org.drools.lang.ParserHelper.end(ParserHelper.java:732)
at org.drools.lang.DRLParser.globalStatement(DRLParser.java:401)
at org.drools.lang.DRLParser.statement(DRLParser.java:261)
at org.drools.lang.DRLParser.compilationUnit(DRLParser.java:155)
at org.drools.compiler.DrlParser.compile(DrlParser.java:225)
at org.drools.compiler.DrlParser.parse(DrlParser.java:136)
at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:352)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:538)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:55)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
Parser returned a null Package
Line 2:8 unexpected exception at input '"java"'. Exception: java.lang.UnsupportedOperationException. Stack trace:
java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:131)
at java.util.AbstractList.add(AbstractList.java:152)
at org.drools.lang.descr.PackageDescr.addAttribute(PackageDescr.java:138)
at org.drools.lang.api.impl.PackageDescrBuilderImpl.attribute(PackageDescrBuilderImpl.java:93)
at org.drools.lang.ParserHelper.start(ParserHelper.java:684)
at org.drools.lang.DRLParser.stringAttribute(DRLParser.java:1289)
at org.drools.lang.DRLParser.attribute(DRLParser.java:1062)
at org.drools.lang.DRLParser.statement(DRLParser.java:276)
at org.drools.lang.DRLParser.compilationUnit(DRLParser.java:155)
at org.drools.compiler.DrlParser.compile(DrlParser.java:225)
at org.drools.compiler.DrlParser.parse(DrlParser.java:136)
at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:352)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:538)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:57)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
[ERR 107] Line 2:8 mismatched input '"java"' expecting one of the following tokens: '[package, import, global, declare, function, rule, query]'.
Line 4:0 unexpected exception at input 'import'. Exception: java.util.EmptyStackException. Stack trace:
java.util.EmptyStackException
at java.util.Stack.pop(Stack.java:109)
at org.drools.lang.ParserHelper.popParaphrases(ParserHelper.java:421)
at org.drools.lang.ParserHelper.end(ParserHelper.java:732)
at org.drools.lang.DRLParser.importStatement(DRLParser.java:349)
at org.drools.lang.DRLParser.statement(DRLParser.java:258)
at org.drools.lang.DRLParser.compilationUnit(DRLParser.java:155)
at org.drools.compiler.DrlParser.compile(DrlParser.java:225)
at org.drools.compiler.DrlParser.parse(DrlParser.java:136)
at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:352)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:538)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:57)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
Line 6:0 unexpected exception at input 'rule'. Exception: java.util.EmptyStackException. Stack trace:
java.util.EmptyStackException
at java.util.Stack.pop(Stack.java:109)
at org.drools.lang.ParserHelper.popParaphrases(ParserHelper.java:421)
at org.drools.lang.ParserHelper.end(ParserHelper.java:732)
at org.drools.lang.DRLParser.rule(DRLParser.java:886)
at org.drools.lang.DRLParser.statement(DRLParser.java:267)
at org.drools.lang.DRLParser.compilationUnit(DRLParser.java:155)
at org.drools.compiler.DrlParser.compile(DrlParser.java:225)
at org.drools.compiler.DrlParser.parse(DrlParser.java:136)
at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:352)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:538)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:57)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
Parser returned a null Package
at disbotics.core.config.DroolsRulesPlugin.initialize(DroolsRulesPlugin.java:63)
at disbotics.core.common.DisboticsCore.startFramework(DisboticsCore.java:109)
at disbotics.core.common.DisboticsCore.main(DisboticsCore.java:56)
again, compiling the rules worked just fine in OpenJDK. We're using Janino, and it is properly referenced on the classpath (the classpath used at runtime is created by the Maven build, so contains all jars referenced by drools/janino/ anything else)
Does anyone know what's going on here and/or how to get Drools working with JamVM?
Are you compiling the knowledge packages using OpenJDK 1.6? and then trying to load it with 1.5.4? You should try compiling the original packages using 1.5.4 and see if you have the same errors.
For the stack trace, it looks like you are trying to add something to an unmodifiable list right?
Basically you are getting the exception here: kBase.addKnowledgePackages(kpkgs);
Right?