XPath query in jlibs-xmldog throws NegativeArraySizeException - java

I have a project in which I try to run queries on XML files using in.jlibs.jlibs-xmldog.2.2.1.
The XPath that I'm using is
(//server[#id=123])[1]
and the file to be queried looks like this
<servers>
<server id="123" name="servername3">
<cpu_count>3</cpu_count>
<ram_gb>3</ram_gb>
<mac>aabbccaabbcc</mac>
<domain>test.internal</domain>
<ip>192.168.1.20</ip>
</server>
<server id="124" name="servername4">
<cpu_count>4</cpu_count>
<ram_gb>4</ram_gb>
<mac>aabbccaabbcc</mac>
<domain>test.internal</domain>
<ip>192.168.1.20</ip>
</server>
<server id="125" name="servername5">
<cpu_count>5</cpu_count>
<ram_gb>5</ram_gb>
<mac>aabbccaabbcc</mac>
<domain>test.internal</domain>
<ip>192.168.1.20</ip>
</server>
</servers>
As you can see, there is already only one result that is returned by the inner xpath statement, but I have some reasons for which I need to do the query like this. Anyway, the same behaviour happens if I have more results returned by the inner statement. I've tested the xpath online and it seems to be valid.
Code:
public static void main(String[] args) throws Exception{
final String filePath = "C:\\Users\\NCsorba\\Desktop\\xml\\sample_11433_entries.xml";
final String xPathExpression = "(//server[#id=123])[1]";
DefaultNamespaceContext namespaceContext = new DefaultNamespaceContext();
namespaceContext.declarePrefix("xsd", Namespaces.URI_XSD);
XMLDog xmlDog = new XMLDog(namespaceContext);
Expression compiledXPath = xmlDog.addXPath(xPathExpression);
XPathResults xPathResults = xmlDog.sniff(new InputSource(filePath)); // exception thrown
// System.out.println(xPathResults.getResult(compiledXPath));
}
Here is the stack trace:
Exception in thread "main" java.lang.NegativeArraySizeException
at jlibs.core.util.LongTreeMap$Values.toArray(LongTreeMap.java:534)
at java.util.ArrayList.<init>(ArrayList.java:178)
at jlibs.xml.sax.dog.expr.nodset.PathEvaluation.finished(PathExpression.java:218)
at jlibs.xml.sax.dog.expr.nodset.LocationEvaluation.fireFinished(LocationEvaluation.java:215)
at jlibs.xml.sax.dog.expr.nodset.LocationEvaluation.finished(LocationEvaluation.java:208)
at jlibs.xml.sax.dog.expr.nodset.LocationEvaluation.resultPrepared(LocationEvaluation.java:190)
at jlibs.xml.sax.dog.expr.nodset.LocationEvaluation.expired(LocationEvaluation.java:176)
at jlibs.xml.sax.dog.path.EventID.expireList(EventID.java:244)
at jlibs.xml.sax.dog.path.EventID.expire(EventID.java:230)
at jlibs.xml.sax.dog.path.EventID.pop(EventID.java:322)
at jlibs.xml.sax.dog.sniff.Event.firePop(Event.java:266)
at jlibs.xml.sax.dog.sniff.Event.pop(Event.java:712)
at jlibs.xml.sax.dog.sniff.Event.onEndDocument(Event.java:587)
at jlibs.xml.sax.dog.sniff.SAXHandler.endDocument(SAXHandler.java:75)
at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at jlibs.xml.sax.dog.XMLDog.sniff(XMLDog.java:189)
at jlibs.xml.sax.dog.XMLDog.sniff(XMLDog.java:174)
at jlibs.xml.sax.dog.XMLDog.sniff(XMLDog.java:205)
at jlibs.xml.sax.dog.XMLDog.sniff(XMLDog.java:212)
at com.hp.oo.content.actions.xml.Main.main(Main.java:24)
--------------- linked to ------------------
javax.xml.xpath.XPathException: java.lang.NegativeArraySizeException
at jlibs.xml.sax.dog.XMLDog.sniff(XMLDog.java:192)
at jlibs.xml.sax.dog.XMLDog.sniff(XMLDog.java:174)
at jlibs.xml.sax.dog.XMLDog.sniff(XMLDog.java:205)
at jlibs.xml.sax.dog.XMLDog.sniff(XMLDog.java:212)
at com.hp.oo.content.actions.xml.Main.main(Main.java:24)
Caused by: java.lang.NegativeArraySizeException
at jlibs.core.util.LongTreeMap$Values.toArray(LongTreeMap.java:534)
at java.util.ArrayList.<init>(ArrayList.java:178)
at jlibs.xml.sax.dog.expr.nodset.PathEvaluation.finished(PathExpression.java:218)
at jlibs.xml.sax.dog.expr.nodset.LocationEvaluation.fireFinished(LocationEvaluation.java:215)
at jlibs.xml.sax.dog.expr.nodset.LocationEvaluation.finished(LocationEvaluation.java:208)
at jlibs.xml.sax.dog.expr.nodset.LocationEvaluation.resultPrepared(LocationEvaluation.java:190)
at jlibs.xml.sax.dog.expr.nodset.LocationEvaluation.expired(LocationEvaluation.java:176)
at jlibs.xml.sax.dog.path.EventID.expireList(EventID.java:244)
at jlibs.xml.sax.dog.path.EventID.expire(EventID.java:230)
at jlibs.xml.sax.dog.path.EventID.pop(EventID.java:322)
at jlibs.xml.sax.dog.sniff.Event.firePop(Event.java:266)
at jlibs.xml.sax.dog.sniff.Event.pop(Event.java:712)
at jlibs.xml.sax.dog.sniff.Event.onEndDocument(Event.java:587)
at jlibs.xml.sax.dog.sniff.SAXHandler.endDocument(SAXHandler.java:75)
at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at jlibs.xml.sax.dog.XMLDog.sniff(XMLDog.java:189)
... 4 more
--------------- linked to ------------------
javax.xml.xpath.XPathException: javax.xml.xpath.XPathException: java.lang.NegativeArraySizeException
at jlibs.xml.sax.dog.XMLDog.sniff(XMLDog.java:176)
at jlibs.xml.sax.dog.XMLDog.sniff(XMLDog.java:205)
at jlibs.xml.sax.dog.XMLDog.sniff(XMLDog.java:212)
at com.hp.oo.content.actions.xml.Main.main(Main.java:24)
Caused by: javax.xml.xpath.XPathException: java.lang.NegativeArraySizeException
at jlibs.xml.sax.dog.XMLDog.sniff(XMLDog.java:192)
at jlibs.xml.sax.dog.XMLDog.sniff(XMLDog.java:174)
... 3 more
Caused by: java.lang.NegativeArraySizeException
at jlibs.core.util.LongTreeMap$Values.toArray(LongTreeMap.java:534)
at java.util.ArrayList.<init>(ArrayList.java:178)
at jlibs.xml.sax.dog.expr.nodset.PathEvaluation.finished(PathExpression.java:218)
at jlibs.xml.sax.dog.expr.nodset.LocationEvaluation.fireFinished(LocationEvaluation.java:215)
at jlibs.xml.sax.dog.expr.nodset.LocationEvaluation.finished(LocationEvaluation.java:208)
at jlibs.xml.sax.dog.expr.nodset.LocationEvaluation.resultPrepared(LocationEvaluation.java:190)
at jlibs.xml.sax.dog.expr.nodset.LocationEvaluation.expired(LocationEvaluation.java:176)
at jlibs.xml.sax.dog.path.EventID.expireList(EventID.java:244)
at jlibs.xml.sax.dog.path.EventID.expire(EventID.java:230)
at jlibs.xml.sax.dog.path.EventID.pop(EventID.java:322)
at jlibs.xml.sax.dog.sniff.Event.firePop(Event.java:266)
at jlibs.xml.sax.dog.sniff.Event.pop(Event.java:712)
at jlibs.xml.sax.dog.sniff.Event.onEndDocument(Event.java:587)
at jlibs.xml.sax.dog.sniff.SAXHandler.endDocument(SAXHandler.java:75)
at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at jlibs.xml.sax.dog.XMLDog.sniff(XMLDog.java:189)
... 4 more
I'll appreciate any help! Thanks!

Related

org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream cannot be cast to java.base/java.util.zip.ZipFile$ZipFileInputStream

I have some code that is intended to save some data to an excel file. This code works flawlessly on any java version before Java 10 but upon using java 10 it gives the error mentioned in the title.
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream cannot be cast to java.base/java.util.zip.ZipFile$ZipFileInputStream
at java.base/java.util.zip.ZipFile$ZipFileInflaterInputStream.available(Unknown Source)
at org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream.available(ZipSecureFile.java:299)
at java.base/sun.nio.cs.StreamDecoder.inReady(Unknown Source)
at java.base/sun.nio.cs.StreamDecoder.implRead(Unknown Source)
at java.base/sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.base/sun.nio.cs.StreamDecoder.read0(Unknown Source)
at java.base/sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.base/java.io.InputStreamReader.read(Unknown Source)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.copyStreamAndInjectWorksheet(SXSSFWorkbook.java:485)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.injectData(SXSSFWorkbook.java:359)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.write(SXSSFWorkbook.java:947)
at tools.ExportExcelFiles.printSchedule(ExportExcelFiles.java:1117)
at ui.ScheduleMainFrame.jButtonScheduleExportActionPerformed(ScheduleMainFrame.java:1889)
at ui.ScheduleMainFrame.access$7(ScheduleMainFrame.java:1856)
at ui.ScheduleMainFrame$10.actionPerformed(ScheduleMainFrame.java:965)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.desktop/java.awt.Component.processEvent(Unknown Source)
at java.desktop/java.awt.Container.processEvent(Unknown Source)
at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue.access$600(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
The code snippet in question looks like this...
if (n == 0) {
FileOutputStream fileOut = new FileOutputStream(SCHEDULEFILENAME); //The export file name and path
wb.write(fileOut); // <--- cause of error(works fine below java 10 versions)
fileOut.close();
JOptionPane.showMessageDialog(null, "Schedule successfully exported into Data\\PM\\OPUS\\Schedule OPUS", "Schedule.xlsx", 1);
FilesAndFolders.openFolder(EXPORTSCHEDULEFOLDERPATH);
}
If anyone can provide any insight as to how to deal with this, i'd really appreciate it! :)

Server returned HTTP response code: 403 for URL: http://www.springframework.org/dtd/spring-beans.dtd

enter image description here
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: http://www.springframework.org/dtd/spring-beans.dtd
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:428)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
... 22 more

Getting SecurityException when deserializing object despite using AllPermission java policy

In my XPages application, I backup certain objects by serializing and saving them to MIME entities in backup documents. To reload the objects later, I use the following server-side JavaScript function for deserialization:
var entity:NotesMIMEEntity=doc.getMIMEEntity(field);
if (!entity) return null;
var stream:NotesStream=session.createStream();
entity.getContentAsBytes(stream);
stream.setPosition(0);
var ois:java.io.ObjectInputStream=new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(stream.read()));
var o=ois.readObject(); // ERROR OCCURS IN THIS LINE
ois.close();
entity.recycle();
doc.closeMIMEEntities(false,field);
When I try to read the object from the stream, an exception is raised:
java.lang.SecurityException: Java bridge is not allowed
I have set the java.security.AllPermission in the java.policy file, so I don't know why this exception is raised anyway. I also found that this problem only occurs when I run my application in the Notes Client, but everything works fine when I run it in the browser via the Domino server.
Can anybody tell me how to solve this issue?
PS: Here is the full trace for the SecurityException:
java.lang.SecurityException: Java bridge is not allowed
at com.ibm.jscript.types.JavaAccessObject.<init>(Unknown Source)
at com.ibm.jscript.types.FBSUtility.wrapAsObject(Unknown Source)
at com.ibm.jscript.types.FBSUtility.wrap(Unknown Source)
at com.ibm.jscript.types.FBSValue.readValue(Unknown Source)
at com.ibm.jscript.types.FBSDefaultObject.readExternal(Unknown Source)
at com.ibm.jscript.std.ObjectObject.readExternal(Unknown Source)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.ibm.jscript.types.JavaAccessObject.call(Unknown Source)
at com.ibm.jscript.types.FBSObject.call(Unknown Source)
at com.ibm.jscript.ASTTree.ASTCall.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTVariableDecl.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTBlock.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTTry.interpret(Unknown Source)
at com.ibm.jscript.std.FunctionObject._executeFunction(Unknown Source)
at com.ibm.jscript.std.FunctionObject.executeFunction(Unknown Source)
at com.ibm.jscript.std.FunctionObject.call(Unknown Source)
at com.ibm.jscript.types.FBSObject.call(Unknown Source)
at com.ibm.jscript.ASTTree.ASTCall.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTAssign.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTBlock.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTIf.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTBlock.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTTry.interpret(Unknown Source)
at com.ibm.jscript.std.FunctionObject._executeFunction(Unknown Source)
at com.ibm.jscript.std.FunctionObject.executeFunction(Unknown Source)
at com.ibm.jscript.std.FunctionObject.call(Unknown Source)
at com.ibm.jscript.types.FBSObject.call(Unknown Source)
at com.ibm.jscript.ASTTree.ASTCall.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTAssign.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTBlock.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTForIn.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTBlock.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTTry.interpret(Unknown Source)
at com.ibm.jscript.std.FunctionObject._executeFunction(Unknown Source)
at com.ibm.jscript.std.FunctionObject.executeFunction(Unknown Source)
at com.ibm.jscript.std.FunctionObject.call(Unknown Source)
at com.ibm.jscript.types.FBSObject.call(Unknown Source)
at com.ibm.jscript.ASTTree.ASTCall.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTBlock.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTTry.interpret(Unknown Source)
at com.ibm.jscript.std.FunctionObject._executeFunction(Unknown Source)
at com.ibm.jscript.std.FunctionObject.executeFunction(Unknown Source)
at com.ibm.jscript.std.FunctionObject.call(Unknown Source)
at com.ibm.jscript.types.FBSObject.call(Unknown Source)
at com.ibm.jscript.ASTTree.ASTCall.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTUnaryOp.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTIf.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTProgram.interpret(Unknown Source)
at com.ibm.jscript.ASTTree.ASTProgram.interpretEx(Unknown Source)
at com.ibm.jscript.JSExpression._interpretExpression(Unknown Source)
at com.ibm.jscript.JSExpression.access$1(Unknown Source)
at com.ibm.jscript.JSExpression$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Unknown Source)
at com.ibm.jscript.JSExpression.interpretExpression(Unknown Source)
at com.ibm.jscript.JSExpression.evaluateValue(Unknown Source)
at com.ibm.jscript.JSExpression.evaluateValue(Unknown Source)
at com.ibm.xsp.javascript.JavaScriptInterpreter.interpret(Unknown Source)
at com.ibm.xsp.binding.javascript.JavaScriptMethodBinding.invoke(Unknown Source)
at com.ibm.xsp.component.UIIncludeComposite.initBeforePageContents(Unknown Source)
at com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(Unknown Source)
at com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(Unknown Source)
at com.ibm.xsp.page.compiled.AbstractCompiledPage.addComponent(Unknown Source)
at com.ibm.xsp.component.UIIncludeComposite.buildContents(Unknown Source)
at com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(Unknown Source)
at com.ibm.xsp.page.compiled.CompiledComponentBuilder.buildChildren(Unknown Source)
at com.ibm.xsp.page.compiled.CompiledComponentBuilder.buildAll(Unknown Source)
at com.ibm.xsp.component.UIViewRootEx.buildContents(Unknown Source)
at com.ibm.xsp.component.UIViewRootEx2.buildContents(Unknown Source)
at com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(Unknown Source)
at com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(Unknown Source)
at com.ibm.xsp.page.compiled.AbstractCompiledPage.createViewRoot(Unknown Source)
at com.ibm.xsp.application.ViewHandlerExImpl._createViewRoot(Unknown Source)
at com.ibm.xsp.application.ViewHandlerExImpl.createViewRoot(Unknown Source)
at com.ibm.xsp.application.ViewHandlerExImpl.doCreateView(Unknown Source)
at com.ibm.xsp.application.ViewHandlerEx.createView(Unknown Source)
at com.ibm.xsp.webapp.FacesServlet.serviceView(Unknown Source)
at com.ibm.xsp.webapp.FacesServletEx.serviceView(Unknown Source)
at com.ibm.xsp.webapp.FacesServlet.service(Unknown Source)
at com.ibm.xsp.webapp.FacesServletEx.service(Unknown Source)
at com.ibm.xsp.webapp.DesignerFacesServlet.service(Unknown Source)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(Unknown Source)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(Unknown Source)
at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(Unknown Source)
at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(Unknown Source)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(Unknown Source)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(Unknown Source)
at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(Unknown Source)
at com.ibm.domino.xsp.module.nsf.NSFService.access$0(Unknown Source)
at com.ibm.domino.xsp.module.nsf.NSFService$NsfServiceRequest.call(Unknown Source)
at com.ibm.domino.xsp.module.nsf.NSFService$NsfServiceRequest.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at com.ibm.domino.xsp.module.nsf.NSFService$NsfServiceThread.run(Unknown Source)
Is this in Domino 9.0.x?
In XPiNC the Java security settings are not managed by the server but on the relevant Notes Client. In the User Security settings, on the What Others Do > Using Workstation tab, for each signer a check box was added in R9 for "Load Java Code". This needs to be ticked for the signer of the XPiNC application.

