launching java test bycommand line - java

I created runner.bat to launch one java test
it contains : path to java,classpath org.junit.runner.JUnitCore package.class
when I launch it :
FAILURES Tests run: 1, Failures: 1
Exception in thread "Thread-0" java.lang.IllegalStateException: Shutdown in progress
at java.lang.ApplicationShutdownHooks.add(Unknown Source)
at java.lang.Runtime.addShutdownHook(Unknown Source)
at com.sun.imageio.stream.StreamCloser$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.imageio.stream.StreamCloser.addToQueue(Unknown Source)
at javax.imageio.stream.FileCacheImageInputStream.<init>(Unknown Source)
at com.sun.imageio.spi.InputStreamImageInputStreamSpi.createInputStreamInstance(Unknown Source)
at javax.imageio.ImageIO.createImageInputStream(Unknown Source)
at javax.imageio.ImageIO.read(Unknown Source)
at com.polyspace.util.guicomponent.CompositePanel.setBufferedImage(Unknown Source)
at com.polyspace.util.guicomponent.CompositePanel.<init>(Unknown Source)

Runtime.addShutdownHooks() will throw an IllegalStateException if the JVM is already shutting down when the method is called.
Could something be causing your test to end before the construction of your CompositePanel has completed? (e.g. something running in a separate thread.)

Related

In D2RQ, I run d2r-server.bat kg_movie.ttl,but got an error: "Exception in thread "main" java.lang.ExceptionInInitializerError"

