classloader

How to get a bundle-object returned by a service out of the Equinox framework - java.lang.LinkageError

巧了我就是萌 提交于 2020-01-16 16:47:09
问题 I have a class which runs an Equinox framework. Now I would like to get an Object (defined in one of the bundles) that is returned by a service out of the framework. Unfortunately, I get a LinkageError and have no idea how to get rid of it. Is it even possible to let a service return a proper object to non-bundle code? Here is the full story: ParserDTOBundle is a bundle that defines the class ParserDTO and exports the corresponding package. In another bundle, ParserServiceBundle, I define a

sharing java objects between applications

故事扮演 提交于 2020-01-16 08:49:14
问题 I want to write an application that when deployed on a server discovers some classes on that server and their methods and exposé a list of it to a client (via web service, servlet or RMI). the client can then choose a method and activate it (with reflection). Problem is that my application is not in the same context of the other applications on the server so I can't activate their methods (I don't have access to their classloader). I have a few ideas but not sure if they are feasible: Create

Add dependecy to Maven and set to $CATALINA_HOME/shared/lib

空扰寡人 提交于 2020-01-15 09:38:47
问题 I'm using Matlab MCR in web project so I imported these dependecies to pom.xml <!-- Matlab client tool library --> <!-- <dependency> <groupId>DataConcatenation</groupId> <artifactId>DataConcatenation</artifactId> <version>0.0.5-SNAPSHOT</version> </dependency> --> <!-- <dependency> <groupId>DataConcatenator</groupId> <artifactId>DataConcatenator</artifactId> <version>0.0.5-SNAPSHOT</version> </dependency> --> <!-- <dependency> <groupId>DataConversion</groupId> <artifactId>DataConversion<

ClassCircularityError is thrown when getCanonicalName

扶醉桌前 提交于 2020-01-14 07:39:31
问题 Exception stacks. Exception in thread "main" java.lang.ClassCircularityError: plugins/agents/Agent at java.lang.Class.getDeclaringClass(Native Method) at java.lang.Class.getEnclosingClass(Class.java:1085) at java.lang.Class.getCanonicalName(Class.java:1169) at agents.loader.AgentLoader.getPluginAgentFromCache(AgentLoader.java:288) at compiler.AgentCompiler.main(AgentCompiler.java:365) Below is the code which cause the error. It's very strange if I change the getCanonicalName to getName then

ClassCircularityError is thrown when getCanonicalName

假装没事ソ 提交于 2020-01-14 07:39:04
问题 Exception stacks. Exception in thread "main" java.lang.ClassCircularityError: plugins/agents/Agent at java.lang.Class.getDeclaringClass(Native Method) at java.lang.Class.getEnclosingClass(Class.java:1085) at java.lang.Class.getCanonicalName(Class.java:1169) at agents.loader.AgentLoader.getPluginAgentFromCache(AgentLoader.java:288) at compiler.AgentCompiler.main(AgentCompiler.java:365) Below is the code which cause the error. It's very strange if I change the getCanonicalName to getName then

Classloading order in JBoss

被刻印的时光 ゝ 提交于 2020-01-13 10:49:25
问题 I'd like to know if the default behavior of JBoss server (4.2.3.GA in my case) is loading the classes in parent-first or parent-last mode. And in case it work as I suspect in parent-last mode (i.e. first trying to load classes from the application's WEB-INF/lib and only if they are not found go to server\lib), how can I configure it to work in the opposite- first trying to load classes from outside and only looking inside the application afterwards. 回答1: It sounds like you need to set

ClassLoader.getResources returning an empty Enumeration on a Weblogic/Spring application

可紊 提交于 2020-01-13 05:57:11
问题 I've an EAR application deployed on Weblogic 12.2 using Spring 4.0.4 and facing a strange behaviour: Spring can´t find the base package due to Weblogic's classloader which return an empty Enumeration for Spring's code: cl.getResources("my/base/pkg") It's under a context which injects some @Autowired beans on my MDB. (so, due to it, the beans aren´t injected) but if I put the below code into a sample MDB into the same application, it works: Thread.currentThread().getContextClassLoader()

Copy java object/class from one classloader to another classloader

佐手、 提交于 2020-01-12 15:51:12
问题 Hi is there a way to copy one class loaded context (atrributes etc) from one classloader (for instance a 'made' class Point) to another classloader? Making clear, Example: I have an object Point on CL 1. Now running on another CL2, I want to creat this object in CL 3. Some obj: class Point { int x; int y; public Point() {} //getters and setters Scenery: ... class CL2 { // Running on CL 2 ... // Point obj from CL 1 Object point = gotFromCL1(); // Want to create the object on Cl2 Object

How can I safely solve this Java context classloader problem?

亡梦爱人 提交于 2020-01-12 05:22:10
问题 One and only one of my hundreds of users has trouble starting my Java desktop app. It only starts for him about one-third of the time. The other two-thirds of the time a NullPointerException is thrown at startup: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at java.util.Hashtable.put(Hashtable.java:394) at javax.swing.JEditorPane.registerEditorKitForContentType(JEditorPane.java:1327) at javax.swing.JEditorPane.registerEditorKitForContentType(JEditorPane.java:1309) at

Load jar dynamically

ε祈祈猫儿з 提交于 2020-01-11 12:56:10
问题 In my java application, I read a jar file (packaged with Maven shade plugin) into a bytestream. In the jar there is a entrypoint class defined in POM.xml <build> ... <plugins> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>com.mycompany.TheEntryPoint</mainClass> </manifest> </archive> </configuration> </plugin> </plugins> </build> How do I load such class into my java app dynamically? Update: