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
Related
My program may use a library when it is present at runtime, but it is not required to have this library to run the program. However, when I run my program (without the library being present), it complains that it is not present for a very specific import:
java.lang.NoClassDefFoundError: nl/lolmewn/stats/api/storage/StorageException
at me.staartvin.plugins.pluginlibrary.Library.<clinit>(Library.java:34) ~[?:?]
at me.staartvin.plugins.pluginlibrary.PluginLibrary.loadLibraries(PluginLibrary.java:105) ~[?:?]
at me.staartvin.plugins.pluginlibrary.PluginLibrary.onEnable(PluginLibrary.java:68) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-latest.jar:git-Spigot-eadd615-4509a14]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:337) [spigot-latest.jar:git-Spigot-eadd615-4
9a14]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:403) [spigot-latest.jar:git-Spigot-eadd615-
09a14]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:381) [spigot-latest.jar:git-Spigot-eadd615-45
a14]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:330) [spigot-latest.jar:git-Spigot-eadd615-4
9a14]
at net.minecraft.server.v1_12_R1.MinecraftServer.t(MinecraftServer.java:422) [spigot-latest.jar:git-Spigot-eadd615-4509a14
at net.minecraft.server.v1_12_R1.MinecraftServer.l(MinecraftServer.java:383) [spigot-latest.jar:git-Spigot-eadd615-4509a14
at net.minecraft.server.v1_12_R1.MinecraftServer.a(MinecraftServer.java:338) [spigot-latest.jar:git-Spigot-eadd615-4509a14
at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:272) [spigot-latest.jar:git-Spigot-eadd615-4509
4]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:545) [spigot-latest.jar:git-Spigot-eadd615-4509a
]
at java.lang.Thread.run(Uenter code herenknown Source) [?:1.8.0_161]
Caused by: java.lang.ClassNotFoundException: nl.lolmewn.stats.api.storage.StorageException
at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_161]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:152) ~[spigot-latest.jar:git-Spigot-eadd615-4
9a14]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:100) ~[spigot-latest.jar:git-Spigot-eadd615-4
9a14]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_161]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_161]
... 14 more
The code that uses this StorageException class is this:
try {
user = stats.getUserManager().loadUser(player.getUniqueId(), stats.getStatManager());
} catch (StorageException e) {
e.printStackTrace();
}
Note that I have many imports using this library. The odd thing is that when I leave out the StorageException import (e.g. change it to a general Exception), it does not give any error anymore, even though there are other imports (from the exact same library) present!
Obviously, I want to use the StorageException class for catching errors, but I can't seem to do this.
How can I solve this issue?
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
I am creating java classes from xsd using jaxb, but when i try to send xml over http i get a run time error
java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed data found for annotation element public abstract javax.xml.bind.annotation.AccessType javax.xml.bind.annotation.XmlAccessorType.value() (Found data of type Ljavax/xml/bind/annotation/XmlAccessType;.FIELD)
sun.reflect.annotation.AnnotationTypeMismatchExceptionProxy.generateException(AnnotationTypeMismatchExceptionProxy.java:38)
sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:56)
$Proxy6.value(Unknown Source)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
com.sun.xml.bind.v2.model.annotation.LocatableAnnotation.invoke(LocatableAnnotation.java:60)
$Proxy8.value(Unknown Source)
com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getAccessType(ClassInfoImpl.java:339)
com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:228)
com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.getProperties(RuntimeClassInfoImpl.java:87)
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:127)
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:49)
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:41)
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
com.sun.xml.bind.v2.model.impl.RegistryInfoImpl.<init>(RegistryInfoImpl.java:51)
com.sun.xml.bind.v2.model.impl.ModelBuilder.addRegistry(ModelBuilder.java:232)
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:201)
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:327)
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:198)
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:124)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:132)
javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:358)
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:323)
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:244)
com.arcot.jaxb.KECHPSWI.KECHPSWI.marshal(KECHPSWI.java:117)
com.arcot.jaxb.servlet.ClientMachine.doPost(ClientMachine.java:39)
com.arcot.jaxb.servlet.ClientMachine.doGet(ClientMachine.java:84)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
my development environment is Tomcat 6.0, jdk 1.6 on windows 7, can someone please help me resolve this problem?
Looks like you have two different version of class javax.xml.bind.annotation.AccessType.
May be you have duplicate jax-api.jar in your classpath.
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 ...)
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