classloader

Configure JBOss cache to run on JBoss server 4.2.3.GA

五迷三道 提交于 2020-01-11 10:08:11
问题 Our commercial application used to run on different application server and letely we started adjust it to run on JBoss server. The problem is that that application runs JBoss cache and as part of the integration with this framework, the web-inf\lib contains the follwing jars: jboss-aop.jar, jbosscache-core.jar, jboss-common.jar, jboss-common-core.jar, jboss-j2ee.jar, jboss-jmx.jar, jboss-logging-spi.jar This causes a problem to use JNDI through the application because the jboss-common-core

Quick fix for Class.forName case issue [duplicate]

情到浓时终转凉″ 提交于 2020-01-11 07:40:13
问题 This question already has answers here : Java Class.forName() from distant directory (3 answers) Closed 6 years ago . I get this really (stupid) error from Java Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: models/modelclass (wrong name: models/ModelClass) So I am typing in a command at the command line, and I would rather not type the proper case of the class name. I'd like to type "modelclass" instead of "ModelClass". Is there a way to solve this? Why does this

How to get a resource in another jar

末鹿安然 提交于 2020-01-11 06:15:13
问题 I have a jar embedded in a bundle that needs to fetch a resource packaged with it like so: MyBundle -\ src -\lib -\MyEmbeddedJar -\src -\SomeClass -\someResource.xml I am trying to access 'someResource.xml' from 'SomeClass' like so: SomeClass.class.getResource( "someResource.xml" ); But I've had no luck. I've tried several variations with the CWD appended (eg: './someResource.xml') but I just can't get this resource to load. I know that the "right" way is to use Activator to get hooks back to

Java 7u55 Eclipse System Fragment Classloader

半城伤御伤魂 提交于 2020-01-11 03:32:10
问题 In previous versions of Java I was able to use a fragment that had a host of system-bundle in order to provide classes to the boot classloader. In my particular case this was to support using Jacorb in Eclipse. This all worked fine prior to Java 7u55. I created an osgi fragment that contained all the jars for Jacorb. The manifest looks like this: Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: org.jacorb.systemFragment Bundle-SymbolicName: org.jacorb.systemFragment Bundle-Version

cast across classloader?

走远了吗. 提交于 2020-01-08 17:14:26
问题 How can I do this: class Foo { public static Foo get() throws Exception { ClassLoader cl = new URLClassLoader(new URL[]{"foo.jar"}, null); // Foo.class is in foo.jar return (Foo)cl.loadClass("Foo").newInstance(); // fails on class cast } } What I need is for the JVM to consider the Foo instance from cl as if it is an instance of Foo from the classloader of the executing code. I have seen these approaches, none of them good for me (the above example is a toy example): Load the class (or a

Why are classLoader magic values in defineClass() throwing an exception?

梦想的初衷 提交于 2020-01-07 09:28:05
问题 I want to write a classLoader that can help me implement customized classes and ultimately a whole component at run time. Right now I'm in process of loading the class. I'm trying to load this role.java file. However when I get to this part of the code: myClass = super.defineClass(className, classData, 0, classData.length); I get this exception: Exception in thread "main" java.lang.ClassFormatError: Incompatible magic value 1885430635 in class file C:\Users\ARIFAH\Downloads\Compressed\eUML2

Simple way to use a jar as a resource archive

与世无争的帅哥 提交于 2020-01-07 03:10:23
问题 So, I'm working on a Java application and I'd like to package resources into jar files to make them more portable. These jar files would be separate from the application and would only contain assets (images, sounds, save files, etc). What's the simplest way to access arbitrary resources from inside a jar file like this? I've looked around a bit, but haven't been able to find any simple tutorials. I know that I can retrieve input streams from a Jar file with a ClassLoader but how do I get a

printStackTrace() in a finished product. When and why?

只谈情不闲聊 提交于 2020-01-06 19:41:34
问题 I've come to the conclusion after reading from many sources that using printStackTrace for error handling is bad practice. Here's one. Now I'm struck curious: in what cases is printing the stacktrace a valid solution? For the sake of the argument, let's assume we aren't working on a system such as a microwave or a banana, but a basic out-of-the-shelf PC. The reason I'm asking this could be seen as a question in itself, but I'll tell you about it anyhoo: I'm developing a snake-like game that

JSP compilation error with custom classloader

三世轮回 提交于 2020-01-06 07:24:10
问题 I have a custom WebappClassLoader in tomcat (7.0.55) which is configured in the server.xml as <Context allowCasualMultipartParsing="true"> <Loader loaderClass="org.project.system.core.classloader.DynamicClassLoader" /> </Context> It's is loaded and everything is fine, but when I open a JSP which loads a class org.test.User which isn't under WEB-INF/classes, but loadable via my DynamicClassLoader I get this error: org.apache.jasper.JasperException: Unable to compile class for JSP: An error

Apache POI 4.0.1 super slow getting started … 15 minutes or more. What is wrong?

别来无恙 提交于 2020-01-06 05:33:07
问题 It takes 15 minutes or more for POI to initialize its first workbook in Java 8 on Windows 10, in a Tomcat 8 instance. Based on interrupting the process in the debugger and looking at the stack, it is spending the time in the classloader, driven by xbeans. Edit This has the feel of a classloader issue because when I implemented the workaround for the POI library (below), other classes started expressing the same issue. Edit The stack trace looks most similar to this bug: https://bugs.java.com