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.

Similar Messages

  • 'Source play' and 'audio-video sync' problems with PE8 on fast WIN7 64 bit computer

    I am transferring Hi8 videos, about 2 hours long, to my WIN7 64 bit computer with PE8.  [Dell Mobile Precision M4400 Computer Workstation (Intel Core 2 Duo T9900 500GB/4GB); NVIDIA Quadro FX 770M, 512MB] I seem to have several problems: 
    First, after importing the file (.avi), I get a message about ‘dropped frames.’ 
    Secondly, when I try to play the video in the source monitor, the audio plays but the video doesn’t; it only shows the first frame [this is after waiting until the video is ?recognized? ]   I can use the shift-arrow key and see that the video is there.
    Thirdly, I can play the .avi file in other players, e.g., avidemux or PE pro CS5 on another computer.  There, I see that the audio and video are not in sync; the audio can be up to 300 ms ahead of the video (as determined using avidemux). 
    Questions:
    1.  Why doesn’t the source monitor play the video? Is this a problem with PE8 (latest update as of 3 March 2011) on aWIN7 64 bit computer (intel duo core. 3 GHz).
    2. Is the audio-video sync problem the result of the ‘dropped frames?’ How can PE8 correct this? Avoid this? Or, is it coincidence?

    "I think you're telling me you're using a backwards compatible Digital8  camcorder to capture your video as DV-AVIs. Is that right?" YES
    "Are you using  Premiere Elements to do this capturing?" YES, AS ABOVE PE8
    "Go to the File menu and select Properties. It should show a standard DV codec being used for your video and audio."
    WMP v12 is dumb. Under properties, media, it says 'video.'  However, avidemux gave me the information state above: video -- Codec 4CC: dvsd, frame rate: 29.971 fps; audio -- codec: PCM, channels: Stereo, frequency: 48 kHz.
    So, back to the Questions:
    1.  Why doesn’t the source  monitor play the video? Is this a problem with PE8 (latest update as of 3  March 2011) on aWIN7 64 bit computer (intel duo core. 3 GHz).
    2. Is the audio-video sync problem the result of the ‘dropped frames?’ How can PE8 correct this? Avoid this? Or, is it coincidence?

  • Problems starting PE8 - and the answer to my problem!

    Hi Everyone,
    The other day, I was having a problem starting PE8... When I started PE8 from the desktop icon, the Welcome Screen would appear, but the buttons which would normally allow a person to: Open a Project, Create A Project, etc., were all shaded out and could not be clicked. In fact the only thing I could do was to Take a Tour!   After taking the tour, I was able to click on a GO button, which then took me into Organizer, rather than into Premiere Elements. Clearly, something was wrong. I completely uninstalled PE8 and removed all instances of PE8 from my Program Files x86 directory. Yet, when I reinstalled PE8, the sympton persisted.
    Here's the answer to the problem I was experiencing:
    After trying to start PE8, over and over, many times, I noticed that right before the Welcome screen began to appear, there was a small (2" X 3") dialog box that said that I did not have any available memory. How could that be?! I have 12GB of memory on my computer! Hmmmm. Wait a minute! I remember that as I entered PE8 in the past, at the bottom of the Welcome Screen, it said that I had/have 2GB of memory for storage available.   So, as I went in to the shaded out Welcome Screen again, I looked at the little bar graph which shows how much storage memory one has available from Photoshop.com.  My bar graph was maxed out!   I then went to photoshop.com (which I have never used at all!) and I logged in with the same login that I used when I registered PE8.  Much to my surprise, someone else's pictures had been dumped into my account/storage on Photoshop.com. I then deleted ALL the pictures that were on my photoshop.com account.  I also changed my login & password.  I logged out of photoshop.com and then (as I had done many times previously) attempted to open up Premiere Elements 8 and IT OPENED AND STARTED PERFECTLY.
    The moral to this story is that:   If you, or (as in my case) someone else maxes out your photoshop.com storage, you won't be able to get into Premier Elements until you either obtain more storage from Adobe, or until you delete things that you have in that storage area.   Note that when you install and register PE8, a Photoshop.com account and gallery area are created for you.   If that account/gallery is ever filled to it's initial 2GB capacity, you won't be able to start PE8 properly.   Likewise, if you can't start/open PE8 normally, then go to photoshop.com, log in, and check to see how much memory has been used on your photoshop account.         
    Last, but not least, know that the memory problem (not having any more Storage Memory available) is NOT a problem on YOUR computer. Rather, it is referring to the amount of Memory/Storage that Adobe gives you for free on THEIR computer.
    Best Regards,
    Kent

    Hmmm. They would have to have the same login and password,  which is highly unlikely. Nevertheless, while my login (email address) remains the same, I now have a new password.   I figured that you would find my 'solution' interesting.    I never would have thought the problem was with the photoshop.com account which I had never used.   But, as we all know, the moment we assume anything, Murphy's Law kicks in and fools us!   Thanks again for all your help.  Kent

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

  • 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");

  • 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?

  • 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

  • Problems with PE8 Editor

    When I open several images in PE 8 Editor they open as expected in the Project Bin but they are now also stacking up on the left side of the main screen which I do not want.
    Before only a single image appeared on the main screen and it is that I wish to restore as I could work on that image and then move onto the next image from the project bin that appeared on the screen automatically after the previous image had been sent to a file on the PC.
    Can anyone plaese help and if so can they give simple instructions?.
    I have tried the button WINDOWS and also VIEW and then ARRANGE with the various options but none provide the answer.
    Appreciate any help that will sort it for me.
    Brian Holland.

    You may have hit upon the reason as earlier this week a friend set up a WiFi connection for my wife to access emails and the internet from a lap top anywhere in the house.
    That could possibly be a cause and I tell the chap who coincidentally will be calling here tomorrow.
    How I hope you are rtght and things can get sorted as I fret over such things - sad but true - getting old id no fun especially if you hae health issues.
    Really apprecaite your continued interest in this problem and I will keep you informed.
    Will switch off the computer as I have had enough for today.
    To show that my wife is an amateur wildlife photographer and that I do the uploading after editing on PE8 here is a link:-
    http://flickrhivemind.net/User/Margaret%20the%20Novice/Interesting
    http://flickrhivemind.net/User/Margaret%20the%20Novice/Recent
    Good night and thank you again,
    Brian.

  • 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

Maybe you are looking for