Classloading Problem.

Hi All,
I am having some issues with classloading. Can someone help me with my query below.
I have the same library in ejb container as well as the web container. When a request comes in via URL.How a request is processed? Is the library from ejb container loaded first or the library from web contaner is loaded First???
Thanks ,
Mukul.

Hi Kaj
Yes, no problems there. I can list the contents, extract class files etc just as you'd expect using jar
I agree with you, initially i thought the jar file must be corrupt in some way but seems not.
Any other ideas?

Similar Messages

  • PortableRemoteObject ClassLoader problems in pe8.1

    Hi, I'm in the process of porting a Sun Java Application Server 7 to 8.1 PE and I'm running into ClassLoader problems when I make remote calls into the server. The situation is a little odd in that I've exported a PortableRemoteObject from the BootstrapServlet (too many reasons to go into detail, but it all worked in 7 just fine). Most of the calls I make into the remove server work fine, exception I get ClassNotFound exceptions in the strangest places. For example, I have a SearchCriteria class that I pass as a parameter. It makes it to the server. But, its inner class, Constraint which is static and Serializable, gets a ClassNotFoundException. So I made it Externalizable and finally figured out what was going on.
    The SearchCriteria class loader was set to the WebappClassLoader. But the ObjectInput of readObject was set to AppClassLoader. Now why the AppClassLoader could find SearchCriteria and not its nested class, I do not know.
    So my question is, is there any way to tell the ORB to use the WebappClassLoader instead of the AppClassLoader?

    More information. If I update the calling threads class loader to be the same as the objects class loader, the unaccessible classes can be loaded.
      public void readExternal(ObjectInput in)  throws IOException, ClassNotFoundException
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());Does this make sense? Seems so out of place.

  • 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

  • Apache fop classloading problem in EAR file

    HI,
    I am deploying a big EAR in WL 6.1 on solaris and I am bundling FOP 1.20.3
    within it, I am
    also including avalon 4.0 and logkit 1.0 jars within it as they are needed by
    fop.jar. Whenever I
    try to construct a "Driver()" class I get a NoClassDefFoundError on the org.apache.framework.logger.Loggable
    interface that it needs. The strange thing is that when I do the following :
    try {
    ClassLoader cl = this.getClass().getClassLoader();
    cl.loadClass("org.apache.avalon.framework.logger.Loggable"); // .........this
    works OK
    // the following .... fails with NoClassDefFoundError on Loggable
    org.apache.fop.apps.Driver d = new org.apache.fop.apps.Driver();
    } catch (Throwable t) {
    cat.error("failed:", t);
    It DOES work when I put the necessary jars on the server startup class path,
    however it would obviously be
    better to be able to bundle the 3rd party jars within my EAR ....... I know this
    seems like it would be a general
    weblogic classloader question - but I have had no problems with any other 3rd
    party jars that are similar to
    this one.
    Has anyone else had these kinds of problems ?
    Cheers,
    Brian.

    Dear Brian,
    It looks to me like org.apache.fop.apps.Driver might be doing a
    Class.forName() for the Loggable class. If Class.forName() does not pass a
    specific classloader, the system classpath loader is used; which is why it
    works when you put the classes on the system classpath.
    Best regards,
    Timothy Potter
    Senior Software Engineer
    eCommerce Server Division
    BEA Systems, Inc.
    "Brian Dowd" <[email protected]> wrote in message
    news:3c8c9ba0$[email protected]..
    >
    HI,
    I am deploying a big EAR in WL 6.1 on solaris and I am bundling FOP1.20.3
    within it, I am
    also including avalon 4.0 and logkit 1.0 jars within it as they are neededby
    fop.jar. Whenever I
    try to construct a "Driver()" class I get a NoClassDefFoundError on theorg.apache.framework.logger.Loggable
    interface that it needs. The strange thing is that when I do thefollowing :
    >
    try {
    ClassLoader cl = this.getClass().getClassLoader();
    cl.loadClass("org.apache.avalon.framework.logger.Loggable"); //.........this
    works OK
    // the following .... fails with NoClassDefFoundError on Loggable
    org.apache.fop.apps.Driver d = new org.apache.fop.apps.Driver();
    } catch (Throwable t) {
    cat.error("failed:", t);
    It DOES work when I put the necessary jars on the server startup classpath,
    however it would obviously be
    better to be able to bundle the 3rd party jars within my EAR ....... Iknow this
    seems like it would be a general
    weblogic classloader question - but I have had no problems with any other3rd
    party jars that are similar to
    this one.
    Has anyone else had these kinds of problems ?
    Cheers,
    Brian.

  • ClassLoader problems..

    <Unsure where this should be posted>
    Hi, I have a bit of a problem with loading a class using defineClass.
    When I load the bytes of a class file and covert that file to a class, using defineClass, the generated Class object seems to work fine. I can call new instance without a problem.
    The problem occurrs when I try to cast the generated class. It seems that the JVM doesn't recognize the generated object to be an instanceof what I am casting to (although I know it is).
    Here is the class loader I am using:
    class loader extends ClassLoader {
        public loader(){
            super();
        public Class<?> loadClass(String className) throws ClassNotFoundException {
              try{
                   return super.loadClass(className);
            } catch (Exception e) {
                 return null;
        public Class<?> loadClass(String className, byte bytes[])  {
            Class ret = super.defineClass(className, bytes, 0, bytes.length);
            super.resolveClass(ret);       
            return ret;
    }And here is the code I am using to call:
    DataInputStream in = new DataInputStream(new FileInputStream(new File("TestApp.class")));
    byte[] bytes = new byte[in.available()];
    in.readFully(bytes);
    loader classLoader = new loader();
    TestApp testapp = (TestApp)classLoader.loadClass("TestApp", bytes).newInstance();
    //This line generats a ClassCast Exception ^     Using..
    TestApp ta = (TestApp)classLoader.loadClass("TestApp").newInstance();works fine however. It seems my define class is causing this problem.
    If anyone could help, I'd greatly appreciate it.
    - Adam
    <Unsure where this should be posted>

    <Unsure where this should be posted>Somewhere under "Core API's" :)
    The problem occurrs when I try to cast the generated
    class. It seems that the JVM doesn't recognize the
    generated object to be an instanceof what I am
    casting to (although I know it is).A type is defined as a <classloader,name> pair. For the cast to succeed you have to get both parts of the pair the same.
    Here is the class loader I am using:
    class loader extends ClassLoader {
    public loader(){
    super();
    public Class<?> loadClass(String className)
    throws ClassNotFoundException {
         try{
    eturn super.loadClass(className);
    } catch (Exception e) {
         return null;
    public Class<?> loadClass(String className, byte
    bytes[]) {
    Class ret = super.defineClass(className,
    bytes, 0, bytes.length);
    super.resolveClass(ret);
    return ret;
    }Your classloader is not defined correctly as it breaks the delegation model. Your classloader should always see if its parent loader can load a class of a given name before the loader itself tries to. In this case you are bypassing the parent - which obviously could load the class if given the opportunity - and defining it directly. Hence ...
    TestApp testapp = (TestApp)classLoader.loadClass("TestApp",
    bytes).newInstance();
    //This line generats a ClassCast Exception ^     ... the type of the class you load explicitly is <classLoader, "TestApp">. The type being checked for by your cast is <current-loader, "TestApp">. As the current loader is not your custom classLoader, the types are different and you get the exception.
    Hope that clarifies things.
    Message was edited by:
    davidholmes

  • Classloader problem with exploded EAR

    I'm trying to un-jar an EAR file and then un-jar the EJB jars within EAR and putting
    all the EJB and other classes from those jar files in the main application directory
    like application/com/abc/***. I have few WARs within EAR but I'm trying not to
    explode (un-jar) those. One of the WAR file has a JSP page and a depentent java
    class within it but when I try to use that JSP, I'm getting "java.lang.NoClassDefFoundError"
    exception. Any ideas?
    Is there a better/standard way to explode an EAR for development purposes?

    I had similar problem today with an EAR application using EclipseLink 1.0.1 on WebLogic Server 10.3.
    The stack trace looks a little different,
    java.lang.NoClassDefFoundError: org/eclipse/persistence/internal/jpa/deployment/DirectoryArchive$1
    at org.eclipse.persistence.internal.jpa.deployment.DirectoryArchive.init(DirectoryArchive.java:89)
    at org.eclipse.persistence.internal.jpa.deployment.DirectoryArchive.<init>(DirectoryArchive.java:73)
    at org.eclipse.persistence.internal.jpa.deployment.DirectoryArchive.<init>(DirectoryArchive.java:55)
    at org.eclipse.persistence.internal.jpa.deployment.ArchiveFactoryImpl.createArchive(ArchiveFactoryImpl.java:75)
    at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.findPersistenceArchives(PersistenceUnitProcessor.java:184)
    at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.initialize(JPAInitializer.java:132)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:104)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:64)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:84)
    but the cause is the same: instances of JPA provider were cached in javax.persistence.Persistence which is loaded in WLS system classloader.
    When EAR is redeployed, the EclipseLink jar located in the EAR is reloaded but the cached instance is not updated.
    The reflection workaround did work but there is even simpler workaround: just copy eclipselink.jar (or other JPA provider JARs) into the
    /lib directory of the WLS domain -- the JARs in lib folders are loaded before EAR and would not be redeployed every time.

  • GetResources() gives null's after using RMI (ClassLoader problem???)

    Hi
    I have just put RMI into my app and it works fine, connects to a remote server, runs a method on the server and returns the results.
    The problem is when I try to use a line like:
    URL url = MyClass.class.getResources("image/save.gif");
    The url is null. This code will work before my RMI function is run. Also, every dialog the application opens after running RMI has a line at the top of the pane saying: "Java Applet Window".
    Is RMI playing with the Classloader?
    Do I have to instaniate the ClassLoader or do something else to get my resources again and get rid of the text on each of the dialog boxes???
    Thanks in advance.

    if your class is Remote object, you use the RMI CLassLoader when you do:
    URL url = MyClass.class.getResources("image/save.gif");you shoud use instead:
    URL url = Classloader.getSystemResources("image/save.gif");

  • Difficult ClassLoader problems with multiple deployed enterprise Apps

    Greetings!
    When multiple instances of an enterprise application are deployed, ClassLoader issues are causing ClassCast Exceptions in the instantiation of Stateless SessionBeans. These ClassCast Exceptions are causing the Stateless Session beans to not be created appropriately/correctly, and in turn there is an InvocationTargetException resulting in an HTTP 500 Internal Server Error (mapped to a custom handler).
    The setup is SJSAS2005Q2, JDK 1.5, MySQL 5.0, Linux (RedHat 9, and Debian 3.0/3.1)
    Below is a typical example:
    Exception creating stateless session bean : [{0}]java.lang.reflect.InvocationTargetException
    <<long stack Trace omitted>>
    Caused by: java.lang.ClassCastException: $Proxy111     at com.acjust.ecommerce.ejb.preferences.PreferenceManagerBean.ejbCreate(PreferenceManagerBean.java:354)     ... 67 moreHere is the code from PreferenceManagerBean, the offending line is the (first one) that does a lookup on PreferencesBean and casts the result. This is a SessionFacade (there are many others) and they all (may) exhibit this behavior when there are multiple enterprise apps running.
        public void ejbCreate() {
             LookupServiceHelper lookup = LookupServiceHelper.getInstance();
             preferencesHome = (LocalPreferencesHome)
                   lookup.getLocalHome(IConstants.PREFERENCES_BEAN);
             companyInformationHome = (LocalCompanyInformationHome)
                   lookup.getLocalHome(IConstants.COMPANY_INFORMATION_BEAN);
             businessAddressHome = (LocalBusinessAddressHome)
                   lookup.getLocalHome(IConstants.BUSINESS_ADDRESS_BEAN);
             sitePreferencesHome = (LocalSitePreferencesHome)
                   lookup.getLocalHome(IConstants.SITE_PREFERENCES_BEAN);
             paymentPreferencesHome = (LocalPaymentPreferencesHome)
                   lookup.getLocalHome(IConstants.PAYMENT_PREFERENCES_BEAN);
             productPreferencesHome = (LocalProductPreferencesHome)
                   lookup.getLocalHome(IConstants.PRODUCT_PREFERENCES_BEAN);
        }When there is one instance of the App, it works perfectly. When there are two instances, one works perfectly, and the other one will have the above issues with the instantiation of Stateless Session Beans (the broken enterprise app is the one that is NOT loaded or reloaded most recently).
    Thinking that the problem may be solved by rearranging or repackaging the software, multiple solutions have been tried. (ClassCast Exceptions such as these are typically the result of helper classes being loaded by one class-loader, then loaded by another, compared or casted, and the two are not equivalent). In this case, though, the software is behaving as though each enterprise app does not have its own class loader hierarchy, which is obviously highly undesirable for the situation at-hand. At any rate, bundling all library classes at the app server classpath level, putting all library classes in each jar, and war, and putting all library classes in the ear/lib directory and using MANIFEST.MF classpath entries to point all ear subcomponents at the library classes - none of these potential solutions has alleviated this problem. In addition, the EJB classes themselves triggering the exception(s) are not helper classes but EJBs that are correctly packaged in their respective EJB-JARS.
    Here is the sun SJSAS 8 classloader hierarchy from the userguide:
    http://docs.sun.com/source/817-6087/dgdeploy.html#wp58491
    Can somebody from the Sun App Server team speak to whether or not this is an Application Server issue? Why should the classloader hierarchy from one enterprise app interfere with any other? Are there known workarounds?
    Any help is greatly appreciated.
    Best, Adam

    Hi Ken,
    I have pretty much ruled out "artifacts" in the Application Server's Classpath, because we already tried reinstalling the Application Server. It is a freshly downloaded SJSAS 8 2005 Q2 downloaded a few days ago with nothing added to the Server Classpath other than a database driver [${com.sun.aas.installRoot}/mysql/lib/mysql-connector-java-3.1.11-bin.jar added to the server CLASSPATH suffix after the PointBase driver(s)].
    Yes, each ear has its own name. Once the two enterprise apps have been created/packaged by the ANT build script (they are the same except for the slight differences in deployment descriptors we discussed earlier), one is renamed and we use the SJSAS administrative console to deploy them, both deploy correctly, without errors and begin listening for connections at their respective context-roots. Each enterprise application has two web-wars, one public/customer facing, and one administrative. The first enterprise app listens on /e (public facing) and /a (administrative) and the second listens on / (public facing) and /admin (administrative).
    Also, you are correct; each ear has its own copy of the LookupServiceHelper class. Again, there is nothing shared on the App Server Classpath other than that jdbc driver for mysql.
    Here is the LookupServiceHelper code:
    package com.acjust.ecommerce.util;
    import java.sql.Connection;
    import java.sql.SQLException;
    import java.util.Collections;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.logging.Logger;
    import javax.ejb.EJBLocalHome;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.DataSource;
    * This class provides JNDI helper functions to look up EJB
    * Home implementations.
    * @author Copyright (c) 1998-2005 by A. C. Just, Inc. All Rights Reserved.
    public class LookupServiceHelper {
        * This is the only object of type LookupServiceHelper; this class
        * is a singleton.
        private static LookupServiceHelper instance = null;
         * The logging object for this singleton
        private final Logger logger = Logger.getLogger(getClass().getName());
        private InitialContext initialContext = null;
        private Map cache = null;
         * The no argument constructor is private to enforce the fact
         * that we do not want to create any other instances of this
         * class.
        private LookupServiceHelper() {
            try {
                initialContext = new InitialContext();          
                cache = Collections.synchronizedMap(new HashMap());
            } catch (NamingException ne) {
                throw new LookupServiceException(ne);
            } catch (Exception e) {
                throw new LookupServiceException(e);
         * This method returns the only object of this class.
         * @return instance The only object of type LookupServiceHelper.
        public static LookupServiceHelper getInstance() {
             if(null == instance) {
                  try {
                       instance = new LookupServiceHelper();
                  } catch (LookupServiceException lse) {
                       instance.logger.severe("Failed to create lookup service " +
                                 lse.getMessage());
             return instance;
         * This utility method looks up an enterprise JavaBean
         * in the distributed naming service.  It is not type safe;
         * that property is guaranteed by the callers.
         * @param bean The name of the enterprise JavaBean to find
         * in the naming service (a prefix will be automatically added).
         * @return An Object that can be casted to a LocalHomeInterface.
        public EJBLocalHome getLocalHome(String bean) {
            EJBLocalHome localHome = null;
            logger.entering("LookupServiceHelper","getLocalHome",bean);
            try {
                String jndiHomeName = getFullyQualifiedEJBName(bean);
                logger.info("looking for " + jndiHomeName);
                if (cache.containsKey(jndiHomeName)) {
                     logger.info("found cached reference");
                    localHome = (EJBLocalHome) cache.get(jndiHomeName);
                } else {
                     logger.info("no reference found; performing lookup");                 
                    localHome = (EJBLocalHome) initialContext.lookup(jndiHomeName);
                    cache.put(jndiHomeName, localHome);
            } catch (NamingException ne) {
                throw new LookupServiceException(ne);
            } catch (Exception e) {
                throw new LookupServiceException(e);
            logger.exiting("LookupServiceHelper","getLocalHome",localHome);
            return localHome;
         * This utility method looks up a javax.mail.Session session
         * in the distributed naming service.  It is not type safe;
         * that property is guaranteed by the callers.
         * @param resource The name of the mail session resource to find
         * in the naming service (a prefix will be automatically added).
         * @return An Object that can be casted to a javax.mail.Session.
        public javax.mail.Session getMailSession(String resource) {
            javax.mail.Session session = null;
            logger.entering("LookupServiceHelper","getMailSession",resource);
            try {
                String jndiName = getFullyQualifiedMailResourceName(resource);
                logger.info("looking for " + jndiName);
                if (cache.containsKey(jndiName)) {
                     logger.info("found cached reference");
                    session = (javax.mail.Session) cache.get(jndiName);
                } else {
                     logger.info("no reference found; performing lookup");
                    session = (javax.mail.Session) initialContext.lookup(jndiName);
                    cache.put(jndiName, session);
            } catch (NamingException ne) {
                throw new LookupServiceException(ne);
            } catch (Exception e) {
                throw new LookupServiceException(e);
            logger.exiting("LookupServiceHelper","getMailSession",session);
            return session;
          * Get a connection from the database pool.
          * @return Connection
         public Connection getDBConnection(String resource) {
              Connection connection = null;
              try {
                   String jndiName = getFullyQualifiedDBName(resource);
                   logger.info("looking for " + jndiName);
                   if(cache.containsKey(jndiName)) {
                        logger.info("found cached reference");
                        connection = (Connection) cache.get(jndiName);
                   } else {
                        logger.info("no reference found; performing lookup");
                        DataSource dataSource = (DataSource) initialContext
                                  .lookup(jndiName);
                        connection = dataSource.getConnection();
                        //do not cache the database connection;
                        //you will get an IllegalStateException if you do
                        //cache.put(jndiName,connection);
              } catch(NamingException ne) {
                   logger.warning("getConnection failed (naming): " + ne.getMessage());
                   throw new LookupServiceException(ne);
              } catch (SQLException sql) {
                   logger.warning("getConnection failed (db): " + sql.getMessage());
                   throw new LookupServiceException(sql);
              return connection;
         * This utility method takes an enterprise JavaBean name
         * and combines it with a prefix to form a fully qualified name
         * suitable for using to query the distributed naming service.
         * @param bean The name of the enterprise JavaBean to add.
         * @return The fully qualified name (e.g. java:comp/env/ejb/ABeanRef).
        private String getFullyQualifiedEJBName(String bean) {
            return IConstants.JNDI_EJB_PREFIX + bean;
         * This utility method takes a messaging resource name
         * and combines it with a prefix to form a fully qualified name
         * suitable for using to query the distributed naming service.
         * @param resource The name of the mail resource
         * @return The fully qualified name (e.g. java:comp/env/mail/MailSessionRef).
        private String getFullyQualifiedMailResourceName(String resource) {
            return IConstants.JNDI_MAIL_PREFIX + resource;
         * This utility method takes a messaging resource name
         * and combines it with a prefix to form a fully qualified name
         * suitable for using to query the distributed naming service.
         * @param jdbc The name of the JDBC resource.
         * @return The fully qualified name (e.g. java:comp/env/jdbc/mysql).
        private String getFullyQualifiedDBName(String resource) {
             return IConstants.JNDI_DB_PREFIX + resource;
    Some sample exception stack trace(s) (this is a different stateless session than the one before - but indicative of the same problem).
    [#|2005-11-10T14:00:20.566-0800|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.container.ejb|_ThreadID=29;|EJB5070: Exception creating stateless session bean : [{0}]
    java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:410)
         at com.sun.ejb.containers.StatelessSessionContainer.access$100(StatelessSessionContainer.java:75)
         at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:597)
         at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:168)
         at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:359)
         at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:1072)
         at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:772)
         at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:126)
         at $Proxy167.authenticateCustomer(Unknown Source)
         at com.acjust.ecommerce.web.businessdelegate.customer.CustomerManagerBusinessDelegate.authenticate(CustomerManagerBusinessDelegate.java:77)
         at com.acjust.ecommerce.web.action.customer.LoginAction.execute(LoginAction.java:29)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
         at sun.reflect.GeneratedMethodAccessor297.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
         at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
    Caused by: java.lang.ClassCastException: $Proxy214
         at com.acjust.ecommerce.ejb.client.customermanager.CustomerManagerBean.ejbCreate(CustomerManagerBean.java:71)
         ... 49 more
    |#]
    [#|2005-11-10T14:00:20.577-0800|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.container.ejb|_ThreadID=29;|EJB5018: An exception was thrown during an ejb invocation on [CustomerManagerBean]|#]
    [#|2005-11-10T14:00:20.578-0800|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.container.ejb|_ThreadID=29;|
    javax.ejb.EJBException: nested exception is: javax.ejb.EJBException: nested exception is: javax.ejb.CreateException: Could not create stateless EJB: java.lang.reflect.InvocationTargetException
    javax.ejb.EJBException: nested exception is: javax.ejb.CreateException: Could not create stateless EJB: java.lang.reflect.InvocationTargetException
    javax.ejb.CreateException: Could not create stateless EJB: java.lang.reflect.InvocationTargetException
         at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:418)
         at com.sun.ejb.containers.StatelessSessionContainer.access$100(StatelessSessionContainer.java:75)
         at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:597)
         at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:168)
         at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:359)
         at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:1072)
         at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:772)
         at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:126)
         at $Proxy167.authenticateCustomer(Unknown Source)
         at com.acjust.ecommerce.web.businessdelegate.customer.CustomerManagerBusinessDelegate.authenticate(CustomerManagerBusinessDelegate.java:77)
         at com.acjust.ecommerce.web.action.customer.LoginAction.execute(LoginAction.java:29)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
         at sun.reflect.GeneratedMethodAccessor297.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
         at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
    javax.ejb.EJBException: nested exception is: javax.ejb.CreateException: Could not create stateless EJB: java.lang.reflect.InvocationTargetException
         at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:599)
         at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:168)
         at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:359)
         at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:1072)
         at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:772)
         at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:126)
         at $Proxy167.authenticateCustomer(Unknown Source)
         at com.acjust.ecommerce.web.businessdelegate.customer.CustomerManagerBusinessDelegate.authenticate(CustomerManagerBusinessDelegate.java:77)
         at com.acjust.ecommerce.web.action.customer.LoginAction.execute(LoginAction.java:29)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
         at sun.reflect.GeneratedMethodAccessor297.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
         at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
    javax.ejb.EJBException: nested exception is: javax.ejb.EJBException: nested exception is: javax.ejb.CreateException: Could not create stateless EJB: java.lang.reflect.InvocationTargetException
         at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:364)
         at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:1072)
         at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:772)
         at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:126)
         at $Proxy167.authenticateCustomer(Unknown Source)
         at com.acjust.ecommerce.web.businessdelegate.customer.CustomerManagerBusinessDelegate.authenticate(CustomerManagerBusinessDelegate.java:77)
         at com.acjust.ecommerce.web.action.customer.LoginAction.execute(LoginAction.java:29)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
         at sun.reflect.GeneratedMethodAccessor297.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
         at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
    |#]
    [#|2005-11-10T14:00:20.651-0800|WARNING|sun-appserver-pe8.1_02|org.apache.struts.action.RequestProcessor|_ThreadID=29;|Unhandled Exception thrown: class javax.ejb.EJBException|#]
    [#|2005-11-10T14:00:20.779-0800|SEVERE|sun-appserver-pe8.1_02|javax.enterprise.system.container.web|_ThreadID=29;|StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
    javax.ejb.EJBException: nested exception is: javax.ejb.EJBException: nested exception is: javax.ejb.CreateException: Could not create stateless EJB: java.lang.reflect.InvocationTargetException
    javax.ejb.EJBException: nested exception is: javax.ejb.CreateException: Could not create stateless EJB: java.lang.reflect.InvocationTargetException
    javax.ejb.CreateException: Could not create stateless EJB: java.lang.reflect.InvocationTargetException
         at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:418)
         at com.sun.ejb.containers.StatelessSessionContainer.access$100(StatelessSessionContainer.java:75)
         at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:597)
         at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:168)
         at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:359)
         at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:1072)
         at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:772)
         at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:126)
         at $Proxy167.authenticateCustomer(Unknown Source)
         at com.acjust.ecommerce.web.businessdelegate.customer.CustomerManagerBusinessDelegate.authenticate(CustomerManagerBusinessDelegate.java:77)
         at com.acjust.ecommerce.web.action.customer.LoginAction.execute(LoginAction.java:29)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
         at sun.reflect.GeneratedMethodAccessor297.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
         at com.sun.enterprise.web.connector.grizzly.Proce                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

  • EAR classloader problem

    Hi,
    I am having a trouble while deploying two ears. I have one war file, which refers a certain java project. I have created a replica of this war file and have done some chnages so that I can have a separate set of portlets using the same code base.
    While these war files run fine when deployed separately (one ear per war), they create problem if both are run at once & I get ClassCastException. The possible reason is:
    - applicationA puts ClassA in session
    - applicationA is loaded properly
    - applicationB is trying to load, it searches for a particular attribute in session, which is available (kept by appA), and tries to type-cast it, resulting in ClassCaseException.
    My question is:
    1) What I am trying to achieve, is it do-able?
    2) If yes, why the session / context is shared among the two ear files.
    3) Does it have to do with classloader? I have changed the classloader mode to Parent_Last for all 4( both ear and both war).
    I am using RAD 6.0.1 and WPS 5.1.
    Please help. I am stuck since last two weeks :-(

    I faced a similar problem in WAS 5.1.
    Open your Enterprise application[YOUR deployed ear in your WAS admin console]
    Change WAR ClassLoader policy to application rather than module.
    That should hopefully solve your issue.

  • Classloader problem

    Hi,
    I am having a trouble while deploying two ears. I have one war file, which refers a certain java project. I have created a replica of this war file and have done some chnages so that I can have a separate set of portlets using the same code base.
    While these war files run fine when deployed separately (one ear per war), they create problem if both are run at once & I get ClassCastException. The possible reason is:
    - applicationA puts ClassA in session
    - applicationA is loaded properly
    - applicationB is trying to load, it searches for a particular attribute in session, which is available (kept by appA), and tries to type-cast it, resulting in ClassCaseException.
    My question is:
    1) What I am trying to achieve, is it do-able?
    2) If yes, why the session / context is shared among the two ear files.
    3) Does it have to do with classloader? I have changed the classloader mode to Parent_Last for all 4( both ear and both war).
    I am using RAD 6.0.1 and WPS 5.1.
    Please help. I am stuck since last two weeks :-(

    Let me try to shed some light on this:
    a) The reason why you're getting the s.o.p results you're seeing is because you're executing them from the old thread. If you were to execute the second s.o.p from the new thread without setting the class loader as suggested, you wouldn't get the same result. Just try that if you find some time.
    b) The ContextClassLoader is a "tricky" thing. It's actually a singleton mechanism that delegates the actual class loading to the appropriate class loader based on the execution context. OC4J has overloaded the mechanism of finding the right class loader based on execution context. The reason you always need to set the context class loader for new user threads in OC4J lies in the following JDK problem:
    When a new thread is created, the JDK attempts to set its context class loader to that of its "parent" (the thread that created it):
    Thread parent = currentThread();
    this.contextClassLoader = parent.contextClassLoader;
    What it should do is:
    this.contextClassLoader = parent.getContextClassLoader();
    The OC4J thread that is running (the "parent" in this case), is a subclass of Thread that has overridden the getContextClassLoader() method. That override does not return the base class field called "contextClassLoader", but does a lookup to find the correct loader. This lookup depends on other thread state. That thread state is not present on the new thread, so there is no way for the new thread to get the right loader.
    In any case, if you always follow the simple step of setting the context class loader for new threads as discussed earlier in this thread, then you should not see this issue.
    Hope this helps explain things!
    -lars

  • Applet ClassLoader Problem

    Hi all,
    I experienced a problem which I couldn't solve yet. My applet depends on some third party libraries which are located in a lib/ folder, therefore the archive tag looks like that:
    archive="MyApplet.jar,lib/thirdParty1.jar,lib/thirdParty2.jar..."The applet folder consist of: lib/ MyApplet.html MyApplet.jar
    If I start the html file from this folder everything works fine, but if I deploy the applet with my webapp to Tomcat and start the applet from a button ( window.open("Applets/MyApplet.html","", att)) the classloader will not find the third party libraries and a java.lang.NoClassDefFoundError exception is thrown(Java Console).
    Any advice is highly appreciated.
    Stephan

    I still don't have a clue what is going on here. In the lib/ I have five third party libraries, three are loading and two throwing above mentioned error. I have downloaded the libraries again compiled my applet and my web app, even signed all jars, but same thing. This is true on Linux and WindowsXP for Firefox, Netscape and IE. I'm using java version 1.5.0_06.
    Any help is highly appreciated.
    Stephan

  • Classloader problem on deployment in OC4J...

    When I try to deploy a bean with OC4J, I get a java.lang.NoClassDefFoundError because it can not find class located in the JDOM.jar. The jar is referenced from the ejb.jar manifest file, and the jar located in the ear file. I thought OC4J should find it then. Also tried to put the jar file in the /lib folder but it doesnt work. Any idea?
    C:\Applications\Development\oc4j\j2ee\home>deploy_AvianTraveller.bat
    Fatal Error: Error loading class 'com.sig.ressys.session.BookingEngineBean': java.lang.NoClassDefFoundError: org/jdom/JDOMException
    Auto-unpacking C:\Applications\Development\oc4j_extended\j2ee\home\applications\AvianTraveller.ear... done.
    Auto-unpacking C:\Applications\Development\oc4j_extended\j2ee\home\applications\AvianTraveller\ect-web.war... done.
    Auto-deploying AvianTraveller (New server version detected)...
    java.lang.InstantiationException: Error loading class 'com.sig.ressys.session.BookingEngineBean': java.lang.NoClassDefFoundError: org/jdom/JDOMException
    at com.evermind.server.ejb.deployment.BeanDescriptor.initialize(BeanDescriptor.java:248)
    at com.evermind.server.ejb.deployment.ExposableBeanDescriptor.initialize(ExposableBeanDescriptor.java:131)
    at com.evermind.server.ejb.deployment.SessionBeanDescriptor.initialize(SessionBeanDescriptor.java:342)
    at com.evermind.server.ejb.deployment.EJBPackage.initialize(EJBPackage.java:650)
    at com.evermind.server.ejb.EJBPackageDeployment.getPackage(EJBPackageDeployment.java:673)
    at com.evermind.server.administration.ServerApplicationInstallation.finish(ServerApplicationInstallation.java:487)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:103)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:64)

    Tried first to get it to work with 9.02, but there seems to be a bug related to loading jars in the ejb.jar manifest file. When I used 9.03 I always got a out-of-memmory error (my EAR is 16Mb), but yesterday I reduced the size of it for test purpose and then it worked! So I have to look into the memory problem further.

  • RMI dynamic classloading problems

    I wanted to know if you could help me answer this particular case,
    which i still haven't been able to solve in days:
    1>RMI Client and Server are on different hosts.
    2>the Client makes a RMI method call to a Server who has to execute
    dynamically a particular classfile specified by the client itself and
    return the result to the client
    PROBLEM IS:
    at the beginning only the client has the classfile to be executed by
    server and needs to transfer him the information in order to have its
    RMI method executed,and no ohter protocols except for RMI are
    allowed.
    QUESTION IS:
    how could i solve this case with the use of codebases and
    URLClassLoader Objects?
    hoping i've clearly made the point,thanXalot
    nicholas

    The client can set its own codebase. The client class that the server will call needs to implement an interface the server knows. Then the client will pass this object to the server, and the server will make its call on that object. Since this object is not exported it will be serialized to the server, and the call will run on the server.
    Quite insecure. But it should work just that simply I do believe.
    You do know how to use codebase?

  • JVM crashes after ClassLoader-problem in Eclipse-Plugin using Eclipse 3.4

    Hi all
    while using plug-in com.lti.civil for displaying webcam in a SWT-Window or Swing-Frame the JVM crashed before displaying the stream.
    It isn't happening when using in a normal java-project. it happens when it's implemented in a plugin.
    I think it is a class-loader-problem.
    I've debugged and came to the following technical result:
    - Class NativeVideoFormat not found
    - NoClassDefFoundError: 40
    - JVM (jdk1.6.0_07\jre\bin) crashed with exit code -1073741819
    I'm looking for days for a solution. Please somebody may help me!
    Thanks very much.
    Edited by: Martin_Pulfer on Feb 16, 2009 5:03 AM
    Edited by: Martin_Pulfer on Feb 16, 2009 5:04 AM

    The crash log is pretty generic, it's hard to say where exactly it crashed... The best way to report such incidents is to file bugs to JavaFX JIRA (http://javafx-jira.kenai.com), but without a details crash log or a test case, the bug will likely be closed as not reproducible.

Maybe you are looking for

  • "No Video" error when Batch Capturing

    I am getting a new error that I have not seen before when using Batch Capture in FCP. It cues the tape, starts the pre-roll and then spits out an error message that there is "no video". Of course, there is video. The same thing does not happen when c

  • Multiple values for multiple fields sharing common id

    I'm new to Reporting Services and I need to create report based on a common child id that includes multiple values from multiple fields in several tables. I can combine all the values into one query for a list report; however, this causes the rows to

  • Power cord EU to Canada

    Dear All, I will be moving from the Netherlands to Vancouver Canada. I owe an Apple TV which I want to take with me. Can I just buy a power cord like this one, plug it in and continue to use it? No issues with voltage difference between the Netherlan

  • Location code on org.units

    Hi group, One of our clients need to register a code for location on their org.units. 14 characters, alphanumeric. Table of values to exsist behind the field.  Can you suggest any fields or infotypes we could use for this without making our own?  I c

  • JWS1.2 & Missing version field in response

    I must say that the guys with JWS1.2 have done well in getting around the proxy issues with the previous versions. However, its disappointing to see this error still occuring when you perform a version based download which is one of the most useful p