Evasive cause inside InvocationTargetException - java

Executing a Java code I capture an InvocationTargetException. Using the printStackTrace method I get the following:
java.lang.reflect.InvocationTargetException
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 Tester.main(Tester.java:180)
Caused by: java.lang.NullPointerException
at [...] (it doesn't really matters)
My code checks several programs written by other persons, so the cause shown by printStackTrace is varied. However, if I try to get just the internal cause using method getCause, the result is always a disgusting null!
Java 6 API says that, from release 1.4 in advance, getCause returns the cause exception provided during construction... should I assume that Method.invoke does not construct the exception properly, or am I losing something?
Thanks in advance

Related

Getting StackOverFlow Error in Kettle(PDI)

everyone,when i use kettle to do loop,the error occured,the kettle's memory is 8G ,I used hundreds of cycles,Kettle to cycle 1500 times, when the cycle time to about 700 times the error occourd.how can i solve it
ERROR (version 5.0.1-stable, build 1 from 2013-11-15_16-08-58 by buildguy) : java.lang.StackOverflowError
at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:242)
at java.io.File.exists(File.java:772)
at sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:1057)
at sun.misc.URLClassPath$FileLoader.findResource(URLClassPath.java:1024)
at sun.misc.URLClassPath.findResource(URLClassPath.java:172)
at java.net.URLClassLoader$2.run(URLClassLoader.java:551)
at java.net.URLClassLoader$2.run(URLClassLoader.java:549)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findResource(URLClassLoader.java:548)
at java.lang.ClassLoader.getResource(ClassLoader.java:1138)
at java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:227)
at org.apache.xerces.parsers.SecuritySupport$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.xerces.parsers.SecuritySupport.getResourceAsStream(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.findJarServiceProvider(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)
at org.pentaho.di.core.xml.XMLHandler.loadXMLFile(XMLHandler.java:553)
at org.pentaho.di.core.xml.XMLHandler.loadXMLFile(XMLHandler.java:515)
at org.pentaho.di.core.xml.XMLHandler.loadXMLFile(XMLHandler.java:501)
at org.pentaho.di.trans.TransMeta.<init>(TransMeta.java:2797)
at org.pentaho.di.trans.TransMeta.<init>(TransMeta.java:2774)
at org.pentaho.di.trans.TransMeta.<init>(TransMeta.java:2759)
at org.pentaho.di.job.entries.trans.JobEntryTrans.getTransMeta(JobEntryTrans.java:1166)
at org.pentaho.di.job.entries.trans.JobEntryTrans.execute(JobEntryTrans.java:634)
at org.pentaho.di.job.Job.execute(Job.java:678)
at org.pentaho.di.job.Job.execute(Job.java:815)
at org.pentaho.di.job.Job.execute(Job.java:815)
at org.pentaho.di.job.Job.execute(Job.java:815)
I'm no expert in Kettle. However, a StackOverflowError is NOT caused by running out of memory, so the fact that you have an 8Gb heap is not directly relevant. What is relevant is the size of the thread stack. That is controlled by the java command's -Xss command-line option.
I also don't know what you mean by "cycles" in the context of Kettle ... and Google isn't helping me. However, I guess it is something to do with Jobs that cause other Jobs to run. And since you hit the limit at ~700 and need to get to ~1500, you probably need to triple the current thread stack size ... whatever that may be.

com.google.gdata.util.PreconditionFailedException on ListEntry.update() in Google Docs Java API

I have an application which manipulates the rows of a google spreadsheet. Occasionally, when I call ListEntry.update(), I receive the following stack trace:
Exception in thread "main" java.lang.reflect.InvocationTargetException
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 org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: com.google.gdata.util.PreconditionFailedException: Precondition Failed
Mismatch: etags = ["E10QemAgYit7ImA-CEFaShYM"], version = [2ag9hk74om621l]
at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:614)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
at com.google.gdata.client.Service.update(Service.java:1563)
at com.google.gdata.client.Service.update(Service.java:1530)
at com.google.gdata.client.GoogleService.update(GoogleService.java:597)
at com.google.gdata.data.BaseEntry.update(BaseEntry.java:639)
at feedProcessor.ProcessClientFeed.UpdateRow(ProcessClientFeed.java:466)
at feedProcessor.ProcessClientFeed.updateGoogleSpreadsheet(ProcessClientFeed.java:404)
at feedProcessor.ProcessClientFeed.processFeed(ProcessClientFeed.java:318)
at feedProcessor.ProcessClientFeed.main(ProcessClientFeed.java:61)
... 5 more
Here is the relevant documentation:
https://developers.google.com/gdata/javadoc/com/google/gdata/data/spreadsheet/ListEntry
https://developers.google.com/gdata/javadoc/com/google/gdata/data/BaseEntry#update()
According to these docs, the update() function is not even capable of throwing a PreconditionFailedException, so the docs are essentially useless here. Testing the issue has shown that this exception is thrown when you try to call the update() function on the same row more than once in a session. Exactly what defines a 'session' is still unclear, but if you loop through all your rows more than once, and call update() on each row in each iteration, you will get this error. The only resolution I am aware of is to write your software such that each row (ListEntry) has update() called only once.
The problem is caused by Google Spreadsheet API Resource Versioning mecanism.
To be able to edit the entry no matter what - just use:
entry.setEtag("*")
before update.
And yes, this is not multi-user friendly. Refetch the feed if you need multi-user support.

