classloader

multiple versions of javamail jar causing NoSuchProviderException

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 17:04:28
问题 I have a standalone library ( jar file) that is added to the application server classpath to monitor all the running applications in the JVM and send email when some issue happens. the jar file have all the dependencies bundled in the jar (using the maven-shade-plugin) including the javamail jar file. When one of the other webapplications in the appserver have javamail as a dependency, some dependency conflict happens with the javamail in my jar file and I get an exception MessagingException

ClassLoader referenced unknown path when going to next activity

我的梦境 提交于 2019-12-24 16:15:09
问题 I currently have 4 different buttons. 3 of them lead to the same activity, but populate an ArrayList with different data. The only difference between the different sets of data is the size. Everytime I use the working button selectCountryAndStateButton everything works fine. However when I use the getAllFacilitiesButton the application returns to the previous activity and I get the following in LogCat 02-08 11:56:26.649 22325-22325/? W/System: ClassLoader referenced unknown path: /data/app

Java override class to Load project Class instead Jar class

徘徊边缘 提交于 2019-12-24 15:24:18
问题 I have a jar that contain a class that I would like to modify. For some reason I do not want to re-compile and update the Jar. So what I do is I recreate a full qualified name for that class in my project, and place my code in it, but I do not have an idea how to ensure JVM loaded my project class and not the Jar class. I have look through some post but they are about how to load a Jar class into project, not the other way round. 回答1: Typically all you need to do is ensure that your class is

Alter value of a static field during class loading using a Java agent

南楼画角 提交于 2019-12-24 12:13:19
问题 We have a java process that calls some method of class X. Class X has timeout static field which decides how long thread should wait for in case of some error. Now, I want to change that value without changing my java process (I don't want deployment, and this change is experimental). How can I use java agent to change this timeout value to say 1 minute (1*60*1000) Class X { .... // timeout = 5 minutes private static long timeout = 5*60*1000; .... } In short, how to write java agent to change

Play!: Use different version of jar than local repository

拟墨画扇 提交于 2019-12-24 12:08:20
问题 Play! framework comes with tons of jar libraries. I am using version 1.7 of apache commons-codec for my Play! application. But Play! is already shipped with version 1.4 and some other older versions. I have placed my commons-codec-1.7.jar in the lib folder, and 'eclipsified' so the jar file is in the class path. But when I expand the Project Explorer in Eclipse I see that both version 1.7 and 1.4 are referenced by the application. My questions are How do I remove version 1.4 from being

Can one break a secury manager with sun.misc.unsafe?

家住魔仙堡 提交于 2019-12-24 11:35:20
问题 Following a conversation on another question, an interesting issue is being raised. Classes loaded with a security manager are protected with the corresponding security. This security could disable reflection (for example). The question is: is it possible to break a security manager with sun.misc.unsafe? If yes, how? EDIT Changed SecuredClassLoader to Security Manager in question. 回答1: No. The sun.misc.Unsafe class requires an access check just like any other privileged action. You can block

How to get list of class files generated by JavaCompiler compilationTask?

北城以北 提交于 2019-12-24 10:59:13
问题 I am trying to compile java code dynamically using javaCompiler. Code works gr8 however I need to get the list of class files created by CompilationTask. Here is source code: JavaCompiler compiler = ToolProvider.getSystemJavaCompiler (); DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>(); StandardJavaFileManager fileManager = compiler.getStandardFileManager (diagnostics,null,null); //compile unit Iterable<? extends JavaFileObject> compilationUnits

Customize the Loader for a MVC App

你。 提交于 2019-12-24 10:16:22
问题 I need to use a customize path for the Ext.Loader in my MVC project. I've already looked through the API and found nothing useable. If I set the loader directly it gets simply overriden, as it seems by the MVC app settings. So how can I customize the loader path for a MVC app? In addition: It would be awesome if the loader could be tweaked to sumarize multiple requirements that occours by the same source into one request. Would that be possible? Thanks in advance for any suggestions Edit The

Implementing a selective ClassLoader

穿精又带淫゛_ 提交于 2019-12-24 10:15:11
问题 I want to instrument the bytecode of some classes on the classpath at loading time. Since these are 3rd party libraries, I know exactly when they are loaded. The problem is that I need to do the instrumentation selectively, i.e. instrument only some classes. Now if I do not load a class with my classloader but with its parent, this parent gets set as the classes classloader and all succinct classes are loaded by that parent, effectively putting my classloader out of use. So I need to

Selecting a class dynamically at runtime

别来无恙 提交于 2019-12-24 10:05:01
问题 Im trying to come up with a solution where the class that processes a "message" is selected at runtime depending on the message type. I know that i can use something like this if msg_type = "A" MsgAProcessor.execute(message); else if msg_type = "B" MsgBProcessoror = execute(message); .... .... .... I dont want to use the above approach as i dont want the code to know anything about the message types that i could be processing. I want to be able to in the future add a new message processor for