Weblogic6.0 classloader

I can't seem to find any documentation on the mentioned
improvements of the classpath and classloader on weblogic6.0.
Could someone please explain these improvements or help to
provide me with an appropriate link?
Has the dreaded ClassCastException problems been eliminated?
Thanks

http://e-docs.bea.com/wls/docs60/programming/topics.html#1037589
Igor Zavialov, [email protected]
Consulting Services available
"Jas" <[email protected]> wrote in message
news:[email protected]..
>
>
I can't seem to find any documentation on the mentioned
improvements of the classpath and classloader on weblogic6.0.
Could someone please explain these improvements or help to
provide me with an appropriate link?
Has the dreaded ClassCastException problems been eliminated?
Thanks

Similar Messages

  • What relationship between every classloader?

    Can I deploy several EJB JARS which have many enterprise beans in weblogic6.1sp2?
    what relationship between these ejb jars' classloader and web application's classloader?

    Can I deploy several EJB JARS which have many enterprise beans inweblogic6.1sp2?
    what relationship between these ejb jars' classloader and webapplication's classloader?
    Typically you'd put all those JARs and the WAR into an EAR. Then they'd
    share a classloader (although there's actually more than one involved). If
    you have problems, you can start consolidating; in case of emergency, tend
    to consolidate toward all the classes (including web app) being in one JAR.
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    http://www.tangosol.com/coherence.jsp
    Tangosol Coherence: Clustered Replicated Cache for Weblogic
    "ejb" <[email protected]> wrote in message news:3d9287f2$[email protected]..
    >

  • Urgent : Problem with Servlet Filters in Weblogic6.1

    Hi,
    We have developed an application using Tomcat4.1.24 with Weblogic6.1 Service Pack2.
    Now we are removing the Tomcat and moving the web layer into weblogic. We have implemented Servlet Filters and Listeners.
    When I converted .jar and .war files into .ear file and deployed into Weblogic6.1. But that application is not deploying. I found that Weblogic6.1 does not support Filters and Listeners from Servlet2.3.
    When I tried to deploy in the Weblogic6.1, it is giving the error as " java.lang.reflect.UndeclaredThrowableException".
    Could somebody please give me a solution how my filters and listeners can make working with weblogic6.1.
    Is there any solution.. My application is successfully working with Weblogic8.1. But I want the solution in weblogic6.1. It would be great if somebody can give me solution how to make Filters n Listeners working with Weblogic6.1.
    Thanks in advance.

    Hi Prasanna,
    Thank you for the timely reply.
    I have already done according to the process given in the url which u have given me.
    set and getFilterConfig methods are implemented in my AuthenticationFilter class. But still I could not be able deploy the application and I am not able to get the ServletContext object from Session. When I tried commenting the Filters and Listeners in my web.xml file then my .ear file was successfully deployed but I could not get the ServletContext from Session.
    Below code is from my web.xml:
    <filter>
    <filter-name>HRSuthenticationFilter</filter-name>
    <filter-class>com.peramb.hrs.servlet.AuthenticationFilter</filter-class>
    <init-param>
    <param-name>encoding</param-name>
    <param-value>UTF-8</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>HRSAuthenticationFilter</filter-name>
    <url-pattern>/jsp/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>HRSAuthenticationFilter</filter-name>
    <servlet-name>action</servlet-name>
    </filter-mapping>
    <listener>
    <listener-class>com.peramb.hrs.servlet.HRSContextListener</listener-class>
    </listener>
    When I comment the above code from web.xml it is deploying with out errors.. but I am not getting the servlet context, hence my application is not working.
    When tried uncommenting the listerns part or Filters part or bothe, My application is deploying with an error on the console. I.e,
    “<Sep 22, 2005 12:20:36 PM IST> <Error> <Management> <Error deploying application
    .\config\mydomain\applications\hrsgb.ear: java.lang.reflect.UndeclaredThrowable
    Exception>”.
    And the error in Weblogic logs is below:
    ####<Sep 22, 2005 12:20:36 PM IST> <Info> <HTTP> <spacker> <myserver> <ExecuteThread: '0' for queue: '__weblogic_admin_html_queue'> <system> <> <101047> <[WebAppServletContext(6387482,hrsgb,/hrsgb)] registering JSPServlet with initArgs '[JspConfig: verbose=true,packagePrefix=jsp_servlet,-compiler=javac,compileFlags=,workingDir=E:\bea\wlserver6.1\config\mydomain\applications\.wlnotdelete\wlap36546\WEB-INF\_tmp_war_mydomain_myserver_hrsgb,pageCheckSeconds=1,superclass=weblogic.servlet.jsp.JspBase,keepgenerated=false,precompileContinue=false,compilerSupportsEncoding=true,encoding=null,defaultfilename=index.jsp,compilerclass=null,noTryBlocks=false]'>
    ####<Sep 22, 2005 12:20:36 PM IST> <Debug> <HTTP> < spacker > <myserver> <ExecuteThread: '0' for queue: '__weblogic_admin_html_queue'> <system> <> <101158> <Exception thrown while loading hrsgb: java.lang.SecurityException: sealing violation>
    java.lang.SecurityException: sealing violation
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:229)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:51)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:190)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:281)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
    at weblogic.servlet.internal.WebAppServletContext.registerEventListener(WebAppServletContext.java:2031)
    at weblogic.servlet.internal.WebAppServletContext.initFromDescriptors(WebAppServletContext.java:1471)
    at weblogic.servlet.internal.WebAppServletContext.init(WebAppServletContext.java:943)
    at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:878)
    at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:515)
    at weblogic.j2ee.WebAppComponent.deploy(WebAppComponent.java:77)
    at weblogic.j2ee.Application.addComponent(Application.java:176)
    at weblogic.j2ee.J2EEService.addDeployment(J2EEService.java:117)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:364)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:150)
    at weblogic.management.mbeans.custom.WebServer.addWebDeployment(WebServer.java:76)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:374)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
    at $Proxy37.addWebDeployment(Unknown Source)
    at weblogic.management.configuration.WebServerMBean_CachingStub.addWebDeployment(WebServerMBean_CachingStub.java:1337)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:350)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:150)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:374)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
    at weblogic.management.internal.ConfigurationMBeanImpl.updateConfigMBeans(ConfigurationMBeanImpl.java:507)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:376)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
    at weblogic.management.internal.DynamicMBeanImpl.addDeployment(DynamicMBeanImpl.java:997)
    at weblogic.management.internal.DynamicMBeanImpl.addDeployment(DynamicMBeanImpl.java:984)
    at weblogic.management.internal.DynamicMBeanImpl.add(DynamicMBeanImpl.java:969)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:648)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:374)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
    at $Proxy88.addTarget(Unknown Source)
    at weblogic.management.mbeans.custom.ApplicationManager.autoDeploy(ApplicationManager.java:930)
    at weblogic.management.mbeans.custom.ApplicationManager.addApplication(ApplicationManager.java:1039)
    at weblogic.management.mbeans.custom.ApplicationManager.addApplication(ApplicationManager.java:954)
    at weblogic.management.mbeans.custom.ApplicationManager.poll(ApplicationManager.java:851)
    at weblogic.management.mbeans.custom.ApplicationManager.poll(ApplicationManager.java:781)
    at weblogic.management.mbeans.custom.ApplicationManager.update(ApplicationManager.java:210)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:374)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
    at $Proxy5.update(Unknown Source)
    at weblogic.management.console.webapp._domain.__upload_app._jspService(__upload_app.java:150)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
    at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:284)
    at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:119)
    at weblogic.management.console.actions.ForwardAction.perform(ForwardAction.java:35)
    at weblogic.management.console.actions.internal.ActionServlet.doAction(ActionServlet.java:171)
    at weblogic.management.console.actions.internal.ActionServlet.doPost(ActionServlet.java:85)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:616)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:262)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:198)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2678)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2412)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:140)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:121)
    ####<Sep 22, 2005 12:20:36 PM IST> <Error> <J2EE> < spacker> <myserver> <ExecuteThread: '0' for queue: '__weblogic_admin_html_queue'> <system> <> <160001> <Error deploying application hrsgb: Could not load hrsgb>
    ####<Sep 22, 2005 12:20:36 PM IST> <Error> <Management> < spacker> <myserver> <ExecuteThread: '0' for queue: '__weblogic_admin_html_queue'> <system> <> <141042> <Error deploying application .\config\mydomain\applications\hrsgb.ear: java.lang.reflect.UndeclaredThrowableException>
    I could not trace the problem. Please help me with some solution for the above problem

  • Unable to deploy stateful session bean in weblogic6.1

    Hi there, I am trying to deploy an OrderSession.jar into weblogic6.1 sp 5. But it keeps throwing errors whenever I install the jar file. Following is the error message received. Can someone help me what causes this problem and how to solve it? Thanks!!
    I have copied part of the error messages as it is too long. Hope the message helps. There are 3 sections of it.
    Part 1:
    ========
    java.lang.ClassNotFoundException: com.apps.ecommerce.OrderSessionBean_oe1mpm_HomeImpl
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:185)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
    Part 2:
    ========
    --------------- nested within: ------------------
    weblogic.utils.AssertionError: ***** ASSERTION FAILED ***** - with nested exception:
    [java.lang.ClassNotFoundException: com.apps.ecommerce.OrderSessionBean_oe1mpm_HomeImpl]
    at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.getHomeClass(ClientDrivenBeanInfoImpl.java:357)
    Part 3:
    ========
    <Sep 12, 2003 11:54:22 AM SGT> <Error> <J2EE> <Error deploying application OrderSession:
    Unable to deploy EJB: Ecommerce.OrderSessionHome from OrderSession.jar:
    java.lang.ClassNotFoundException: com.apps.ecommerce.OrderSessionBean_oe1mpm_HomeImpl
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:185)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
    at weblogic.ejb20.deployer.BeanInfoImpl.loadClass(BeanInfoImpl.java:307)
    at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.getHomeClass(ClientDrivenBeanInfoImpl.java:352)
    at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.deploy(ClientDrivenBeanInfoImpl.java:796)
    at weblogic.ejb20.deployer.Deployer.deployDescriptor(Deployer.java:1304)
    at weblogic.ejb20.deployer.Deployer.deploy(Deployer.java:1010)

    Try unpacking the jar using a compression tool like winzip or any other tool and just check if extracted classes files are in the same package hirerachy as u have coded if not that is would be the problem

  • How to enable web-app "parent-last" classloading in WLS 10.3?

    Hello,
    We are having some issues when using Groovy to execute ant tasks in a webapp. They are due to the classloading order in WLS.
    The problem is this :
    - Our webapp is using Groovy 1.5.6.
    - Groovy 1.5.6 uses ant 1.7. When groovy calls ant tasks such as <untar>, <unjar>, etc, it is passing the <mapper> element, which is supported in ant 1.7.
    - When this webapp is deployed in WLS 10.3, Groovy tries to call these ant tasks, but WLS has ant 1.6 which does not support the nested <mapper> element groovy is trying to pass.
    - The groovy script blows up with an ant error because of the unsupported element.
    - We are packaging ant 1.7 jars in the WEB-INF/lib dir of our WAR file, but WLS is loading the classes from it's own classpath first, so we do not get the 1.7 impl loaded.
    The solution is to enable "parent-last" classloading for this webapp, but I can not find any documentation on how to do this.
    In Websphere you can set a checkbox for it in the console.
    In Orion, you add to the orion-web.xml file this tag <web-app-class-loader search-local-classes-first="true"/>
    ** In WebLogic, how do you do this?
    I have been searching the documentation and asking around, and I can not find an answer yet. Thanks in advance for your help!

    Try either a filtering classloader as described here:
    http://edocs.bea.com/wls/docs103/programming/classloading.html#wp1097187
    Or prefer-web-inf-classes in weblogic.xml:
    http://edocs.bea.com/wls/docs103/programming/classloading.html#wp1082452

  • Classloader Again

    Sorry to bring up the classloader questions again and again. I am a bit confused by the language used in the documentation when it says things like each application has its own universe etc. And also, the following statement in the docs,
    "The exception is the Web Classloader, which follows the delegation model in the Servlet specification. The Web Classloader looks in the local classloader before delegating to its parent. You can make the Web Classloader delegate to its parent first by setting delegate="true" in the class-loader element of the sun-web.xml file. For details, see the Developer's Guide to Web Applications."
    I wanted to see if some one could answer the following. (These are very easy for me to test. But, at this point I have a very "rich" system classpath that includes a lot of classes/jars etc. Makes it harder to see a clear picture. And I want to see if what I am observing the correct behavior))
    I have a com.xyz.myClass packaged in utils.jar. I also have a test servlet and jsp page. The test servlet makes a call to com.xyz.myClass
    A) If I individually deploy my test servlet/jsp as a .WAR, where should I place utils.jar?
    (If I had utils.jar in the system classpath, is the WAR supposed to see it?)
    B) What if the a

    I have a com.xyz.myClass packaged in utils.jar. I also have > a test servlet and jsp page. The test servlet makes a call to > com.xyz.myClass
    A) If I individually deploy my test servlet/jsp as a .WAR,
    where should I place utils.jar?You can place it in any one of a number of locations:
    - within the WAR under WEB-INF/lib/. This location would be the most conventional, self-contained approach.
    - under $INSTANCE_ROOT/lib/. This location would mean that the same "version" the library would be shared by all apps (assuming that the other apps did not include their own copy).
    - under classpath-suffix setting for the instance. Similar to using $INSTANCE_ROOT/lib/, but you have to specify the JAR file name explicitly.
    (If I had utils.jar in the system classpath, is the WAR
    supposed to see it?)Yes.
    B) What if the above .WAR was part of a larger .EAR and I > deploy the .EAR instead of the .WAR? (Should utils.jar
    be in system class path or the web-inf/lib of the .WAR ?)Either.
    C) What if the .EAR above also had a few EJBs that
    accessed com.xyx.myClass ?- Self-contained approach would be to package the JAR file in the EAR and use the manifest classpath approach to denote its location for both the EJB JAR module and the WAR module.
    - Alternatively, you could either place the library either under $INSTANCE_ROOT/lib/ or specify the library in the classpath-suffix setting in the instance configuration.
    A good example of when it makes sense for the web classloader to look in the local classloader before delegating upward to the system classloader is the case in which your web application depends on a particular JAXP compatible XML parser that is different from that which is being used by the application server infrastructure. In this case, you would want the XML parser embedded in your web app or EAR to take precedence over the other XML parser packaged in the system classpath for use by the app server.
    Chris

  • 64-bit JNI C++ to JAVA invocation multiple threads classloader problem

    Hi ALL,
    I have a C++ app that invokes Java classes on 64-bit Solaris 10 with 64-bit JVM.
    Here is the problem:
    The native non-main (not the thread that initializes the JVM) threads would not be able to find any user-define class.
    Here are the symptoms and observations:
    1. JNIEnv::ExceptionDescribe() showed the following StackOverflowError:
    Exception in thread "Thread-0" java.lang.StackOverflowError
            at java.util.Arrays.copyOf(Arrays.java:2734)
            at java.util.Vector.ensureCapacityHelper(Vector.java:226)
            at java.util.Vector.addElement(Vector.java:573)
            at java.lang.ClassLoader.addClass(ClassLoader.java:173)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
            at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)2. The "main thread" that instantiates the JVM has no problem finding and loading any class or method
    3. But the other threads (non-main threads) would not be able to find the user-defined classes unless the classes were already loaded by the main thread.
    4. The non-main threads can find the "standard" java classes with no problem
    5. The same app ran fine on 32-bit system.
    6. Except for the JVM reference is global, each thread acquired JNIEnv by either GetEnv() or AttachCurrentThread().
    Any idea why it is a problem with 64-bit?
    I have the sample program to reproduce this issue in this thread: http://forums.sun.com/thread.jspa?messageID=10885363&#10885363. That was the original thread I raised but I have narrowed it down to a more concrete scenario. That's why I am creating this new thread. I hope this does not break any rule on this forum. If it does, I apologize.
    I really appreciate it if anyone can provide any help/suggestion.
    Regards,
    - Triet

    Here is the sample program. Again, this works on 32-bit but not 64-bit.
    #include <string>
    #include "jni.h"
    #include "TestThread.h"
    static JavaVM *g_pjvm = NULL;  /* denotes a Java VM */
    static JNIEnv *g_penv = NULL;  /* pointer to native method interface */
    void initJVM(char** jvmOptions) {
        printf("RJniTest init starts...\n");
        JavaVMInitArgs vm_args; /* JDK/JRE 6 VM initialization arguments */
        JavaVMOption* poptions;
        int optionLen = 0;
        while (jvmOptions[optionLen]) {
            optionLen++;
        printf("RJniTest::init len=%d\n", optionLen);
        if (optionLen > 0) {
            printf("RJniWrapper::init jvmOptions\n");
            poptions = new JavaVMOption[optionLen];
            //poptions[0].optionString = "-Djava.class.path=/usr/lib/java";
            int idx = 0;
            while (jvmOptions[idx]) {
                poptions[idx].optionString = jvmOptions[idx];
                idx++;
        printf("RJniTest::init vm_args: version(%x), nOptions(%d)\n",
                JNI_VERSION_1_6, optionLen);
        vm_args.version = JNI_VERSION_1_6;
        vm_args.nOptions = optionLen;
        vm_args.options = poptions;
        vm_args.ignoreUnrecognized = JNI_FALSE;
        // load and initialize a Java VM, return a JNI interface
        // pointer in env
        printf("RJniTest::init creates JVM\n");
        JNI_CreateJavaVM(&g_pjvm, (void**)&g_penv, &vm_args);
        printf("RJniTest init ends\n");
    void findClass(const char* classname) {
        static const char* fname = "justFindClasses";
        printf("%s: findClass: %s\n", fname, classname);
        JNIEnv* jenv;
        jint ret = g_pjvm->GetEnv((void**)&jenv, JNI_VERSION_1_6);
        if (ret == JNI_EDETACHED) {
            ret = g_pjvm->AttachCurrentThread((void**)&jenv, NULL);
            if (ret != JNI_OK || jenv == NULL) {
                printf("%s: get env error: ret=%d\n", ret, fname);
            } else {
                printf("%s: got new env\n", fname);
        } else if (ret == JNI_OK) {
            printf("%s: env already there\n");
        jclass classref;
        classref = jenv->FindClass(classname);
        if (classref == NULL) {
            printf("%s: %s class not found!\n", fname, classname);
            if (jenv->ExceptionOccurred()) {
                jenv->ExceptionDescribe();
                jenv->ExceptionClear();
        printf("%s: found class: %s\n", fname, classname);
    class RJniTestThread : public TestThread {
    public:
        void threadmain();
    void RJniTestThread::threadmain() {
        printf("RJniTestThread::threadmain: Starting testing\n");
        findClass("org/apache/commons/logging/Log");
        findClass("java/util/List");
        printf("RJniTestThread::threadmain: done.\n");
    int main(int argc, char** argv) {
        char **jvmOptions = NULL;
        printf("RJniTestDriver starts...\n");
        if (argc > 1) {
            jvmOptions = new char*[argc];
            for (int i = 0; i < argc ; i ++) {
                jvmOptions[i] = argv[i + 1];
            jvmOptions[argc - 1] = NULL;
        } else {
            int size = 8;
            int i = 0;
            jvmOptions = new char*[size];
            jvmOptions[i++] = (char*) "-Djava.class.path=<list of jar files and path here>";
            jvmOptions[i++] = (char*) "-Djava.library.path=/sandbox/mxdev/3rdparty/java/unix/jdk1.6.0_14/jre/lib/sparc";
            jvmOptions[i++] = (char*) "-Djava.compiler=NONE";
            jvmOptions[i++] = (char*) "-verbose:jni";
            jvmOptions[i++] = (char*) "-Xcheck:jni";
            jvmOptions[i++] = NULL;
        printf("init JVM\n");
        initJVM(jvmOptions);
        // UNCOMMENT HERE
        // findClass("org/apache/commons/logging/Log");
        // findClass("java/util/List");
        // UNCOMMENT END
        printf("start test thread\n");
        RJniTestThread testThread;
        ThreadId tid = testThread.launch();
        printf("wait for test thread\n");
        int ret = pthread_join(tid, NULL);
        printf("RJniTestDriver ends\n");
    }

  • Seam on Weblogic 10.3.2: Possible classloader problem?

    Hi all,
    I have a problem deploying a Seam 2.2.0.GA application on WebLogic 10.3.2. I use JRockit 1.6.0_14, Richfaces 3.2.0.GA and Facelets 1.1.14 and the Server is deployed on Windoes XP 32bit. The application has the following structure:
    application.ear
    |--> APP-INF
    | |--> classes
    | |--> lib (all jar dependencies go here, including the WAR dependencies, EJB module dependencies)
    |-->META_INF
    | |--> application.xml
    | |--> data-sources.xml
    | |--> MANIFEST.MF
    | |--> weblogic.xml
    | |--> weblogic-application.xml
    |--> jboss-seam-2.2.0.GA.jar (is an EJB module)
    |--> myEjbModule1.jar
    |--> myEjbModule2.jar
    |--> myEjbModule3.jar
    |--> myEjbModule4.jar
    |--> myWar.war (NO libraries in WEB-INF/lib, finds everything in EAR/lib)
    JBoss Seam is an EJB module. and is declared as such in application.xml. Everything is OK, since the application loads correctly. The jar contains a faces.config registering the SeamPhaseListener on JSF, so that Seam actually works.
    Problems start when I try to enable the debug page of Seam. In order to do this, one must include in the classpath the jboss-seam-debug.jar (in APP-INF/lib or EAR/lib, here I am using the first). This jar has its own faces.config, which registers the Seam*Debug*PhaseListener on JSF, so that it catches debug requests.
    When deploying WITH jboss-seam-debug.jar, the application does not appear, but ONLY the debug page with the following exception (stacktrace at the end):
    Exception during request processing:
    Caused by java.lang.IllegalStateException with message: "No phase id bound to current thread (*make sure you do not have two SeamPhaseListener instances installed*)"
    This probably signifies a classloader issue. So, I have two questions:
    1. Has anyone deployed JBoss Seam on WenLogic WITH the debug page? If yes, is the structure of my project correct?
    2. Is there a way to debug the classloading of WebLogic? What I would find helpful would be to see what happens that registers the SeamPhaseListener more than one times.
    Note: When "JBoss-izing" the same EAR (remove hibernate jars, which are provided by JBoss, and move all libraries from EAR/lib to EAR root), the application loads correctly. BOTH the application AND the debug page appear correctly.
    Edited by: user6410241 on Mar 24, 2010 8:14 AM
    Edited by: user6410241 on Mar 24, 2010 8:26 AM

    The problem was the name of the Seam EJB module. Changing the jar to jboss-seam.jar, everything worked. This issue does not appear on JBoss 4.2.3.GA, where I also tested.
    Edited by: deadlock_gr on Jun 10, 2010 9:55 AM
    Edited by: deadlock_gr on Jun 10, 2010 9:56 AM

  • Classloader won't let me delete jar file!

    Hi-
    I am writing a classloader that runs main from a class called MyMain. MyMain loads classes from a jar file called MattTable.jar. I need to be able to delete the jar file once the classes are loaded from it, or even just delete it at the end of the program. Either way, the classloader will not release it so I cannot delete the jar file until after my program finishes. I want to be able to delete it from with in my code after the method is invoked.
    URL urls[] = new URL[] { new File(".").toURL() };
    URLClassLoader loader = new URLClassLoader( urls );
    Class c = loader.loadClass(mainClass);
    Method m1 = c.getMethod("main", new Class[] { args.getClass() });
    //main loads classes from an outside jar file
    m1.invoke( null, new Object[] {args} );
    //Here is where I want to delete the jar file
    //I would even accept file.deleteOnExit() but this won't work either
    If anyone can help me figure out how to delete this file, it would be a great help!
    Thanks,
    Matt

    Hi,
    I've created a small classloader for jar files which releases the handle every time a class is loaded. It might still need some optimization, but at least it works:import java.util.zip.*;
    import java.util.*;
    import java.io.*;
    public class ZipClassLoader extends ClassLoader {
         private Hashtable classes = new Hashtable();
         private File f;
         public ZipClassLoader(String zipFileName) {
              this (new File(zipFileName));
         public ZipClassLoader(File zipFile) {
              f = zipFile;
         public Class loadClass(String className) throws ClassNotFoundException {
              return (loadClass(className, true));
         public synchronized Class loadClass(String className, boolean resolve) throws ClassNotFoundException {
              if (classes.containsKey(className)) return (Class)classes.get(className);
              ZipFile zipFile = null;
              BufferedInputStream bis = null;
              byte[] res = null;
              try {
                   zipFile = new ZipFile(f);
                   ZipEntry zipEntry = zipFile.getEntry(className.replace('.', '/')+".class");
                   res = new byte[(int)zipEntry.getSize()];
                   bis = new BufferedInputStream(zipFile.getInputStream(zipEntry));
                   bis.read(res, 0, res.length);
              } catch (Exception ex) {
              } finally {
                   if (bis!=null) {
                        try {
                             bis.close();
                        } catch (IOException ioex) {}
                   if (zipFile!=null) {
                        try {
                             zipFile.close();
                        } catch (IOException ioex) {}
              if (res == null) return super.findSystemClass(className);
              Class clazz = defineClass(className, res, 0, res.length);
              if (clazz == null) throw new ClassFormatError();
              if (resolve) resolveClass(clazz);
              classes.put(className, clazz);
              return(clazz);
    }This is the test program I've created. It loads a class from the Apache log4j jar file, and deletes the file when the class is loaded:import java.io.File;
    public class Test {
         public static void main(String[] args) throws Exception {
              File f = new File("C:\\jartest\\log4j-1.2.6.jar");
              ZipClassLoader zl = new ZipClassLoader (f);
              Class c = zl.loadClass ("org.apache.log4j.ConsoleAppender", true);
              Object o = c.newInstance();
              System.out.println (o.getClass().getName());
              f.delete();
    }

  • Problem with XMLDecoder and a custom ClassLoader

    NOTE: Posted over in Serialization forum as more appropriate there, sorry for the crosspost but didn't notice that forum at first. Please direct any replies there.
    I am implementing an application based around Java Plugin Framework (jpf.sourceforge.net). In short one consequence of this framework is that each plugin uses its own classloader with scope of that plugins classes.
    One plugin I am using requires the ability to deserialize objects from a javabean xml file. I am using XMLDecoder to do this, and I used the constructor to pass the current plugin ClassLoader to it.
    This however only partially seems to work, this is a shortened extract from an example xml
    <java version="1.5.0" class="java.beans.XMLDecoder">
    <object class="usermanager.javabeans.BeanUser">
      <string>drftpd</string>
      <void property="downloadedBytes">
       <long>737132544</long>
      </void>
      <void property="hostMaskCollection">
       <void method="add">
        <object class="usermanager.HostMask">
         <string>*@*</string>
        </object>
       </void>
      </void>
       <void property="keyedMap">
       <void method="put">
        <object class="dynamicdata.Key">
         <class>commands.UserManagement</class>
         <string>slots</string>
         <class>java.lang.Integer</class>
        </object>
        <int>0</int>
       </void>
    etc...Now without passing XMLDecoder a ClassLoader as would be expected I get a ClassNotFoundException for the first <object>.
    However if I pass XMLDecoder the correct ClassLoader it reads the xml fine until it reaches <class>commands.UserManagement</class> at which point again I get a ClassNotFoundException.
    Here is the stacktrace from that exception:
    java.lang.ClassNotFoundException: commands.UserManagement
         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:242)
         at com.sun.beans.ObjectHandler.classForName(ObjectHandler.java:67)
         at com.sun.beans.ObjectHandler.classForName(ObjectHandler.java:54)
         at java.beans.Statement.invoke(Statement.java:140)
         at java.beans.Expression.getValue(Expression.java:98)
         at com.sun.beans.MutableExpression.getValue(ObjectHandler.java:400)
         at com.sun.beans.ObjectHandler.getValue(ObjectHandler.java:106)
         at com.sun.beans.ObjectHandler.endElement(ObjectHandler.java:327)
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:625)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1241)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
         at javax.xml.parsers.SAXParser.parse(SAXParser.java:344)
         at javax.xml.parsers.SAXParser.parse(SAXParser.java:120)
         at java.beans.XMLDecoder.readObject(XMLDecoder.java:205)
         at usermanager.javabeans.BeanUserManager.loadUser(BeanUserManager.java:128)
    Now after looking through some of the source it appears to me at least that XMLDecoder when processing an <object> uses an ObjectHandler with the ClassLoader as a parameter, however a class contained within a <class> element gets handled by Statement.invoke() which uses an ObjectHandler without a ClassLoader specified thus using the standard ClassLoader.
    I've managed to work around it for now by setting the contextClassLoader to the correct one before calling readObject() in XMLDecoder and then reverting it back immediately after, but this feels like somewhat of a hack to me.
    I would've expected it to have been properly handled when passing the ClassLoader to XMLDecoder rather than like it is.
    Anyone know if this is intended behaviour or a bug? and if the former is there any recommended way to deal with this other than the one I'm currently using.
    NOTE: Posted over in Serialization forum as more appropriate there, sorry for the crosspost but didn't notice that forum at first. Please direct any replies there.
    Message was edited by:
    djb61
    NOTE: Reposting to Serialization

    You can provide a cell renderer to the JTree to paint the checkBox.
    The following code checks or unchecks the box with each click also:
    _tree.setCellRenderer(new DefaultTreeCellRenderer()
      private JCheckBox checkBox = null;
      public Component getTreeCellRendererComponent(JTree tree,
                                                    Object value,
                                                    boolean selected,
                                                    boolean expanded,
                                                    boolean leaf,
                                                    int row,
                                                    boolean hasFocus)
        // Each node will be drawn as a check box
        if (checkBox == null)
          checkBox  = new JCheckBox();
          checkBox .setBackground(tree.getBackground());
        DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
        checkBox.setText(node.getUserObject().toString());
        checkBox.setSelected(selected);
        return checkBox;
    });

  • Problem with classloader (for shared-lib's) on oc4j 10.0.3.4 under jdk 1.5

    I have a project that runs great on oc4j 10.0.3.4 under jdk 1.6. (everything worked great)
    I recently tried to run it under jdk 1.5 and i've run into a little problem with the shared-lib's:
    The classloader's debug file reports the following: (i have translated some of it)
    Class error: oracle.classloader.util.AnnotatedNoClassDefFoundError:
         Missing class: javax.xml.bind.JAXBContext
    Dependant class: nl.comp.util.XmlUtil
         Classloader: comp:0.1
         Code-source: /C:/programs/oc4j/j2ee/home/shared-lib/comp/0.1/comp.jar
         Configuration: <code-source> in /c:/programs/oc4j/j2ee/home/config/server.xml
    The missing class is available from the following location:
         1. Code-source: /C:/programs/oc4j/lib/xml.jar (from <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in C:\programs\oc4j\j2ee\home\oc4j.jar)
    This code-source is available from classloader oracle.xml:10.1.0_2
         2. Code-source: /C:/programs/oc4j/j2ee/home/shared-lib/jaxb/2.1.6/jaxb-api.jar (from <code-source> in /c:/programs/oc4j/j2ee/home/config/server.xml)
    This code-source is available from classloader jaxb:2.1.6.
    So the classloader knows where to find the necessary lib, but it isn't loading it? If i run the exact same code (with same descriptors and everything) under jdk 1.6, it works, under 1.5 i get the above error.
    What is different on the class loader level between the two jdk versions that might affect the program in such a way?
    Need i update a descriptor or do something else?

    Jack,
    Not a definitive answer for you (sorry), just a few suggestions (that I assume you are unaware of).
    1. Try unsetting your "ClassPath" variable. Open a "command" window and type the following:
    set ClassPath=2. Launch OC4J from the directory where the "oc4j.jar" file is located, for example:
    D:
    cd oc4j\j2ee\home
    java -jar oc4j.jar3. I'm just guessing, but if your drive "D:" is a mapped, network drive, this may be causing the problem. Perhaps try installing OC4J on a local drive?
    Hope this helps.
    Good Luck,
    Avi.

  • Servicegen:  unable to load type library from classloader weblogic.utils.cl

    Hi,
    I am new to weblogic. I am encountering an error on trying to run the 'servicegen' command from my ant build scripts, on weblogic 9.2.
    Please find the build.xml snapshot, and the stack trace given below.
    Please help me out with this.
    Points to be noted are:-
    1) The ejb-jar.xml specifies the bean class, which is very much present in the classpath. The ejb-jar.xml is generated by xdoclet. Snapshot is given below:-
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar >
    <description><![CDATA[No Description.]]></description>
    <display-name>Generated by XDoclet</display-name>
    <enterprise-beans>
    <!-- Session Beans -->
    <session >
    <description><![CDATA[NorthBound Interface]]></description>
    <ejb-name>ArcorNBIService</ejb-name>
    <home>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceHome</home>
    <remote>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIService</remote>
    <local-home>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceLocalHome</local-home>
    <local>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceLocal</local>
    <ejb-class>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    2) When I replace the "ejbJar" attribute in the 'service' command with "javaClassComponents" attribute, I am able to run the servicegen command successfully. Not sure why the ejbJar is creating problems.
    3) Build.xml snapshot:-
         <target name="gen-webservice" depends="init">
              <copy todir="${work.dir}" file="${export.dir}/lib/arcor-il-service-ejb.jar"/>
              <autotype javatypes="${javatypes}" targetNamespace="${targetNamespace}" destDir="${work.dir}/classes" keepGenerated="${keepGenerated}" classpathref="webservice.client.classpath"/>
              <autotype javaComponents="com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIService" targetNamespace="com.alcatel.hdm.service.nbi.dto.holders" destDir="${work.dir}/classes" keepGenerated="true" classpathref="webservice.client.classpath"/>
              <servicegen destEar="${earfile}" warName="${warname}" contextURI="${contextURI}" keepGenerated="${keepGenerated}" classpathref="webservice.client.classpath">
                   <service ejbJar="${ejbLocation}" targetNamespace="${targetNamespace}" serviceName="${serviceName}" serviceURI="/${serviceName}" generateTypes="false" expandMethods="${expandMethods}" ignoreAuthHeader="false" protocol="https" style="rpc" useSOAP12="${useSOAP12}" typeMappingFile="${work.dir}/classes/types.xml">
                        <security enablePasswordAuth="true"/>
                   </service>
              </servicegen>
         </target>
    4) Exception stacktrace:-
    --- Nested Exception ---
    java.lang.AssertionError: java.io.IOException
    at weblogic.descriptor.DescriptorManager$DefaultMarshallerFactorySingleton.<clinit>(DescriptorManager.java:42)
    at weblogic.descriptor.DescriptorManager.getDefaultMF(DescriptorManager.java:116)
    at weblogic.descriptor.DescriptorManager.getMarshallerFactory(DescriptorManager.java:125)
    at weblogic.descriptor.DescriptorManager.getDescriptorFactory(DescriptorManager.java:153)
    at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:277)
    at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:248)
    at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:309)
    at weblogic.descriptor.EditableDescriptorManager.createDescriptor(EditableDescriptorManager.java:99)
    at weblogic.application.descriptor.AbstractDescriptorLoader.createDescriptor(AbstractDescriptorLoader.java:344)
    at weblogic.application.descriptor.CachingDescriptorLoader.createDescriptor(CachingDescriptorLoader.java:188)
    at weblogic.application.descriptor.AbstractDescriptorLoader.createDescriptor(AbstractDescriptorLoader.java:328)
    at weblogic.application.descriptor.AbstractDescriptorLoader.getDescriptor(AbstractDescriptorLoader.java:237)
    at weblogic.application.descriptor.AbstractDescriptorLoader.getRootDescriptorBean(AbstractDescriptorLoader.java:217)
    at weblogic.ejb.spi.EjbJarDescriptor.getEjbJarBean(EjbJarDescriptor.java:141)
    at weblogic.ejb.spi.EjbJarDescriptor.getEditableEjbJarBean(EjbJarDescriptor.java:182)
    at weblogic.ejb.container.dd.xml.DDUtils.processEjbJarXMLWithSchema(DDUtils.java:519)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:182)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:126)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:154)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:147)
    at weblogic.ejb.spi.DDUtils.createDescriptorFromJarFile(DDUtils.java:30)
    at weblogic.webservice.dd.EJBJarIntrospector.<init>(EJBJarIntrospector.java:52)
    at weblogic.ant.taskdefs.webservices.autotype.EJBAutoTyper.<init>(EJBAutoTyper.java:68)
    at weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask.runAutoTyper(ServiceGenTask.java:339)
    at weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask.generateService(ServiceGenTask.java:313)
    at weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask.execute(ServiceGenTask.java:181)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    at org.apache.tools.ant.Task.perform(Task.java:364)
    at org.apache.tools.ant.Target.execute(Target.java:341)
    at org.apache.tools.ant.Target.performTasks(Target.java:369)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
    at org.apache.tools.ant.Main.runBuild(Main.java:668)
    at org.apache.tools.ant.Main.startAnt(Main.java:187)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
    Caused by: java.io.IOException
    at weblogic.descriptor.internal.MarshallerFactory.<init>(MarshallerFactory.java:50)
    at weblogic.descriptor.DescriptorManager$DefaultMarshallerFactorySingleton.<clinit>(DescriptorManager.java:40)
    ... 37 more
    Caused by: com.bea.xml.XmlException: unable to load type library from classloader weblogic.utils.classloaders.ClasspathClassLoader@1cc0a7f f
    inder: weblogic.utils.classloaders.CodeGenClassFinder@c52200 annotation:
    at com.bea.staxb.runtime.internal.BindingContextFactoryImpl.createBindingContext(BindingContextFactoryImpl.java:50)
    at weblogic.descriptor.internal.MarshallerFactory.<init>(MarshallerFactory.java:48)
    ... 38 more
    Total time: 5 seconds

    Hi,
    I am new to weblogic. I am encountering an error on trying to run the 'servicegen' command from my ant build scripts, on weblogic 9.2.
    Please find the build.xml snapshot, and the stack trace given below.
    Please help me out with this.
    Points to be noted are:-
    1) The ejb-jar.xml specifies the bean class, which is very much present in the classpath. The ejb-jar.xml is generated by xdoclet. Snapshot is given below:-
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar >
    <description><![CDATA[No Description.]]></description>
    <display-name>Generated by XDoclet</display-name>
    <enterprise-beans>
    <!-- Session Beans -->
    <session >
    <description><![CDATA[NorthBound Interface]]></description>
    <ejb-name>ArcorNBIService</ejb-name>
    <home>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceHome</home>
    <remote>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIService</remote>
    <local-home>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceLocalHome</local-home>
    <local>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceLocal</local>
    <ejb-class>com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIServiceBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    2) When I replace the "ejbJar" attribute in the 'service' command with "javaClassComponents" attribute, I am able to run the servicegen command successfully. Not sure why the ejbJar is creating problems.
    3) Build.xml snapshot:-
         <target name="gen-webservice" depends="init">
              <copy todir="${work.dir}" file="${export.dir}/lib/arcor-il-service-ejb.jar"/>
              <autotype javatypes="${javatypes}" targetNamespace="${targetNamespace}" destDir="${work.dir}/classes" keepGenerated="${keepGenerated}" classpathref="webservice.client.classpath"/>
              <autotype javaComponents="com.alcatel.hdm.arcoril.webservice.ejb.ArcorNBIService" targetNamespace="com.alcatel.hdm.service.nbi.dto.holders" destDir="${work.dir}/classes" keepGenerated="true" classpathref="webservice.client.classpath"/>
              <servicegen destEar="${earfile}" warName="${warname}" contextURI="${contextURI}" keepGenerated="${keepGenerated}" classpathref="webservice.client.classpath">
                   <service ejbJar="${ejbLocation}" targetNamespace="${targetNamespace}" serviceName="${serviceName}" serviceURI="/${serviceName}" generateTypes="false" expandMethods="${expandMethods}" ignoreAuthHeader="false" protocol="https" style="rpc" useSOAP12="${useSOAP12}" typeMappingFile="${work.dir}/classes/types.xml">
                        <security enablePasswordAuth="true"/>
                   </service>
              </servicegen>
         </target>
    4) Exception stacktrace:-
    --- Nested Exception ---
    java.lang.AssertionError: java.io.IOException
    at weblogic.descriptor.DescriptorManager$DefaultMarshallerFactorySingleton.<clinit>(DescriptorManager.java:42)
    at weblogic.descriptor.DescriptorManager.getDefaultMF(DescriptorManager.java:116)
    at weblogic.descriptor.DescriptorManager.getMarshallerFactory(DescriptorManager.java:125)
    at weblogic.descriptor.DescriptorManager.getDescriptorFactory(DescriptorManager.java:153)
    at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:277)
    at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:248)
    at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:309)
    at weblogic.descriptor.EditableDescriptorManager.createDescriptor(EditableDescriptorManager.java:99)
    at weblogic.application.descriptor.AbstractDescriptorLoader.createDescriptor(AbstractDescriptorLoader.java:344)
    at weblogic.application.descriptor.CachingDescriptorLoader.createDescriptor(CachingDescriptorLoader.java:188)
    at weblogic.application.descriptor.AbstractDescriptorLoader.createDescriptor(AbstractDescriptorLoader.java:328)
    at weblogic.application.descriptor.AbstractDescriptorLoader.getDescriptor(AbstractDescriptorLoader.java:237)
    at weblogic.application.descriptor.AbstractDescriptorLoader.getRootDescriptorBean(AbstractDescriptorLoader.java:217)
    at weblogic.ejb.spi.EjbJarDescriptor.getEjbJarBean(EjbJarDescriptor.java:141)
    at weblogic.ejb.spi.EjbJarDescriptor.getEditableEjbJarBean(EjbJarDescriptor.java:182)
    at weblogic.ejb.container.dd.xml.DDUtils.processEjbJarXMLWithSchema(DDUtils.java:519)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:182)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:126)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:154)
    at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:147)
    at weblogic.ejb.spi.DDUtils.createDescriptorFromJarFile(DDUtils.java:30)
    at weblogic.webservice.dd.EJBJarIntrospector.<init>(EJBJarIntrospector.java:52)
    at weblogic.ant.taskdefs.webservices.autotype.EJBAutoTyper.<init>(EJBAutoTyper.java:68)
    at weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask.runAutoTyper(ServiceGenTask.java:339)
    at weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask.generateService(ServiceGenTask.java:313)
    at weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask.execute(ServiceGenTask.java:181)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    at org.apache.tools.ant.Task.perform(Task.java:364)
    at org.apache.tools.ant.Target.execute(Target.java:341)
    at org.apache.tools.ant.Target.performTasks(Target.java:369)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
    at org.apache.tools.ant.Main.runBuild(Main.java:668)
    at org.apache.tools.ant.Main.startAnt(Main.java:187)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
    Caused by: java.io.IOException
    at weblogic.descriptor.internal.MarshallerFactory.<init>(MarshallerFactory.java:50)
    at weblogic.descriptor.DescriptorManager$DefaultMarshallerFactorySingleton.<clinit>(DescriptorManager.java:40)
    ... 37 more
    Caused by: com.bea.xml.XmlException: unable to load type library from classloader weblogic.utils.classloaders.ClasspathClassLoader@1cc0a7f f
    inder: weblogic.utils.classloaders.CodeGenClassFinder@c52200 annotation:
    at com.bea.staxb.runtime.internal.BindingContextFactoryImpl.createBindingContext(BindingContextFactoryImpl.java:50)
    at weblogic.descriptor.internal.MarshallerFactory.<init>(MarshallerFactory.java:48)
    ... 38 more
    Total time: 5 seconds

  • HOT Redeployment of EAR fails with Classloader error

    App Server: WLS 10.3
    OS: Solaris 9
    I have installed WLS installed with a domain, admin and a managed server. Everything is working fine.
    I have WAR and EAR deployed successfully on the Managed Server.
    HOT deployment of WAR files works perfectly fine.
    There is this EAR "IIA.ear" with @ 8 WAR files and 1 jar "Manager.jar". The EAR has been deployed in the "nostage" mode.
    I do not have any separate "Deployment" plan.
    In order to "redeploy" the EAR I go to the Admin console >> Deployments >> Select the EAR >> update >> Source Path remains the same >> Finish
    I get the following error :
    +#####################+
    weblogic.application.CannotRedeployException: Module 'Manager.jar' has the same ClassLoader as the Application 'IIA'. Consider redeploying the entire application.
    Update operation failed - no deployments changed.
    +#####################+
    The log files shows below error
    +#####################+
    +<Sep 15, 2009 9:18:52 AM MEST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with+
    ID '1252999132033' for task '8'. Error is: 'weblogic.application.CannotRedeployException: Module 'Manager.jar' has the
    same ClassLoader as the Application 'IIA'. Consider redeploying the entire application.'
    weblogic.application.CannotRedeployException: Module 'Manager.jar' has the same ClassLoader as the Application 'IIA'. Consider redeploying the entire application.
    at weblogic.application.internal.AppClassLoaderManagerImpl.updatePartialDeploySet(AppClassLoaderManagerImpl.java:299)
    at weblogic.application.internal.flow.TailModuleRedeployFlow.validateClassLoaderStructure(TailModuleRedeployFlow.java
    +:135)+
    at weblogic.application.internal.flow.TailModuleRedeployFlow.validateRedeploy(TailModuleRedeployFlow.java:97)
    at weblogic.application.internal.BaseDeployment$ValidateRedeployStateChange.next(BaseDeployment.java:801)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    Truncated. see log file for complete stacktrace
    +>+
    +#####################+
    does WLS 10 supports HOT deployment of EAR files? Is it any issue with "Class Loading"? Anything to be changed to make this HOT redeployment successful?

    App Server: WLS 10.3
    OS: Solaris 9
    I have installed WLS installed with a domain, admin and a managed server. Everything is working fine.
    I have WAR and EAR deployed successfully on the Managed Server.
    HOT deployment of WAR files works perfectly fine.
    There is this EAR "IIA.ear" with @ 8 WAR files and 1 jar "Manager.jar". The EAR has been deployed in the "nostage" mode.
    I do not have any separate "Deployment" plan.
    In order to "redeploy" the EAR I go to the Admin console >> Deployments >> Select the EAR >> update >> Source Path remains the same >> Finish
    I get the following error :
    +#####################+
    weblogic.application.CannotRedeployException: Module 'Manager.jar' has the same ClassLoader as the Application 'IIA'. Consider redeploying the entire application.
    Update operation failed - no deployments changed.
    +#####################+
    The log files shows below error
    +#####################+
    +<Sep 15, 2009 9:18:52 AM MEST> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with+
    ID '1252999132033' for task '8'. Error is: 'weblogic.application.CannotRedeployException: Module 'Manager.jar' has the
    same ClassLoader as the Application 'IIA'. Consider redeploying the entire application.'
    weblogic.application.CannotRedeployException: Module 'Manager.jar' has the same ClassLoader as the Application 'IIA'. Consider redeploying the entire application.
    at weblogic.application.internal.AppClassLoaderManagerImpl.updatePartialDeploySet(AppClassLoaderManagerImpl.java:299)
    at weblogic.application.internal.flow.TailModuleRedeployFlow.validateClassLoaderStructure(TailModuleRedeployFlow.java
    +:135)+
    at weblogic.application.internal.flow.TailModuleRedeployFlow.validateRedeploy(TailModuleRedeployFlow.java:97)
    at weblogic.application.internal.BaseDeployment$ValidateRedeployStateChange.next(BaseDeployment.java:801)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
    Truncated. see log file for complete stacktrace
    +>+
    +#####################+
    does WLS 10 supports HOT deployment of EAR files? Is it any issue with "Class Loading"? Anything to be changed to make this HOT redeployment successful?

  • Loading an entire JAR via a classloader

    Hi how would I load an entire JAR file via a classloader. Currently I'm able to load one file at a time (in this case org.w3c.dom.Node) as shown below:
    import java.net.*;
    public class MyJarLoader {
       public static void main(String [] args) throws Exception {
         URL[] urlsToLoadFrom = new URL[]{new URL("file:subdir3/xml-apis.jar")};
         URLClassLoader loader1 = new URLClassLoader(urlsToLoadFrom);
         Class cls1 = Class.forName("org.w3c.dom.Node", true, loader1);
         System.out.println("Loaded '"+cls1.getName()+"'");
         org.w3c.dom.Node Node = (org.w3c.dom.Node) cls1.newInstance();
    Thanks

    Figured this one out as below. Note this is the simplistic solution since it requires that the jar files be present in the classpath. If not, you will have to write your own loadClass method to read the data from the zip (& then can't use the method 'Class.forName()').
    Regards
    //Load Apache JAR files
    URL[] urlArrToLoadFrom = new URL[]{new URL("file:xalan-j_2_5_0/xml-apis.jar"),
                new URL("file:xalan-j_2_5_0/xercesImpl.jar"), new URL("file:xalan-j_2_5_0/xalan.jar")};
    //Create a URLClassLoader to access jar files
    URLClassLoader urlLoaderGeneric = new URLClassLoader(urlArrToLoadFrom);
    //Foreach jar file, open, load class files & close
    for(int i=0; i<urlArrToLoadFrom.length; i++) {
    //Debug
       System.out.println(urlArrToLoadFrom.toString());
       //Open zip file
       ZipFile zf = new ZipFile(urlArrToLoadFrom[i].getFile());
       for (Enumeration enum = zf.entries(); enum.hasMoreElements();) {
         //Get entry
         ZipEntry ze = (ZipEntry) enum.nextElement();
         //Only load if it's not a directory and it's a class file
         int iIndexClass = -1;
         if (!ze.isDirectory() && ((iIndexClass = ze.getName().indexOf(".class")) != -1)) {
             //Remove .class & replace / with .
             String strApacheClassName = (ze.getName().substring(0,iIndexClass)).replace('/','.');
             //Load class file
             Class classApache = Class.forName(strApacheClassName, true, urlLoaderGeneric);
             System.out.println("Loaded '"+classApache.getName()+"'");
       //Close zip
       zf.close();

  • Loading a jar via a custom classloader

    Hi,
    I have written a custom class loader that allows me to load a compiled java program as a collection of class files at runtime.
    This is nice however I now need to consider the runtime execution of more complex java programs that have custom library dependencies.
    This means loading a .jar library into the classloader. I can get the contents of a jar and load specific classes by name via reflection but I want to load the entire jar into the classloader so that its contents can be used 'as needed' much like a jar on the system classpath.
    Is this possible? If so I would like to know how as I have been struggling with this problem and cannot see a solution.
    Regards,
    Stephen

    However I still don't understand why you need to
    actually load all those classes initially. Afterall,
    URLClassLoader (which sounds a lot like what youare
    describing) only loads classes as needed.i have just built a swing app that accesses an oracle
    database, i jared together all the classes, and i did
    something in the manfest file so that you can just
    double clisk the jar and it fires up like an exe.
    doing it this way everything is fine except it cannot
    access the database, the reason is those oracle
    classes are not loaded, even they are on the path - i
    can run the app using a batch file but i dont like it
    as it opens up a dos window. this is an example, as i
    was told, where it is necessary to load all thoses
    oracle database classes initially. Dear, daFei.
    I believe that you are getting confused between the way the system will ignore that CLASPPATH environment variable when you run a java application packaged as a jar file with the -jar switch (the classpath for the jar can be set in the manifest) and what I am attempting to-do which is to run a compiled java program at runtime and dynamically load any dependant libraries.
    Stephen

Maybe you are looking for