i want to create pdf in java from xls file using FOP?

i am using the code at for creating pdf using Apache FOP
but i am getting these exceptions when i run the code
Hi Testing
javax.xml.bind.MarshalException
- with linked exception:
[com.sun.istack.internal.SAXException2: class com.testFOP.Employee nor any of its super class is known to this context.
javax.xml.bind.JAXBException: class com.testFOP.Employee nor any of its super class is known to this context.]
at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(Unknown Source)
at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(Unknown Source)
at com.testFOP.PDFHandler.getXMLSource(PDFHandler.java:97)
at com.testFOP.TestPDF.main(TestPDF.java:37)
Caused by: com.sun.istack.internal.SAXException2: class com.testFOP.Employee nor any of its super class is known to this context.
javax.xml.bind.JAXBException: class com.testFOP.Employee nor any of its super class is known to this context.
at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsXsiType(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.property.ArrayElementNodeProperty.serializeItem(Unknow n Source)
at com.sun.xml.internal.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.property.ArrayERProperty.serializeBody(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsSoleContent(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot(Unknown Source)
... 5 more
Caused by: javax.xml.bind.JAXBException: class com.testFOP.Employee nor any of its super class is known to this context.
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getBeanInfo(Unknown Source)
... 13 more
Error on line 1 column 1
SXXP0003: Error reported by XML parser: Premature end of file.
net.sf.saxon.trans.XPathException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file.
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:420)
at net.sf.saxon.event.Sender.send(Sender.java:169)
at net.sf.saxon.Controller.transform(Controller.java:1890)
at com.testFOP.PDFHandler.createPDFFile(PDFHandler.java:64)
at com.testFOP.TestPDF.main(TestPDF.java:39)
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:396)
... 4 more
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:396)
at net.sf.saxon.event.Sender.send(Sender.java:169)
at net.sf.saxon.Controller.transform(Controller.java:1890)
at com.testFOP.PDFHandler.createPDFFile(PDFHandler.java:64)
at com.testFOP.TestPDF.main(TestPDF.java:39)
can any one help me to solve these issues.
thanks in advance
The problem can be sloved .. Please make following changes to "PDFHandler.java"..
try {
context = JAXBContext.newInstance(EmployeeData.class,Employee.class);
Marshaller m = context.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
m.marshal(data, outStream);
} catch (JAXBException e) {
e.printStackTrace();
}
And generated pdf will be placed in this location (in windows 7 os )
"C:\Users\narendar.g\AppData\Local\Temp" like 13891730308241855417914089056114.pdf

