Seemingly random errors (Class Loading)

Hi,
I wonder if anyone out there could help me or point me in the right direction to solve this problem im having.
For a Uni project I am writing a Java application that takes three components stored in seperate Jar files (GUI, AI, and Model) dynamically from user defined locations by a central loading class.
eg GUIAddress = "c:/java/guis/gui.jar"
Each has a loading class defined in a MANIFEST.MF file within each Jar file and these are in turn defined by interfaces within my central loading program.
I have set it out like this to allow me to quickly test out different components without changing the main structure of the program.
The problem im having is that I keep getting different ClassFormatErrors depending on what I have changed. Errors include:
Local variable name has bad constant pool index
Extra bytes at the end of the class file
Code segment has wrong length
Illegal constant pool index
Code of a method has length 0All these errors are produced with the same compiler (JRE1.4.2) and with minimal changes to the source code.
For example I get the program to a stage where it works then add the un-used constant to a classprivate int foobar = 10; recompile and reload and i get the error Extra bytes at the end of the class file if I take it out again recompile and rerun and alls better.
Now to me that one line shouldnt make a differene to the program in any significant way. But anyway thats just a small example to show you what my problem is.
These problems started when i made a class Span (http://rex.homeip.net/~matt/java/gui/src/gui/graphs/Span.java) which as you can see does nothing special, but when i use it from another class (http://rex.homeip.net/~matt/java/gui/src/gui/GraphViewer.java) all hell breaks loose. Now i know the class is being loaded and methods can be called from it (line 84) but if i try to call setSpan() then i get the error Local variable name has bad constant pool indexIf anyone has any clues please let me know, im getting sick of going round in circles.
Cheers in advance.
Matt
links
Main loading class: http://rex.homeip.net/~matt/java/loader/src/loader/Loader.java
Class Loader: http://rex.homeip.net/~matt/java/loader/src/loader/setup/SetupManager.java
GUI: http://rex.homeip.net/~matt/java/gui/src/gui/Gui.java
GraphViewer: http://rex.homeip.net/~matt/java/gui/src/gui/GraphViewer.java
Span: http://rex.homeip.net/~matt/java/gui/src/gui/graphs/Span.java

I think I have the solution....
I had the same exact (seemingly random) ClassFormatExceptions being thrown from my custom Class-Loader as well. I would get the same variety of debug prints as you (Invalid constant pool, Code segment has wrong length, etc). At times it seemed to happen randomly to different classes that I loaded, depending on small changes I made to the code.
Here is the background and how I solved it.
I dervied from ClassLoader to make my custom class-loader. I overrode the findClass() method, and NOT the loadClass() method. This is the Java 2 method of making class-loaders, which is simplier than implementing your own loadClass() as in the older Java 1.1way of doing things.
My custom class-loader (called JarFileClassLoader, BTW) already had a list of JAR files that it searched when its findClass() method was called from its parent. I was using a JarFile object to examine the contents of a particular JAR file. Once it found the JarEntry that represented the class I wanted to load, it asked for the InputStream by calling:
JarEntry desiredEntry = // assigned to the JarEntry that represents the class you want to load
InputStream myStream = myJar.getInputStream( desiredEntry );
Then I asked how many bytes were available for reading, I created a byte array that could hold that many bytes, and I read the bytes from the InputStream:
int totalBytes = myStream.available();
byte[] classBytes = new byte[totalBytes];
myStream.read( classBytes );
Finally, I would define and resolve my class by:
Class loadedClass = super.defineClass( className, classBytes, 0, classBytes.length );
resolveClass( loadedClass );
Sometimes, on the call to defineClass(), I would get all the weird ClassFormatExeptions.
After the searching around these forums for a while, I found a lot of discussion about this problem, but I didn't find any concrete explanations or solutions. But I did see some cursory discussion about the InputStream class. This lead me to investigate how this class works exactly.
As it turns out, when you call:
myStream.read( classBytes );
it is NOT guaranteed to read all the available bytes and completely fill the byte array you made for it. It could very easily read LESS than the total available bytes. I don't know why it would do this...maybe something to do with internal buffering of the stream. This happens more often on bigger sized class files that you are trying to read.
The read() call will return an integer that represents the actual number of bytes read during that attempt to read. So, the solution is to check if you got all your bytes during the first call to read(), if not, then read some more.
There is another version of the read() method that takes an 'offset' value into your array and a max bytes to read value. I used this method to modify my code to look like:
int total = myStream.available();
int numNeeded = total;
int numRead = 0;
int offset = 0;
byte[] classBytes = new byte[total];
do
numNeeded -= numRead;
offset = numRead;
numRead += inStream.read( classBytes, offset, numNeeded );
} while( numRead < total );
This will continue looping until all the bytes are read. Then I never got those funky ClassFormatExceptions again. Before my fix, I was getting partial class definitions from calls to read() that didn't return all the bytes. Depending on which part of the class was omitted, I got the varied error prints that you got. Now, after this fix, it seems to work just fine.
Hope this helps!
-Mark

