classloader

Is there a Tomcat-like classloader that can be used standalone?

萝らか妹 提交于 2019-12-06 11:28:40
I'm working with a Java sort-of-application-server (Smartfox) which can run multiple applications ("extensions") but has a very inconvenient classpath setup to go along with it, along with issues when trying to use SLF4J. To work around that I'd like to wrap my applications in their own classloaders. Such a containing classloader should be much like Tomcat's, in that it Can load classes from a directory containing JARs. Prefers classes from its own classpath over those from the parent Is there a library somewhere that has such a classloader I can just "drag and drop" in my project? If not,

deployment.xml for WebSphere and Maven

瘦欲@ 提交于 2019-12-06 11:12:44
问题 I've converted an application to be built and deployed with Maven instead of RAD's built-in tools. It's mostly gone well, but the last "gotcha" is that the application needs a class loader policy of "parent last/application". I'd like to automate this because currently, when I use the WAS plugin for Maven, it seems to uninstall and reinstall the application completely, and so I have to go through the admin console every time the code changes and the application is redeployed. If I could have

Access project classes from a maven plugin

不羁的心 提交于 2019-12-06 11:05:54
问题 I'm making a maven plugin that run in test phase, in pom.xml configuration of a project that uses my plugin, I'm setting a class canonical name that I want to use to run that class from my plugin, basically I'm making a way to have a dynamic class loading of classes inside the project from my plugin. Class clazz = Class.forName("... class from pom.xml ...") When I run it I receive the expectable "ClassNotFoundException", seems the class loader are not the same or not shared. There is a way to

MyClass.class.getClassLoader().getResource(“”).getPath() throws NullPointerException

不羁的心 提交于 2019-12-06 10:43:05
I have code that is running correctly on a development machine but throws a NullPointerException when installed in a production environment. The line that throws the exception is the following: MyClass.class.getClassLoader().getResource("").getPath(); So I split this into multiple lines of code to see exactly which call was returning null, like this: ClassLoader cl = MyClass.class.getClassLoader(); URL url = cl.getResource(""); String path = url.getPath(); Now the url.getPath() call is throwing the NullPointerException, meaning that cl.getResource("") is returning null. Can anyone tell me how

Class Loading in JVM

橙三吉。 提交于 2019-12-06 10:38:44
When does the class get loaded in the JVM? Do they get loaded on the server start up or when there is a reference for the class? My assumption is that all the class gets loaded as the server like jboss starts up but then there is something called lazyloading. Also what is actually meant by loading? Does it mean there is this .class in the JVM memory along with all the methods, variables including instance, static variables methods and are available for execution. I Know that ClassLoader locates the bytecodes for a Java class that needs to be loaded, reads the bytecodes, checks the refrencces

Parent Last Classloader to solve Java Class path hell?

佐手、 提交于 2019-12-06 10:31:33
问题 I have a project which uses two versions of bouncyCastle jars bcprov-jdk15 and bcprov-jdk16. The jvm loads the older version but there is a feature I wrote which needs the newer version to run. I tried to solve this classpath hell by using a custom class loader. After some googling and with the help of some previous Stackoverflow answers[1] [2] and this blog, I wrote the following Parent Last Class loader to load the classes from the newer jar before delegating to the parent class loader.

Why doesn't the JVM load classes from a database?

我与影子孤独终老i 提交于 2019-12-06 09:35:42
问题 Why doesn't the Java virtual machine load classes from a database (similar to the GAC of .NET)? As I understand it, currently it has to read and scan the manifests of each JAR on the class path in order to locate class files. Wouldn't using a database (like SQLite) boost startup time? 回答1: Depending on how you define "database" both IBM (shared classes) and Oracle (shared data) already do have technologies to speed up startup and decrease memory footprint. Class load time is actually very

Can't instantiate class from installed extension when run via OSGI

佐手、 提交于 2019-12-06 09:30:08
So, I have an installed extension (see http://docs.oracle.com/javase/tutorial/ext/basics/index.html ) which I can see in Eclipse. I've written a simple rcp application that tries to create an instance of a class in this extension. However, although everything compiles ok, I'm getting a NoClassDefFoundError when creating the instance. I'm assuming this has something to do with OSGi because I can run a simple java application that creates the instance fine. Any suggestions would be really appreciated. Thanks I've found another solution which is to set the parent classloader to the 'ext'

How to preload classes in Java?

爷,独闯天下 提交于 2019-12-06 08:35:22
The first opening of a new JInternalFrame in my Swing interface takes some time. According to the profiler, most of this time is spent in the Classloader.loadClass() method. I understand that it loads classes dynamically when needed and indeed the next time I open the same frame, it is much faster. This application has a login screen, and then a time with an empty desktoppane before the user opens one of those internal frames. I figure that since I have some "down time", I could use it to preload some common classes in background, so that when the user actually opens an internal frame, it goes

EAR and WAR class loader

老子叫甜甜 提交于 2019-12-06 07:30:18
I'm very confused about the JBoss class loader. Can any one describe in details how the class loader works, exactly? I only have to do one thing... If a WAR doesn't find a class with its own classloader, he delegates the search to its parent classloader which must be the EAR's. What changes should I have to do in my application for the above? Please reply as soon as possible. Thank you. In continuation of our discussion in the comments, I noticed the following JBoss feature request. https://issues.jboss.org/browse/JBAS-4037 It looks like JBoss 4 is not fully Java EE5 compatible, however later