Using JARs without loading classes

I have a situation where several JARs have had their classes loaded into a schema but now I have other JARs of which cause version collision issues if implemented inside the same schema. Is there a way to actually call a JAR and execute its classes within PL/SQL without actually loading all of it's classes into the schema? In other words our current setup which has all of the needed JAR classes loaded into the schema not have to change, but simply load the new JARs in as JARs and not Java classes, and call their classes without them being loaded into the schema (avoiding the version issues we are experiencing)?
Thanks.

871357 wrote:
I have a situation where several JARs have had their classes loaded into a schema but now I have other JARs of which cause version collision issues if implemented inside the same schema. Is there a way to actually call a JAR and execute its classes within PL/SQL without actually loading all of it's classes into the schema? In other words our current setup which has all of the needed JAR classes loaded into the schema not have to change, but simply load the new JARs in as JARs and not Java classes, and call their classes without them being loaded into the schema (avoiding the version issues we are experiencing)?
Presumably you are referring to putting java into Oracle itself via loadjava.
The traditional solution for this is to use a class loader. That won't work for this case.
However there is one obvious solution. I am rather certain that cross schema calls are possible in oracle. So load them into difference schemas.

Similar Messages

  • Dynamically loading class

    I have a standalone Java application that is using reflection to load classes whose names are written in a text file.
    The question is whether it is possible to add classes to the classpath while the program is running, even if the program already accessed the directory where the class will be located.
    Is this behavior part of the Java specification? I need the application to be cross platform.

    The question is whether it is possible to add classes
    to the classpath while the program is running, even
    if the program already accessed the directory where
    the class will be located.If a class is in the classpath, you can load it via the default classloader without doing anything different. If a class is NOT in the classpath, you will need to use a URLClassloader or a custom classloader. You cannot add a path to the classpath after you have started the JVM.
    I'm not sure exactly what you're asking, so I hope this clarifies it. If not, try, then if you have a problem, post the code that you tried, the error (if any) that you get, and the expected behaviour.
    Is this behavior part of the Java specification? I
    need the application to be cross platform.Loading classes from paths is the same on a cross platform basis. I would wonder a little if "plugins" is the right approach to the problem you're tackling, but I don't know enough to say. Perhaps you could expand on that a little?
    Dave.

  • Basic/Generic Loader class (iView, JSP)

    Hello all,
    i wanna create a very basic custom iView. For this i do not wanna build a JSPDynPage, but just wanna use a standard loader class.
    So is there somekinda generic loader class available which i can simply add to the portalapp.xml of my custom iview?
    regards,
    Markus

    You can use JSTL.
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
        </head>
        <body>
            <h2>Hello World!</h2>
            <c:import url="http://www.yahoo.com"/>
        </body>
    </html>

  • URLClassLoader loading class from jarB, which uses classes from jarC

    Hi, here's my problem:
    I have a classA in executable jarA.
    This uses URLClassLoader to load classB from jarB. So far so good.
    But classB uses classC, which lives in jarC. jarC is specified in the Class-Path of the manifest in jarB. But classB gets a ClassNotFound exception when it tries to use classC.
    The situation I want to achieve looks like this (sorry for the bad art; it's almost impossible to make it look better because sun strips out extra spaces):
    jarA:
    classA-----> URLClassLoader(jarB).loadClass(classB)
    jarB:
    Class-Path jarC
    classB------> new classC
    jarC:
    classC
    My expectation was that URLClassLoader would automatically be used to load all the classes that classB uses, and that it would extend its classpath by the classpath specified in the manifest of jarB, just like the default classloader does. Anyone know what I'm doing wrong?
    When I do the following, i.e. use only the default classloader, everything works fine. Unfortunately I won't know where jarB is until runtime, so I can't actually do this:
    jarA:
    Class-Path jarC
    classA-----> new classB
    jarB:
    Class-Path jarC
    classB------> new classC
    jarC:
    classC
    thanks alot
    j

    Actually, there is definitely a way to make this work. A plugin engine has to handle this in order for plugins loaded by separate loaders to be able to share class instances with one another (dependency). My engine does static runtime plugin dependency resolution, which means it parsers every plugin's config file, then after all plugins are in the "registry" it goes back and resolves all dependencies. How it does this is that each PluginClassLoader keeps a list of "dependent" classloaders. So, if the engine finds plugin A, B, and C, and B depends on C (declares this in its config file), the engine creates 3 class loaders (custom loader called PluginClassLoader), one for each plugin. This is done so that the plugin can be unloaded or reloaded at runtime without having to shut the application down. Now, since B depends on C, when plugin B code requests a class found in C, the JVM first asks B's loader to find the class. The "normal" delegation model of Java is for B's loader to first look in the parent hierarchy, then in its own classpath. The problem with this approach is that in order to support reloadable and unloadable plugins, you do NOT want your plugin .jar file at any location within the main application classpath. The plugin .jar file should be able to be at any URL location outside of any other classpath, even perhaps at another web site.
    So, the JVM asks B to find the class in C. But B's loader isn't able to find it because it is not in B's classpath. The trick is to do one of a couple things. First, remember that each loader keeps a list of dependent loaders. Second, in order to avoid any tie-in to the main classpath, we break the normal classloader delegation model by overriding the loadClass() method. In here we want to first check our local cache of loaded classes. The built-in method findLoadedClass() handles this for us. If that doesn't return a Class, then we want to look in our own classpath. In this case, we only want to look for any classes in B's plugin .jar file. C's class of course wont be found here. So the next step is to delegate to our "dependent" list of loaders. Aha, you say? This is the trick (credit goes to the Eclipse IDE team where a few members taught me this and was able to help me solve my very same problem). By delegating to a dependent loader, B's loader effectively asks C's loader to find C's class. The same thing happens, only this time it is now C's loader doing the work. The very first time the calls is made, no classes are loaded yet, so the finding of the C class in the local cache of C's loader wont yet work. The next step though, looking in C's classpath (C's .jar file) WILL find the class. It is loaded, put in C's loader cache and the Class is returned. Now, at this point B now has a Class from C's classpath that it can use.
    Now, my first foray into this made me think that if B asks C to find it, and C finds it and loads the bytecode, doesn't B's loader also need the bytecode in order to properly "see" the C class. Apparently, this is not needed. I am guessing the JVM keeps a repository of bytecode, so that so long as you have the C ref (location in the JVM's memory where C's bytecode is), you don't need to re-load the bytecode of C into B's loader. Thus, B's loader now can "see" the C class without actually having to have loaded the bytecode of C. Now, B's code can typecast C, use it, etc. Beautiful aint it?
    Let me know if you have any further questions.

  • Tomcat6 does not load class files from WEB-INF/lib/myjarfile.jar  WHY???

    I have placed my jar file in c:\tomcat6\webapps\my-application\WEB-INF\lib\myjarfile.jar
    But, after restarting tomcat6, when i try to import the class file contained in the myjarfile.jar in a servlet, it says
    ProcessFileUpload.java:4: package test.test1 does not exist
    import test.test1.*;
    ^It clearly tomcat's class loading problem.
    As i unzipped my jar and placed the packagefolder structure to
    c:\tomcat6\webapps\my-application\WEB-INF\classes\testand it works perfectly.
    Anyone knows its workaround? please suggest if any configuration changes is required in tomcat or so.
    Thanks.
    ---Sujoy

    Thank you gimbal2 . There was error in creating the jar file myjarfile.jar.
    But, now I have created it again and placed it in place
    c:\tomcat6\webapps\my-application\WEB-INF\lib\myjarfile.jarand tried to use one on the Class file included within the jar to compile my servlet. But, still I am getting error at servlet compilation time. I want to place executable jar files in
    c:\tomcat6\webapps\my-application\WEB-INF\lib\myjarfile.jar and compile my servlet and execute the servlet.
    I DO NOT WANT TO unzip the jar, placing all unzipped files to
    c:\tomcat6\webapps\my-application\WEB-INF\classes\ folder and comiple my servlet and execute the servlet. But, I am failing to user WEB-INF\lib\ folder facility....please help me why i am not getting class files from WEB-INF\lib\ folder.
    If you please see the small code bit and tell me any possible error that would be very helpful.
    Step 1: my library java file MyClass.java
    package test.test1;
    public class MyClass {
         String myName = "Default return string value";
         public void setMyName(String varName) {
              this.myName = varName;
         public String getMyName() {
              return this.myName;
    }Step2 : Creating jar file of my library class files
    C:\jdk1.6\bin>jar cvf myjarfile.jar test
    added manifest
    adding: test/(in = 0) (out= 0)(stored 0%)
    adding: test/test1/(in = 0) (out= 0)(stored 0%)
    adding: test/test1/MyClass.class(in = 452) (out= 296)(deflated 34%)
    adding: test/test1/MyClass.java(in = 230) (out= 140)(deflated 39%)
    C:\jdk1.6\bin>Step3 : Double checking the created jar file content by listing its content
    C:\jdk1.6\bin>jar tf myjarfile.jar
    META-INF/
    META-INF/MANIFEST.MF
    test/
    test/test1/
    test/test1/MyClass.class
    test/test1/MyClass.java
    C:\jdk1.6\bin>Step4 : Placed myjarfile.jar to
    c:\tomcat6\webapps\my-application\WEB-INF\lib\Step5 : Restarted standalone Tomcat6 in my Windows XP SP2.
    Step6 : Created a simple servlet LibFolderTest.java within my-application\WEB-INF\classes\ folder with code
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import test.test1.*;
    public class LibFolderTest extends HttpServlet {
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              MyClass mc = new MyClass();
              out.println(mc.getMyName());
    }Step7 : Tried to compile my servlet LibFolderTest.java and got the following error
    LibFolderTest.java:4: package test.test1 does not exist
    import test.test1.*;
    ^
    LibFolderTest.java:11: cannot find symbol
    symbol  : class MyClass
    location: class LibFolderTest
                    MyClass mc = new MyClass();
                    ^
    LibFolderTest.java:11: cannot find symbol
    symbol  : class MyClass
    location: class LibFolderTest
                    MyClass mc = new MyClass();
                                     ^
    3 errorsThe above servlet compilation error on Step7 is telling me that myjarfile.jar is not loaded by Tomcat6 or not available for use when compiling servlet. I want to use myjarfile.jar from within WEB-INF\lib\ folder but I can not. please help.
    ---Sujoy

  • How to use utility jars without -cp

    I am trying to use a 3d loader from starfire research to load .3ds files. I currently have the jar in /lib/ext and netbeans sees this and uses it, and everything works perfectly fine. When I use this on other machines for a test, I put the 3d loader jar in to the client /lib/ext folder, but my program cannot find it. Any suggestions on where to put this jar without me having to use -cp every time?
    Thanks in advance.

    I'll try to explain better. The 3DS Loader I'm using is called StarfireExt.jar. I have two computers that I am using right now: a custom built desktop with Windows XP 32 bit that runs Netbeans, and a Dell laptop that I'm using to test my software. On the desktop, I have JDK1.6u18 with Java3D also installed. StarfireExt.jar is in my C:/Program Files/Java/jdk1.6.0_18/lib/ext/ folder, and Netbeans allows me to import and use StarfireExt. On the laptop, I have JRE1.6u20, Java3D, and StarfireExt in the lib/ext/ folder. When I'm on the desktop in Netbeans and press F6, it runs fine and the 3DS files load and are displayed. When I clean and build the JAR and move all of the models and JAR to my laptop, the program seems not able to find StarfireExt. The models don't load; no error windows that I've coded pop up.
    P.S. I'm sorry if I'm kind of a Java newbie. I don't know all those awesome developer tricks yet.

  • How to use jar files without setting classpath

    Hi,
    I have a situvation, I can not set classpath, but i have to use jar files, how can I do that.

    URL[] urls = new URL[]{pathToJar, pathToAnotherJar, ...};
    URLClassLoader urlc = new URLClassLoader(urls);
    Now load classes within the jars loaded by the urlc classloader as needed. This is a limited approach, you can mostly use interfaces to work with classes loaded by the custom loader instance above and your existing classes.

  • Class A is Loading Class B Using Reflection

    Hi,
    I am facing the below problem.
    Class A is loading Class B By Using Reflection package.
    Class B is one jar (Eg: B.jar) ,Class A is one Jar (Eg: A.jar)
    Class B internally using Class A variables and methods. When ever loading the class B from Class A it is
    giving the exception is NoClassDefFoundError of Class A.
    We are loading the Class B from Class A only, Why Class A reference is not available in Class B
    Please help me on this
    Thanks
    T. Shankar Reddy

    ShankarReddyT wrote:
    Hi,
    I am facing the below problem.
    Class A is loading Class B By Using Reflection package.
    Class B is one jar (Eg: B.jar) ,Class A is one Jar (Eg: A.jar)
    Class B internally using Class A variables and methods. Myself I don't consider circular references a great idea.
    Presumably you are not using reflection solely because it is circular.
    When ever loading the class B from Class A it is
    giving the exception is NoClassDefFoundError of Class A.
    We are loading the Class B from Class A only, Why Class A reference is not available in Class B
    Several possibilities.
    1. Because you are attempting to load B in the static block of A. In that case the class A has not yet been loaded. And the VM will not try to reload A once it is in the process of loading. Which is pretty smart of the VM.
    2. Because there is a custom class loader involved.
    You might want to post the stack trace of the exception.

  • Loading classes from another jar file

    I've set up my jnpl file so that it references a core jar file (contains main() function). The jnlp also references another jar file (app.jar) which contains class files that I load and instantiate dynamically (using ClassLoader). The core.jar file contains a manifest that includes a reference to app.jar.
    The app works fine when I use "java -jar core.jar" from the command line.
    However, when I wrap the jars using jnlp, I always get a null pointer exception because it cannot find any class that is in the app.jar file. I've tried different strategies, such as trying to load a class file that sits on the server (in a jar file and not in a jar file), but that also fails if I use jnlp (However, it works if I use "java -jar core.jar")
    Any ideas what is going on?

    This is the "OckCore.jar" manifest before signing:
    Manifest-Version: 1.0
    Main-Class: com.Ock.OckCore.OckApp
    Class-Path: . OckMaths.jar
    Created-By: 1.4.0-beta3 (Sun Microsystems Inc.)
    Name: com.Ock.OckCore.OckApp.class
    Java-Bean: FalseThis is the manifest after signing:
    Manifest-Version: 1.0
    Main-Class: com.Ock.OckCore.OckApp
    Created-By: 1.4.0-beta3 (Sun Microsystems Inc.)
    Class-Path: http://hazel/Ock/. http://hazel/Ock/OckMaths.jar
    Name: com/Ock/OckCore/OckApp.class
    SHA1-Digest: KRZmOryizx9o2L61nN+DbUYCgwo=I have removed a load of irrelevant stuff from the "after" manifest to keep it readable.
    note that :-
    The OckApp.class loads normally from webstart and tries to load a class from OckMaths.jar.
    I can prove that OckApp.class does load because it creates a log file when it does.
    The OckApp.class tries to load a class from the OckMaths.jar. This fails if webstart is used but works if OckCore is launched using "java -jar OckCore.jar".
    The jars do exist at the location specified by the manifest.
    The application launches normally if I use "java -Jar OckCore.jar"
    Here is the jnlp file
    <?xml version='1.0' encoding='UTF-8'?>
    <jnlp
         spec="1.0"
         codebase="http://hazel/Ock"
         href="OckMaths.jnlp">
         <information>
              <title>Ock Maths Demo</title>
              <vendor>Rodentware Inc</vendor>
              <description>Demo of a ported app running as a Java Webstart application</description>
              <description kind="short">An app running as a Java Webstart application"></description>
              <offline-allowed/>
         </information>
         <security>
              <all-permissions/>          
         </security>
         <resources>
              <j2se version="1.3"/>
              <jar href="OckCore.jar"/>
              <jar href="OckMaths.jar"/>
         </resources>
         <application-desc main-class="com.Ock.OckCore.OckApp">
    </jnlp> I have also signed the jars outside of a webdirectory. I get the following manifest file:
    Manifest-Version: 1.0
    Main-Class: com.Ock.OckCore.OckApp
    Created-By: 1.4.0-beta3 (Sun Microsystems Inc.)
    Class-Path: . OckMaths.jar
    Name: com/Ock/OckCore/OckApp.class
    SHA1-Digest: KRZmOryizx9o2L61nN+DbUYCgwo=
    note that :-
    The jars do exist at the location specified by the manifest.
    The application launches normally if I use "java -Jar OckCore.jar".
    The application doesn't launch from webstart.
    I've found that cache, but the jar files have been renamed.
    OckCore.jar is anOckCore.jar, etc... so I'm not sure if trying to write a cmdline will work anyway.

  • How can I use charsets.jar without installing it in the client JRE?

    Hi! I've an applet that needs to do some CP850. Since many of the clients are from english speaking countries, they do not have the appropriate JAR that supports the CP850 encoding. Now, I have the charsets.jar which has this encoding. If I install it in the client jre/lib/ext folder, my applet works perfectly, but I don't want to do that. Instead, I want the applet to read it from its own jar or, including the charsets.jar in the archive parameter. I have tried both, adding the whole of charsets.jar to my applet jar using jar -xc dependences\charsets.jar, and also, by putting it in the archive parameter of the applet. None of them works, and I don't know why. If someone can tell me why it didn't work, and how can I make it to work, I'll be very thankfull.
    I've been trying also to use a URLClassLoader, but here I got access exceptions:
    URL urlCharsets = new URL("http://url.com/jars/charsets.jar");
    URL[] urls = {urlCharsets };
    URLClassLoader classloader = new URLClassLoader(urls);
                        classloader.loadClass("sun.io.ByteToCharCp850");Security Access exception here... and the charsets.jar that I'm loading IS signed. No idea what to do here.
    Best regards and happy new year!
    Message was edited by:
    obirenokenobi

    Hi,
    Assuming your applet jar and the charset jar are ine the same location on your
    server, I'll suggest to use this:
    <applet code="myapplet/myapplet.class" archive="myapplet.jar,charset.jar" height="400" width="550"></applet>Hope that help,
    Jack

  • Unable to load classes from jar files inside APP-INF/lib in EAR.

    Weblogic version: 10.3.3
    Platform: Linux x86-64 bit
    We deployed an ear packaged with all the common library jars inside APP-INF/lib. Deployment was successful.
    for some reason, it is always giving ClassNotFoundException for the classes inside the jars. This does not happen
    in 10.3.2 version of weblogic.
    We tried to add them to domain/lib directory (instead of APP-INF/lib) but still it is not able to resolve the classes.
    Any pointers would be appreciated.

    try using prefer-web-inf-classes in the weblogic.xml file in your WAR file
    or using prefer-application-packages in the weblogic-application.xml file in your EAR.

  • Error while using .jar file instead of class file.

    Hello friends,
    I created a java class which are referred and called from other jsp\xml and java files. I compiled this java class and everything is working properly. However, I do not want to use class files but want to use jar files instead. So, I created a jar file of this class file by using the command "jar -cvf jarfilename.jar".I kept the jar file in its respective folder .Also, I removed the class file from its path, just to see that the jar file will work automatically.
    Unfortunately, I am getting an error:
    java.lang.RuntimeException: Component.createComponent(...) Component class not found: <java class path>. I also tried giving the path of this jar file in the classpath. This also does not seem working.
    How to solve this problem?
    Thanks,
    Ranjith M.V
    Edited by: RanjithM.V on May 11, 2008 10:34 PM

    You probably populated the jar file incorrectly.
    A common mistake is to include the path that you had on the classpath, in the jar file.
    So a person will have a classpath like this: /foo/
    And a class in a package bar, like this:
    package bar;So that other classes would include the file like this:
    import bar.TheClass;And the class file is on the filesystem like this:
    .../foo/bar/TheClass.classThen they'll create the jar file including the foo directory, so if they list the jar's contents, they'll see the above (/foo/bar/TheClass.class). But this is wrong. It should start off so that the jar entries start with the top-level package names (like /bar/TheClass.class).
    Maybe you've done that.

  • Can't execute a main class with jar file loaded on command line

    Hello Guys,
    I try to use the following command to execute a main metod from msword class.
    java -cp f60all.jar:jacob.jar msword
    and i receive:
    Exception in thread "main" java.lang.NoClassDefFoundError: msword
    If i extract the 2 jar files then i can execute the main metod:
    java msword
    Can anyone explainme whet is happening ?
    Thanks,
    /Marian

    Hi!
    You need to include the directory where your class is in your classpath... you can use for this the "."
    So, you should write something like
    java -cp .;f60all.jar;jacob.jar msword
    and this supposing that "f60all.jar", "jacob.jar" and "msword.class" are all in the same directory from which you are trying to run the program... in other case write the full paths for the files...
    Bye!

  • Performance issue if we use jar file instead of classes

    Hi,
    My application uses tomcat as web server.
    If i use calsses in webapps -> WEB-INF -> classes folder, i place classes in that ,
    In other case i use jar file and place that file in WEB-INF -> lib folder in the webapps directory.
    There is huge performance difference.
    While using classes performance is great while using jar file performance is very disappointed.
    I am using a file for encryption /decryption also.

    I can't really believe that classes vs jars makes a difference, but whatever.

  • Hide classes while using jar tool.

    I have a set of API classes which I need to ship using jar.
    But even if I use jar utility to archive the classes, one can easily extract and decompile the classes.
    Is there any way this can be avoided?
    Regards

    Not really. You can use an obfuscator to make the code harder to decompile in a way that's easy to read. I'm told some obfuscators can generate class file code that breaks decompilers, but the code could still be disassembled or the next version of decompilers will be able to defeat it.
    By the way, this is an issue with any language.

Maybe you are looking for

  • CO Cycles

    Hi All, At the moment we are using CO cycles for distribution and assesment. Business is asking for the plan cycles as well but the same cycle segments will be used. Is there a way  that i can copy to actual cycles to plan cycles. Thanks, Ama

  • Boot without graphics interface

    Hi all, when I power on my iMac early 2009 24" the system goes on without graphics layer. On the screen there are unix messages and the root prompt at the end of rows. There aren't error messages. At the root prompt I write reboot and the system rebo

  • Will SMS 3.0 work with 6505 and 3750 IOS?

    Will SMS 3.0 work with 6506 s72033advanservicesk9-wan-mz.122-18.sxf9.bin and/or 3750 c3750-advansevicesk9-mz.122-25.SEE3.bin? Thanks! Matt

  • When I try to access iCloud it keeps loading

    I have a Macbook Pro and when i try iCloud it just keeps loading forever.

  • CUMP 8.5; Should Director Fail-Over Cause Audio Conf Be Discon?

    We have a two region CUMP 8.5.5.14 global deployment with WebEx Type II deployment, which we are now piloting. We have a primary Director in one region and a backup Director in another. During fail-over testing in which we establish an audio/web meet