How can I get past this exception involving jvisualvm with oc4j?

Every time I try to start the CPU profiler I get the following exception. I have found reference to this exception in conjunction with Asian languages, but that is not the case here.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:348)
Caused by: java.lang.NullPointerException
at org.netbeans.lib.profiler.server.ProfilerActivate15.getArchiveFile(ProfilerActivate15.java:78)
at org.netbeans.lib.profiler.server.ProfilerActivate15.activate(ProfilerActivate15.java:99)
at org.netbeans.lib.profiler.server.ProfilerActivate15.agentmain(ProfilerActivate15.java:64)
... 6 more
I gave up and used the following instead
http://www.jvmmonitor.org/index.html

Skype error? Or Eclipse error?

I tried making a simple project for my skype-bot, and it looks like this:
import com.skype.Skype;
import com.skype.SkypeException;
public class SkypeDemo {
public static void main(String[] args) throws SkypeException {
System.out.println(Skype.getVersion());
}
}
But when i started it i get this error:
Exception in thread "main" com.skype.SkypeException: Loading libskype.jnilib failed.
at com.skype.Utils.convertToSkypeException(Unknown Source)
at com.skype.Utils.getProperty(Unknown Source)
at com.skype.Skype.getVersion(Unknown Source)
at SkypeDemo.main(SkypeDemo.java:6)
Caused by: com.skype.connector.LoadLibraryException: Loading libskype.jnilib failed.
at com.skype.connector.ConnectorUtils.loadLibrary(Unknown Source)
at com.skype.connector.osx.SkypeFramework.init(Unknown Source)
at com.skype.connector.osx.OSXConnector.initializeImpl(Unknown Source)
at com.skype.connector.Connector.initialize(Unknown Source)
at com.skype.connector.Connector.connect(Unknown Source)
at com.skype.connector.Connector.assureAttached(Unknown Source)
at com.skype.connector.Connector.execute(Unknown Source)
at com.skype.connector.Connector.execute(Unknown Source)
at com.skype.connector.Connector.execute(Unknown Source)
at com.skype.connector.Connector.execute(Unknown Source)
... 3 more
So how do I fix this error? Keep in mind I have both Skype jars in the build path.
The error is telling you that it cannot load a native library ("libskype.jnilib"). This is (probably) neither Eclipse or Skype's fault.
It is most likely your fault because either the native library is not where it needs to be (or you haven't told Eclipse where to look), or because you have the wrong flavour of native code (DLL, .so or whatever)
(If there was another chained "cause" in the stack trace, it might tell you more ...)
Reference:
This blog post explains how to add a native library to an Eclipse project - http://www.eclipsezone.com/eclipse/forums/t49342.html (In fact, it describes two ways ...)

Java: InvocationTargetException caused by MissingResourceException, but its there

When I run a method on my application, I get the following exception, but the class that is miss 'JarSignerResources' is in my classpath (part of tools.jar). I have never seen an exception like this before, and it only occurs on Linux (not OSX). Can anyone give me a bit of insight into why this would be happening? Thanks.
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.ExceptionInInitializerError
at com.wuntee.aat.smali.SmaliWorkshop.signJar(SmaliWorkshop.java:214)
at com.wuntee.aat.smali.SmaliController.rebuildAndSignApk(SmaliController.java:223)
at com.wuntee.aat.view.Gui$13.widgetSelected(Gui.java:354)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at com.wuntee.aat.view.Gui.open(Gui.java:135)
at com.wuntee.aat.view.Gui$1.run(Gui.java:112)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at com.wuntee.aat.view.Gui.main(Gui.java:108)
... 5 more
Caused by: java.util.MissingResourceException: Can't find bundle for base name sun.security.tools.JarSignerResources, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1427)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1250)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:705)
at com.wuntee.aat.security.tools.JarSigner.<clinit>(JarSigner.java:96)
... 17 more
This happens at this point in the code:
public static void signJar(String keystore, String keystorePassword, String jarFile, String alias) throws Exception{
JarSigner js = new JarSigner();
js.signJar(keystore, keystorePassword, jarFile, alias);
}
The sun.* packages are not part of the supported, public interface. It is likely you are not using a sun jdk on linux.
A Java program that directly calls into sun.* packages is not guaranteed to work on all Java-compatible platforms. In fact, such a program is not guaranteed to work even in future versions on the same platform.
see here for details

Categories

Resources