Similar Messages

  • WS 7.0 seemingly not honoring class-loader delegate="false"

    I have a JSF web application that I ship with MyFaces jars.
    I have added a sun-web.xml file in WEB-INF telling the server not to delegate class loading to its parent classloader.
    However, it seems that the server chooses to use the JSF implementation that comes with the server (lib/jsf-api.jar and lib/jsf-impl.jar).
    Of course, the exact same application worked perfectly with WS 6.1 (but JSF was not included in the server distribution).
    Is there something I am missing?

    Here is a sample index.jsp I use to determine where my classes come from.
    When I type something like "javax.faces.FactoryFinder" it finds the class in
    Classloader: sun.misc.Launcher$AppClassLoader@1ba34f2
    URL=jar:file:/C:/soft/SunWebServer7/lib/jsf-api.jar!/javax/faces/FactoryFinder.class
    This is not what I expected, since I embedded an alternate JSF implementation in my web application.
    Strangely enough, when I embed, say, ant in my webapp, it's the right class that is found, not the one in the lib/ directory on the server.
    Does JSF have a special status?
    <%@page contentType="text/html; charset=ISO-8859-1"%>
    <%@page import="java.net.URL"%>
    <%@page import="java.io.ByteArrayOutputStream"%>
    <%@page import="java.io.PrintStream"%>
    <html>
    <head>
    <title>Test Sun Server 7.0</title>
    </head>
    <body>
    Only a static text.
    <br>
    <form>Resource:<input type="text" name="classname"></input><br>
    <input type="submit"></input><br>
    </form>
    <%
          String us = "<null>";
          String c = "<null>";
          try {
            c = request.getParameter("classname");
            Class cl = Class.forName(c);
            out.println("Classloader: " + cl.getClassLoader() + "<br>");
            String[] parts = c.split("\\.");
            String small = parts[parts.length - 1];
            URL u = cl.getResource(small + ".class");
            us = u.toString();
          } catch (Throwable t) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
            PrintStream o = new PrintStream(baos);
            t.printStackTrace(o);
            o.flush();
            o.close();
            us = baos.toString();
            us = us.replaceAll("\\n", "<br>");
    %>
    <br>
    <br>
    CLASS=<%=c%><br>
    URL=<%=us%><br>
    </body>
    </html>

  • JSP on BEA  Weblogic: random error when loading a jsp page that uses a Bean

    Hi!
    I wrote a simple jsp page that stores a String in a JavaBean, and then forwards to another jsp page to display that String. The jsp pages are deployed on a BEA Weblogic 6 Server, but I get a weird behaviour when loading the page into my browser. Usually I get an error message:
    /Response.jsp(9): class 'query.jsp.QueryBean' could not be loaded
    probably occurred due to an error in /Query.jsp line 9:
    <jsp:useBean id = "queryBean" scope = "request" class = "query.jsp.QueryBean" />
    But the funny thing is that after reloading the page a few times it eventually works. The bahaviour seems to be totally random - sometimes it works, sometimes it claims not finding the JavaBean class.
    Anyone experienced something similar?
    Thank you very much,
    Charlie

    Is QueryBean.class located under '<appname>/Web_inf/query/jsp/'?
    If it is please try changing the package name to something else like com.myclass or something like that.

  • Class Loader confusion

    I am trying to use java.net.URLClassLoader to load classes dynamically from jar files. The strange thing is, I can only get this to work successfully with one particular Jar file. With any other Jar file I have tried, I get a java.lang.NoClassDefFoundError. I'm trying to figure out what is different about this particular jar file.
    The first thing I should point out is that when I create the URLClassLoader, I can successfully load the appropriate classes using loadClass(). So I am not mistyping the filename of the Jar or anything like that.
    It's only when I try to create an instance of a class that is not in the Jar but uses a class in the Jar file, that I get the NoClassDefFoundError.
    The second thing I have noticed is that everything works fine when run using the Sun JDK1.3 VM. It is only in my production environment (Lotus Notes) that the problem occurs. It seems the Notes class loader is doing things differently to the sun class loader. Perhaps this is a security issue?
    Can anyone shed any light on why this is occuring? Why does everything work fine with one particular Jar (Jakarta POI) but no others I have tried? And why does it stop working in the Notes environment?
    Any help is appreciated.
    And here is my code:
        public void test()
            URL[] urls=new URL[1];
            File file=new File("c:/software/libraries/tablelayout.jar");
            try
                urls[0]=file.toURL();
            catch (MalformedURLException e)
                e.printStackTrace();
                return;
            ClassLoader cl = this.getClass().getClassLoader();
            ClassLoader loader=URLClassLoader.newInstance(urls,cl);
            Class agentClass=null;
            try
                // Test if we can actually load the class
                Class testClass = loader.loadClass("com.lowagie.text.pdf.PdfReader");
                System.out.println("loaded test class");
                agentClass = loader.loadClass("test.RandomAgent");
            catch (ClassNotFoundException e)
                e.printStackTrace();
                return;
            AgentBase agent=null;
            try
                agent = (AgentBase) agentClass.newInstance(); // This is where the NoClassDefFoundError is thrown
            catch (Exception e)
                e.printStackTrace();
                return;
            agent.NotesMain();
        }And the stack trace I get:
    loaded test class
    java.lang.NoClassDefFoundError: com/lowagie/text/pdf/PdfReader
         at java.lang.Class.newInstance0(Native Method)
         at java.lang.Class.newInstance(Class.java:262)
         at TestAgentUsingClassLoader.NotesMain(TestAgentUsingClassLoader.java:64)
         at lotus.domino.AgentBase.runNotes(Unknown Source)
         at lotus.domino.NotesThread.run(NotesThread.java:218)

    I figured it out. Thanks to this post: http://forum.java.sun.com/thread.jspa?threadID=484866&messageID=2267796
    The class test.RandomAgent was actually being loaded by the system classloader, even though I had asked to create it using the URLClassLoader. The URLClassLoader delegates the creation to its parent (the system class loader) which found the test.RandomAgent class on the system class path. Thereon, all class created by the RandomAgent class would have been loaded by its ClassLoader, i.e. the system class loader.
    To fix this, I had to ensure the test.RandomAgent class was not on the system classpath. To do that, I had to put it in its own Jar and add that jar to the URLClassLoader list.
    It turned out that the reason it worked with one jar (Jakart POI) was that that Jar was on my system classpath! So that was a red herring.

  • Error building project using kXML2 - "Class loading error: Wrong name"

    Hi,
    I'm testing the XML-Parser KXML2 and downloaded the latest package, but the minimal version (kxml2-min.zip). I put this file into the directory "%j2mewtk%\apps\KxmlTest\lib" and wrote the lines
    import org.kxml2.io.*;
    import org.xmlpull.v1.*;
    When I try to build the project with the Wireless Toolkit (v1.04) it spits out the following error:
    Error preverifying class kxml2.io.KXmlParser
    Class loading error: Wrong name
    com.sun.kvem.ktools.ExecutionException: Preverifier returned 1
    Build failed
    I also tried the full package "kxml2.zip" but the same error occurs.
    How can I get rid of this? Thanks in advance!

    Okay, finally worked it out (hopefully). I unpacked the archive to a directory (say "%J2MEWTK%\apps\KxmlTest\tmpclasses") and then preverified them "manually":
    %J2SDK%\bin\preverify.exe -classpath "%J2MEWTK%\apps\KxmlTest\tmpclasses";"%J2MEWTK%\lib\midpapi.zip" org.kxml2.io.KXmlParser
    %J2SDK%\bin\preverify.exe -classpath "%J2MEWTK%\apps\KxmlTest\tmpclasses";"%J2MEWTK%\lib\midpapi.zip" org.xmlpull.v1.XmlPullParser
    %J2SDK%\bin\preverify.exe -classpath "%J2MEWTK%\apps\KxmlTest\tmpclasses";"%J2MEWTK%\lib\midpapi.zip" org.xmlpull.v1.XmlPullParserException
    Then I packed them again to a jar-file:
    %J2SDK%\bin\jar.exe -cvf kxml2-min.jar %J2MEWTK%\apps\KxmlTest\tmpclasses\output\.
    That was all!

  • JAVAMAP-Sax Parser ...............Linkage error when loading the class.

    Dear all,
    Do we have any extra things to execute the Java mapping using the Sax Parser?
    When I am executing the interface mapping ,I am getting the" Linkage error when loading the class" error.
    Kindly let me know your personnel maildId so that I can mail you the screen shots.
    Thanks,
    Srinivasa

    Dear sunil,
    Find the File.
    Source:
    <MTO_FTP_MAT_DETAILS>
    <MATDETAILS>
    <MAKTX>
    <MATNR>
    <WERKS>
    <LABST>
    <MEINS>
    <PERCNT>
    TARGET
    MTI_FTP_MAT_DETAILS
    <MATDETAILS>
    <MAKTX>
    <MATNR>
    <WERKS>
    <LABST>
    <MEINS>
    <PERCNT>
    Source:
    <MTO_FTP_MAT_DETAILS>
    <MATDETAILS>
    <MAKTX>
    <MATNR>
    <WERKS>
    <LABST>
    <MEINS>
    <PERCNT>
    TARGET
    MTI_FTP_MAT_DETAILS
    <MATDETAILS>
    <MAKTX>
    <MATNR>
    <WERKS>
    <LABST>
    <MEINS>
    <PERCNT>
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.Attributes;
    import org.xml.sax.SAXException;
    import org.xml.sax.helpers.DefaultHandler;
    import com.sap.aii.mapping.api.StreamTransformation;
    class Echo {
    public static OutputStream out;
    public class myEcho extends DefaultHandler implements StreamTransformation {
    private Map map;
    public void setParameter(Map param) {
    map = param;
    public void execute(InputStream in, OutputStream out) {
    DefaultHandler handler = this;
    SAXParserFactory factory = SAXParserFactory.newInstance();
    try {
    SAXParser saxParser = factory.newSAXParser();
    Echo.out = out;
    saxParser.parse(in, handler);
    } catch (Throwable t) {
    t.printStackTrace();
    public void startDocument() throws SAXException {
    try {
    Echo.out.write("<?xml version='1.0' encoding='UTF-8'?>".getBytes());
    } catch (IOException e) {
    e.notify();
    public void endDocument() throws SAXException {
    try {
    Echo.out.flush();
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    public void startElement(String namespaceURI, String sName, // simple name
    String qName, // qualified name
    Attributes attrs) throws SAXException {
    String eName = sName; // element name
    if ("".equals(eName))
    eName = qName; // not namespace-aware
    if ("ns0:MTO_SAP_MAT_DETAILS".equals(qName)) {
    try {
    Echo.out.write(("<MTI_FTP_MAT_DETAILS>").getBytes());
    } catch (Exception e) {
    e.printStackTrace();
    } else {
    try {
    Echo.out.write(("<" + qName + ">").getBytes());
    } catch (Exception e) {
    e.printStackTrace();
    public void endElement(String namespaceURI, String sName, // simple name
    String qName // qualified name
    ) throws SAXException {
    String eName = sName; // element name
    if ("".equals(eName))
    eName = qName; // not namespace-aware
    if ("ns0:MTO_SAP_MAT_DETAILS".equals(qName)) {
    try {
    Echo.out.write(("</MTI_FTP_MAT_DETAILS>").getBytes());
    } catch (Exception e) {
    e.printStackTrace();
    } else {
    try {
    Echo.out.write(("</" + qName + ">").getBytes());
    } catch (Exception e) {
    e.printStackTrace();
    public void characters(char buf[], int offset, int len)
    throws SAXException {
    String s = new String(buf, offset, len);
    try {
    Echo.out.write(s.getBytes());
    } catch (Exception e) {
    e.printStackTrace();

  • Error class cannot be loaded (oracle.xml.xsql.ViewObject)?

    Hallo,
    i want to use oracle.xml.xsql.ViewObject and i become the error class cannot be loaded in xsql action.
    What can it be?
    Any help is appreciated

    Thanks lot for the quick response.
    I have copied the sqljdbc.jar file to the ThirdParty folder and restarted in App server. Now that the earlier error "The target database JDBC driver class cannot be loaded" is not appearing while provisioning in the rejected task.
    I am getting a new error "GCPROV.ProvTransportProvider.DBProvisioningTransport.DB_GET_CONNECTION_ERROR".
    Can you please let me know the reason for this. All the connections parameters are correct to connect to the target databse.
    Waiting for the response.

  • No security manager: RMI class loader disabled Error at RMI client programm

    Got following error on invoking remote method from RMI client,
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
    java.lang.ClassNotFoundException: com.rmi.RmiImpl_Stub (no security manager: RMI class loader disabled)
    Please let me know solution.

    Hello JAAZ,
    I got the same error yesterday. I was a little frustrated, because the day before everything was fine...
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
            java.lang.ClassNotFoundException: uk.co.it.ete.server.ETE_Server (no security manager: RMI class loader disabled)
            at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)The solution was, that I did some refactoring and some of the classes were now in different packages. I updated the system on the client-side and now everything works again.
    I think debugging RMI-applications is not as easy as "normal" applications ..
    maybe this helps..
    Regards
    tk

  • ERROR: RMI Class loader disabled

    Despite of setting classpath, policy tool I am getting following error. What does the error mean and What is the solution?
    E:\Javaprog\RMI>java MultiplyServerImpl
    Server could not start java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: MultiplyServerImpl_Stub (no security manager: RMI class loader disabled)

    Hello JAAZ,
    I got the same error yesterday. I was a little frustrated, because the day before everything was fine...
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
            java.lang.ClassNotFoundException: uk.co.it.ete.server.ETE_Server (no security manager: RMI class loader disabled)
            at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)The solution was, that I did some refactoring and some of the classes were now in different packages. I updated the system on the client-side and now everything works again.
    I think debugging RMI-applications is not as easy as "normal" applications ..
    maybe this helps..
    Regards
    tk

  • Awk: error while loading shared libraries: libdl.so.2: wrong ELF class: ELF

    Hello,
    I'm installing Application Dependency and Performance (ADP, also call CAMM) in OEM 11g. The steps is as follows:
    1) go to the directory ../oms11g/ocamm and extract ocamm.zip file
    2) then go to the directory ../oms11g/ocamm/Disk1/InstData/Linux/VM
    3) run ./install.bin to perform the installation
    However, I got following error message immediately:
    Preparing to install...
    Extracting the JRE from the installer archive...
    Unpacking the JRE...
    Extracting the installation resources from the installer archive...
    Configuring the installer for this system's environment...
    awk: error while loading shared libraries: libdl.so.2: wrong ELF class: ELFCLASS32
    dirname: error while loading shared libraries: libc.so.6: wrong ELF class: ELFCLASS32
    /bin/ls: error while loading shared libraries: librt.so.1: wrong ELF class: ELFCLASS32
    basename: error while loading shared libraries: libc.so.6: wrong ELF class: ELFCLASS32
    dirname: error while loading shared libraries: libc.so.6: wrong ELF class: ELFCLASS32
    basename: error while loading shared libraries: libc.so.6: wrong ELF class: ELFCLASS32
    Launching installer...
    grep: error while loading shared libraries: libc.so.6: wrong ELF class: ELFCLASS32
    /tmp/install.dir.5356/Linux/resource/jre/bin/java: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory
    Can anybody advise me how to resolve this issue? Also more info regarding our environment:
    Product: Oracle Enterprise Manager Grid Control 11g
    Operating System: Red Hat Enterprise Linux Server release 5.5 (Tikanga) 2.6.18 194.el5 (64-bit)
    Hardware Platform: x86_64
    Thanks,
    Neddy
    Edited by: user622199 on Mar 29, 2011 3:37 AM

    execute below and check
    cat install.bin |sed "s/export LD_ASSUME_KERNEL/#xport LD_ASSUME_KERNEL/" > install.fixed
    chmod +x install.fixed
    ./install.fixed

  • Random failure to load classes

    I am working for a client and we are playing with two versions
    of Oracle Portal. One is running on Windows 2000 and its version
    1.0.2.2 and the other is prior to this version and was supplied
    to us by the client. The client supplied machine is running
    Solaris. Unfortunately the version supplied to us by the client
    and the version that we are forced to use appears to randomly
    not load classes in the classpath defined by the
    jserv.properties.
    It even goes so far as to load SOME classes in a given package
    but not all of them. It is very bizarre. There are no
    dependencies on JDK versions not being used by Portal. I need to
    be able to locate this problem and fix it. Does anyone know of
    any .jar files that might contain the updated classloaders from
    the newer version of portal that I could replace on the older
    version.
    All of these classes load correctly under 1.0.2.2. It is very
    bizarre. Additionally does anyone know if it is possible upgrade
    Portal without reinstalling Portal?
    Thanks in advance,
    Gabriel Harrison
    [email protected]

    Did you solve this problem?
    I have the same issue....
    Fabio

  • I am running Mac OS 10.6.7 I cannot run a java based program from the net when parental controls are set the error is The error is Load: class installer.CheckVersion 13. class not found  Help!

    I am running Mac OS 10.6.7 I cannot run a java based program from the net when parental controls are set the error is The error is Load: class installer.CheckVersion 13. class not found 

    Then, talk to the person running the lab.

  • WSAD, EJB, runtime class load error

    In WSAD 5.1.1, for my EJB Project
    I added required JAR files to Java Build Path correctly
    I have compliled my EJB successfully.
    I have Generated RMIC and Deploy ...
    - MY EJB runs fine to display "Hello"
    - But When I run the same EJB to connect the database which requires a JAR file
    it gives error class not found at : Class.forName(driver).newInstance();
    Can any one tell how to add JAR file to EJB class path to run my EJB successfully??
    Thanks in advance...

    1. After you add jar to your project build path, it ONLY helps in compiling these java source code. Those jars do nothing while you EJBs and helper classes running in EJB container.
    2. While EJBs and helper classes running in container, the Application Server (WSAD test server or Websphere application server) will look for jars in server's classpath.
    The best approach for adding jars as I know:
    1. You usually have a J2EE application project (EAR project).
    2. Add (copy) jars into the EAR project.
    3. Other projects (EJB or Java project) set dependency in project properties rather than adding jar into build path.
    This approach will help your code running anywhere. Also you may find the following article by IBM very helpful to you.
    http://www-106.ibm.com/developerworks/websphere/library/techarticles/0112_deboer/deboer.html
    Regards,
    Joe

  • Dynamic Class Loading and Stubs

    How Dynamic Class Loading is used on Java RMI, since stubs are generated on clients using Reflection API?
    I was reading Dynamic code downloading using JavaTM RMI (http://java.sun.com/javase/6/docs/technotes/guides/rmi/codebase.html), it seems to be out of date.
    For example, "The client requests the class definition from the codebase. The codebase the client uses is the URL that was annotated to the stub instance when the stub class was loaded by the registry. Back in step 1, the annotated stub for the exported object was then registered with the Java RMI registry bound to a name."

    "Enhancements in J2SETM 5.0
    Dynamic Generation of Stub Classes
    This release adds support for the dynamic generation of stub classes at runtime, obviating the need to use the Java(tm) Remote Method Invocation (Java RMI) stub compiler, rmic, to pregenerate stub classes for remote objects. *Note that rmic must still be used to pregenerate stub classes for remote objects that need to support clients running on _earlier versions_.*
    When an application exports a remote object (using the constructors or static exportObject methods(1) of the classes java.rmi.server.UnicastRemoteObject or java.rmi.activation.Activatable) and a pregenerated stub class for the remote object's class cannot be loaded, the remote object's stub will be a java.lang.reflect.Proxy instance (whose class is dynamically generated) with a java.rmi.server.RemoteObjectInvocationHandler as its invocation handler.
    An existing application can be deployed to use dynamically generated stub classes unconditionally (that is, whether or not pregenerated stub classes exist) by setting the system property java.rmi.server.ignoreStubClasses to "true". If this property is set to "true", pregenerated stub classes are never used.
    Notes:
    * If a remote object has pre-5.0 clients, that remote object should use a stub class pregenerated with rmic or the client will get an ClassNotFoundException deserializing the remote object's stub. Pre-5.0 clients will not be able to load an instance of a dynamically generated stub class, because such a class contains an instance of RemoteObjectInvocationHandler, which was not available prior to this release.
    * Prior to the J2SE 5.0 release, exporting a remote object would throw a java.rmi.StubNotFoundException if the pregenerated stub class for the remote object's class could not be loaded. With the added support for dynamically generated stub classes, exporting a remote object that has no pregenerated stub class will silently succeed instead. A user deploying a server application to support pre-5.0 clients must still make sure to pregenerate stub classes for the server's remote object classes, even though missing stub classes are no longer reported at export time. Such errors will instead be reported to a pre-5.0 client when it deserializes a dynamically generated stub class.
    (1) The static method UnicastRemoteObject.exportObject(Remote) is declared to return java.rmi.server.RemoteStub and therefore cannot be used to export a remote object to use a dynamically generated stub class for its stub. An instance of a dynamically generated stub class is a java.lang.reflect.Proxy instance which is not assignable to RemoteStub."
    http://java.sun.com/j2se/1.5.0/docs/guide/rmi/relnotes.html

  • MBean calling ejb class loading issue

    Hi,
    I would like to have an mbean call an ejb. I have come against a (predictable!!)
    class loading problem. The EJB Home cant be bundled with the mbean because the
    mbean class loader would load the interface, preventing ejb reload( Thats what
    the error msg indicates) and the ejb doesnt get deployed.
    I have moved to an mlet based scheme (beacuse an mlet is a class loader) to
    load the mbeans, but now I have the problem that when the mbean looks up the
    home in jndi the cast fails ie the jndi object has an interface class loaded by
    the ejb class loader but the mlet has its own loaded home interface. These class
    loaders appear to be sibblings - but I havnt printed out the trees.
    This is WLS 702 which seems to be JMX 1.1. Has anyone got a way around this?
    Have I invented a problem that doesnt exist? I cant go to WLS8.
    My current way forward is to have the mbean find the class loader that loaded
    the interface class (jndi object) and then have the mbean use that class loader
    to load its copy of the interface class. Seems a bit complex. Im sure I missed
    something obvious.
    Thanks
    Pete Marshall

    Pete,
    could you explain better your thoughts...
    I'm interested to hear them.
    regards,
    Pedro Salazar.
    Pete Marshall wrote:
    Must think before typing..
    If I have the ejb register a listener on the mbean and have the mbean emit an
    event the detyped notification from the mbean will break the link between the
    mbean class loader and the ejb loader. I think ;-) Ill try it.
    Pete
    "Pete Marshall" <[email protected]> wrote:
    Hi,
    I would like to have an mbean call an ejb. I have come against a (predictable!!)
    class loading problem. The EJB Home cant be bundled with the mbean because
    the
    mbean class loader would load the interface, preventing ejb reload( Thats
    what
    the error msg indicates) and the ejb doesnt get deployed.
    I have moved to an mlet based scheme (beacuse an mlet is a class loader)
    to
    load the mbeans, but now I have the problem that when the mbean looks
    up the
    home in jndi the cast fails ie the jndi object has an interface class
    loaded by
    the ejb class loader but the mlet has its own loaded home interface.
    These class
    loaders appear to be sibblings - but I havnt printed out the trees.
    This is WLS 702 which seems to be JMX 1.1. Has anyone got a way around
    this?
    Have I invented a problem that doesnt exist? I cant go to WLS8.
    My current way forward is to have the mbean find the class loader that
    loaded
    the interface class (jndi object) and then have the mbean use that class
    loader
    to load its copy of the interface class. Seems a bit complex. Im sure
    I missed
    something obvious.
    Thanks
    Pete Marshall

Maybe you are looking for

  • Do I not get full versions of the CC software when I buy a CC membership?

    So I bought my CC membership back in January I think. And the first thing I did was install Premiere Pro CC. I needed it. Now about a month later, I need it again, and it says that I'm on a trial version. I signed into my CC, and tried again, but it

  • Single migo for multiple vendors and multiple material

    Dear MM Experts, I have 2 open purchase orders as per below PO no 01 :- Material : A , Vendor : X PO no 02 :- Material : B , Vendor : Y Can we make the single goods receipt for both purchase orders even having different vendor and material. If yes th

  • Where is the list of hyphenated words located in mac os x

    I would like to create a list of words in Armenian for auto-hyphenation. Is there a way I can create this list and install it where the English hyphenated word list is installed, so that any word processor can auto-hyphenate an Armenian text? After c

  • Problem in a inner query- order by clause

    hi... I have a update statement with a simple select clause present as inner query.. (select col1 from table1 where col2='abc' and rownum=1 order by col3 desc) since it is a inner query, thats why i can not remove the brackets. col3 may be 0 or 1(1 c

  • A  Socket   Program Java

    Hello Dear Java Forums Team I'am Alfonso Franco who is reporting my socket program as http://www.javaworld.com without a port number assigned only the Input of www.javaworld.com more the following Code: System.out.printIn( " Enter a Host Name: ", + n