classloader

tools.jar missing - but only on the very first call (Tomcat 8/Java 8/ Axis)

[亡魂溺海] 提交于 2020-01-06 02:26:29
问题 Now that I upgraded my webapp to Java 8, I'm running into strange classloading problem with an axis webservice that is running in Tomcat 8. The very first call to the webservice after installing the webapp will cause a RuntimeException and a "No compiler found in your classpath! (you may need to add 'tools.jar')" fault. All following calls to that webservice work correctly (apparently tools.jar is there after all?). The behaviour is reproducable by deleting the exploded webapp folder in the

Load class within Jar file and get it's path

◇◆丶佛笑我妖孽 提交于 2020-01-06 01:47:30
问题 I know there are already a lot similar questions here, but I couldn't get any smarter form them. I want to load a class inside a jar file, at this point this is no problem, but when I want to pass the path to my own ClassLoader it throws an exception it cannot find the class. Is it possible to load a class inside a jar using an absolute path? For instance, Class cls = loader.loadClass(/path/MyPlugin.jar/MyPlugin.class); But when I do this: File test = new File("path/plugins/MyPlugin.jar

websphere classloader gives java.lang.LinkageError when loading slf4j LoggerFactory

南笙酒味 提交于 2020-01-05 08:55:13
问题 [I originally posted this on the websphere forums bot didn't see a timely response. I'm re-posting here with slightly more content] The Problem I added a jar (call it "Foo.jar") to our enterprise application (i.e. ".ear"), created the manifest entry, etc., and found, to my surprise, that when my EJB instantiated FooClient, websphere threw a java.lang.LinkageError upon org.slf4j.LoggerFactory I've added classloader debugging to the trace and did not find much. I was hoping to see "where WAS

Classes Loaded by GroovyClassLoader not listed

試著忘記壹切 提交于 2020-01-05 05:43:06
问题 I am investigating memory leak in some JVM bsaed code (groovy running in a Java env). I have a simple Java test class that I am using to investigate various behaviours around Groovy class loading, and I am running the following code (from plain Java): GroovyClassLoader localGroovyClassLoader = new GroovyClassLoader(); Class clazz = localGroovyClassLoader.loadClass("com.test.Example", true, false, true); Where Example is just a simple Groovy class (doesn't do anything particular as its just my

JBoss [ClassLoaderManager] IncompatibleClassChangeError?

心不动则不痛 提交于 2020-01-04 11:03:40
问题 Experiencing the following stacktrace in JBoss-6.0.0.Final after having potentially "resolved" some other lib conflicts by way of jboss-classloading.xml. What's the conflict now? JBoss is impossibly difficult compared to tomcat so far. :( I'm realizing that JBoss comes with a ton of prepackaged service support and am sure it'd be easier to just use their packaged libs. But, my code relies on more modern releases of, for example Hibernate, than what is packaged w/ JB6 final. How do people

How to use Custom ClassLoader to new Object in Java

我的未来我决定 提交于 2020-01-04 09:07:12
问题 I want to create a custom ClassLoader to load all jar files in some path(e.g. /home/custom/lib). then I expect that every time I use new operator to create a Object, it will search class in all jar files in that path, then search the class path defined by parameter ( -cp ). Is it possible? for Example, there is a jar file in /home/custom/lib/a.jar in Main Class public class Main { public static void main(String[] args) { // do something here to use custom ClassLoader // here will search Car

ClassNotFoundException during Deserialization of a just-serializaed class

这一生的挚爱 提交于 2020-01-04 09:06:28
问题 I was having an issue with deserializing an object. The current project has a plugin-style architecture, so I have jars that contain class files that are loaded at runtime. I was unable to deserialize an object that contained a class that was found in one of those jars, so I wrote a quick test method that gets called mid-stream that just loaded the plugins, instantiates the correct one (the object implements a particular interface so I can identify it via .isAssignableFrom(..) ), serializes

Is it possible to load a class without loading referenced classes/imports?

回眸只為那壹抹淺笑 提交于 2020-01-04 04:23:06
问题 (Yes, this is hacky and probably not best practice, but it is the least bulky solution) I have a project that involves several jars - a runnable launcher, a server, a wrapper for the server, and plugins for the server. The launcher runs the wrapper by starting a new unconnected process, a child process, or just by instantiating it, depending on config. This should be unimportant with regards to the issue. The wrapper uses URLClassLoader to load the server jar and start it, which works fine.

What does “__JVM_DefineClass__” as a classloader location mean?

送分小仙女□ 提交于 2020-01-03 18:02:48
问题 I am debugging the reason as to why eclipse cannot load the source code when remote debugging dynamically compiled and loaded classes. I am seeing with the -verbose:class argument that my dynamically compiled class files are coming from __JVM_DefineClass__ . I assume this to mean that they come from the JVM heapspace itself, as I have the compiler output the compiled bytes into a "FileManager" that caches the compiled bytes in memory. It seems that the only way for the source to be view-able

Can't get annotations from classes loaded by custom classloader in tomcat

 ̄綄美尐妖づ 提交于 2020-01-03 17:25:08
问题 Given the class org.popper.example.pages.Login @Page(name="Login") public interface Login { } exported to c:\pos\example.jar and the following servlet public class PopperServlet extends HttpServlet { private static final long serialVersionUID = 1L; public static void main(String[] args) throws MalformedURLException, ClassNotFoundException { URLClassLoader ucl = new URLClassLoader(new URL[] {new File("c:/pos/example.jar").toURI().toURL()}); System.out.println(Arrays.asList(ucl.loadClass("org