My java applet gets access denied to images that it embeds

I am coding a Java chess gui. It runs fine as an applet from Eclipse but I am struggling to get it to work on my local machine from an HTML page. I am using images which I include in the JAR. Images are accessed properly with an Eclipse Debug. What am I missing :( ?
The HTML looks like :
<html>
<applet code="Ginsie"
height="300px" width="300px" archive="chess.jar">
</applet>
</html>
The output of the Java Console (open from the browser) :
java.lang.RuntimeException: java.lang.ExceptionInInitializerError
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.ExceptionInInitializerError
at BoardPanel.loadSquares(BoardPanel.java:105)
at BoardPanel.<init>(BoardPanel.java:34)
at Ginsie.<init>(Ginsie.java:60)
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 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.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$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: java.security.AccessControlException: access denied (java.io.FilePermission ..\img\squares\Wood\BSQUARE.jpg read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.File.canRead(Unknown Source)
at javax.imageio.ImageIO.read(Unknown Source)
at Square.<clinit>(Square.java:47)
... 24 more
Exception : java.lang.RuntimeException: java.lang.ExceptionInInitializerError
Judging from the stack trace, it looks as if you are calling javax.imageio.ImageIO.read(File). In Eclipse, it likely works because it is accessing the local filesystem to read the image. Try using Class.getResourceAsStream() to read the file off the classpath (i.e. from the jar) and then pass the InputStream to javax.imageio.ImageIO.read(InputStream).

Categories

Resources