I want to use D2RQ to start a service,so I run d2r-server.bat kg_movie.ttl, but got the following error:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.ibm.icu.impl.UPropertyAliases.<clinit>(UPropertyAliases.java:87)
at com.ibm.icu.lang.UCharacter.<clinit>(UCharacter.java:5680)
at com.hp.hpl.jena.rdf.arp.impl.CharacterModel.isComposingChar(CharacterModel.java:147)
at com.hp.hpl.jena.rdf.arp.impl.ParserSupport.checkComposingChar(ParserSupport.java:128)
at com.hp.hpl.jena.rdf.arp.states.AbsWantLiteralValueOrDescription.characters(AbsWantLiteralValueOrDescription.java:59)
at com.hp.hpl.jena.rdf.arp.states.WantTypedLiteral.characters(WantTypedLiteral.java:28)
at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.characters(XMLHandler.java:149)
at org.apache.xerces.parsers.AbstractSAXParser.characters(Unknown Source)
at org.apache.xerces.impl.XMLNamespaceBinder.characters(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.characters(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanContent(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.parse(RDFXMLParser.java:155)
at com.hp.hpl.jena.rdf.arp.JenaReader.read(JenaReader.java:173)
at com.hp.hpl.jena.rdf.arp.JenaReader.read(JenaReader.java:160)
at com.hp.hpl.jena.rdf.arp.JenaReader.read(JenaReader.java:232)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.read(ModelCom.java:268)
at com.hp.hpl.jena.ontology.OntDocumentManager.findMetadata(OntDocumentManager.java:894)
at com.hp.hpl.jena.ontology.OntDocumentManager.initialiseMetadata(OntDocumentManager.java:852)
at com.hp.hpl.jena.ontology.OntDocumentManager.<init>(OntDocumentManager.java:200)
at com.hp.hpl.jena.ontology.OntDocumentManager.<init>(OntDocumentManager.java:182)
at com.hp.hpl.jena.ontology.OntDocumentManager.<init>(OntDocumentManager.java:166)
at com.hp.hpl.jena.ontology.OntDocumentManager.getInstance(OntDocumentManager.java:244)
at com.hp.hpl.jena.ontology.OntModelSpec.getDocumentManager(OntModelSpec.java:339)
at com.hp.hpl.jena.ontology.impl.OntModelImpl.getDocumentManager(OntModelImpl.java:181)
at com.hp.hpl.jena.ontology.impl.OntModelImpl.loadImports(OntModelImpl.java:1973)
at com.hp.hpl.jena.ontology.impl.OntModelImpl.<init>(OntModelImpl.java:147)
at com.hp.hpl.jena.ontology.impl.OntModelImpl.<init>(OntModelImpl.java:119)
at com.hp.hpl.jena.rdf.model.ModelFactory.createOntologyModel(ModelFactory.java:359)
at de.fuberlin.wiwiss.d2rq.parser.MapParser.<init>(MapParser.java:85)
at de.fuberlin.wiwiss.d2rq.SystemLoader.getMapping(SystemLoader.java:300)
at de.fuberlin.wiwiss.d2rq.SystemLoader.getModelD2RQ(SystemLoader.java:323)
at d2rq.server.run(server.java:65)
at de.fuberlin.wiwiss.d2rq.CommandLineTool.process(CommandLineTool.java:158)
at d2rq.server.main(server.java:17)
Caused by: java.lang.IllegalArgumentException: Invalid version number: Version number may be negative or greater than 255
at com.ibm.icu.util.VersionInfo.getInstance(VersionInfo.java:188)
at com.ibm.icu.impl.ICUDebug.getInstanceLenient(ICUDebug.java:65)
at com.ibm.icu.impl.ICUDebug.<clinit>(ICUDebug.java:69)
... 40 more
The file "kg_movie.ttl" does not have any problems, so I don't know why? any answer will be appreciated
https://github.com/d2rq/d2rq/issues/322 ,a possible reason,java version.and, we are working on similar projects

Exception in "JavaFX Application Thread" when using JavaFX control

I am initializing a generic JavaFX 8 ComboBox with Enum values as follows:
ObservableList<MyEnumClass> myValues = FXCollections
.observableArrayList(MyEnumClass.FIRST_ENUM,
MyEnumClass.SECOND_ENUM, MyEnumClass.THIRD_ENUM);
myEnumComboBox = new ComboBox<MyEnumClass>(myValues);
A test application shows the ComboBox with the Enum values as expected and selecting other values also works fine. But one thing puzzels me: Even though I can not observe any apparent malfunction, my Eclipse console nevertheless notifies me about an exception in thread "JavaFX Application Thread" whenever I select a new value from the ComboBox's menu. The exception seems to be related to the native JavaFX code that hides the ComboBox's popup control:
Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: null source
at java.util.EventObject.<init>(Unknown Source)
at java.awt.AWTEvent.<init>(Unknown Source)
at sun.awt.UngrabEvent.<init>(Unknown Source)
at javafx.embed.swing.SwingNode$10.handle(Unknown Source)
[9 lines omitted]
at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at javafx.event.Event.fireEvent(Unknown Source)
at com.sun.javafx.stage.WindowPeerListener.focusUngrab(Unknown Source)
[4 lines omitted]
at com.sun.glass.ui.Window.handleWindowEvent(Unknown Source)
at com.sun.glass.ui.Window.notifyFocusUngrab(Unknown Source)
at com.sun.glass.ui.win.WinWindow._ungrabFocus(Native Method)
at com.sun.glass.ui.Window.ungrabFocus(Unknown Source)
at com.sun.javafx.tk.quantum.WindowStage.ungrabFocus(Unknown Source)
at javafx.stage.Window.decreaseFocusGrabCounter(Unknown Source)
at javafx.stage.PopupWindow.handleAutohideActivation(Unknown Source)
at javafx.stage.PopupWindow.impl_visibleChanged(Unknown Source)
at javafx.stage.Window$9.invalidated(Unknown Source)
at javafx.beans.property.BooleanPropertyBase.markInvalid(Unknown Source)
at javafx.beans.property.BooleanPropertyBase.set(Unknown Source)
at javafx.stage.Window.setShowing(Unknown Source)
at javafx.stage.Window.hide(Unknown Source)
at javafx.stage.PopupWindow.hide(Unknown Source)
at com.sun.javafx.scene.control.skin.ComboBoxPopupControl.hide(Unknown Source)
[44 lines omitted]
at java.lang.Thread.run(Unknown Source)
Can somebody explain what exactly is happening here and what I can or should do about it?
EDIT - The exception was caused by a leftover SwingNode from some earlier experiment on the same Pane as the ComboBox. Deleting the SwingNode made the exception vanish.

Java Game - ClassCastException

I am developing a simple java game and my scrollbar is raising an exception.
The scrollbar is supposed to be a "gameslider".
Exception in thread "Thread-3" java.lang.ClassCastException: sun.java2d.NullSurfaceData cannot be cast to sun.java2d.d3d.D3DSurfaceData
at sun.java2d.d3d.D3DRenderer.copyArea(Unknown Source)
at sun.java2d.d3d.D3DSurfaceData.copyArea(Unknown Source)
at sun.java2d.SunGraphics2D.doCopyArea(Unknown Source)
at sun.java2d.SunGraphics2D.copyArea(Unknown Source)
at javax.swing.BufferStrategyPaintManager.copyArea(Unknown Source)
at javax.swing.RepaintManager.copyArea(Unknown Source)
at javax.swing.JViewport.blitDoubleBuffered(Unknown Source)
at javax.swing.JViewport.windowBlitPaint(Unknown Source)
at javax.swing.JViewport.setViewPosition(Unknown Source)
at javax.swing.plaf.basic.BasicScrollPaneUI$Handler.hsbStateChanged(Unknown Source)
at javax.swing.plaf.basic.BasicScrollPaneUI$Handler.stateChanged(Unknown Source)
at javax.swing.DefaultBoundedRangeModel.fireStateChanged(Unknown Source)
at javax.swing.DefaultBoundedRangeModel.setRangeProperties(Unknown Source)
at javax.swing.DefaultBoundedRangeModel.setValue(Unknown Source)
at javax.swing.JScrollBar.setValue(Unknown Source)
at GameEnvironment.GamePanel.gameUpdate(GamePanel.java:171)
at GameEnvironment.GamePanel.run(GamePanel.java:73)
at java.lang.Thread.run(Unknown Source)
Code Line is following:
if (reachedMiddle)
scrollPane.getHorizontalScrollBar().setValue(player.getX() - (widthHorizontalScrollBar / 2));
The exception will be raised more or less randomly. I didnt figured it out so far.
I would make sure this code is run on the GUI Event Thread. If you call the Swing components on other threads you can get strange, randonm errors.
Have a look at using SwingUtilities.invokeLater(Runnable) to perform the tasks where the Swing components are updated.

Handle Applet throwing java.lang.ExceptionInInitializerError preventing it from running

We are developing java applet and embedding it in our web pages. When the applet is loaded via HTML APPLET tags, the browser/JVM prompts the user to allow it to run. When we hit cancel, the java console indicates the following exception:
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 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.lang.RuntimePermission getenv.TEMP)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.System.getenv(Unknown Source)
at downLoadApp.<clinit>(downLoadApp.java:15)
... 21 more
Exception: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
Now, I realize it's most likely because the class java tried to load was prevented from loading, and therefore the exception is thrown, but how do we gracefully handle this situation in the browser? I'd like to detect that the applet was denied and post a reasonable response to the condition, but I'm unaware of how to catch this exception since it appears to have been thrown by the JVM in reaction to not getting the jar file to load rather than code written in it...
Ideas?
Thanks!
You can catch the access control exception by putting the call to System.getenv in downLoadApp.java line 15 in a try-catch statement. That is, instead of this:
static String tmp = System.getenv("TEMP");
you should have:
static String tmp;
static {
try {
tmp = System.getenv("TEMP");
} catch (java.security.AccessControlException ace) {
// tmp is not set, maybe use some default value?
}
}
Do you call System.getenv("TEMP") somewhere in the static context of the downLoadApp class? Most probably this is in the initializer of a static field, but it could be in a static code block.
This is the place where it fails (a java.security.AccessControlException is thrown). The rest of the stack trace are errors following from that. You need to catch this exception to detect that you don't have the appropriate permissions.
As you can't catch exceptions of static field initializers, you need to move the call to getenv into a method or a static code block.
I don't think that you can catch this exception as this is thrown by JVM while loading applet.

InvocationTargetException occured : null in Play framework

I'm using play framework for my application
In my application.conf i have given
jvm.memory=-Xmx512M -Xms512M -XX:-UseGCOverheadLimit
I have a function which will be executed for every Customer and for customers each microapp
This function will return records for that customer and for that microapp from DB.
if i run for all customer I'm getting InvocationTargetException for 16th customer.(For 15 customers it ran successfully).
The error is
12:38:30,153 ERROR ~
Execution exception
InvocationTargetException occured : null
play.exceptions.JavaExecutionException
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:230)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.reflect.InvocationTargetException
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:543)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:499)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:475)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:470)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:158)
... 1 more
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.lang.StringValue.from(Unknown Source)
at java.lang.String.<init>(Unknown Source)
at com.mysql.jdbc.SingleByteCharsetConverter.toString(SingleByteCharsetConverter.java:327)
at com.mysql.jdbc.ResultSetRow.getString(ResultSetRow.java:787)
at com.mysql.jdbc.BufferRow.getString(BufferRow.java:539)
at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5571)
at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5448)
at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5488)
at org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$2.doExtract(VarcharTypeDescriptor.java:61)
at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:249)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:229)
at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:330)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2283)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1527)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1455)
at org.hibernate.loader.Loader.getRow(Loader.java:1355)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:611)
at org.hibernate.loader.Loader.doQuery(Loader.java:829)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
I found there is something error with that customer . so i run for that customer alone. I'm getting
Exception in thread "Timer-0" java.lang.OutOfMemoryError: Java heap space
at java.util.jar.Manifest.read(Unknown Source)
at java.util.jar.Manifest.<init>(Unknown Source)
at java.util.jar.JarFile.getManifestFromReference(Unknown Source)
at java.util.jar.JarFile.getManifest(Unknown Source)
at sun.misc.URLClassPath$JarLoader$2.getManifest(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector.run(ThreadPoolAsynchronousRunner.java:633)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
Exception in thread "pool-2-thread-1" java.lang.OutOfMemoryError: Java heap space
For this microapp( Error occuring ) alone i have 421,251 records
What could be the source of error. Please help me.
Your problem is an OutOfMemory error. It happens later when you increase the ram for that reason.
You did not provide any code sample, but I assume you are trying to load into memory too much data from your clients with only one query. That comment about having 421k records kind of confirms this (unless I misunderstood).
Instead of doing a find() (or select, or the cal you are doing) to retrieve all the records, try to retrieve records in batches (100, 200) and process them that way.

Categories

Resources