ConversionManager - Override and Class Loader Issues

Hi
We are using Toplink 10.1.3 deployed withiin 10gAS 10.1.3.
We have overridden the ConversionManger as documented in tips.
1. MyConversionManager extends ConversionManager.
2. We have overriden convertObject
3. We have a pre-login SessionEventAdapter that sets the ConversionManager.
We have had issues of classloading within the application previously, particularly where we have two versions of our application deployed on the same App Server instance (potentially with differing versions of MyConversionManager).
For this reason we only set the ConversionManager within the preLogin event on the Session as follows:
*//Just set the conversion manager for the session.*
event.getSession().getLogin().getPlatform().setConversionManager(getConversionManager());
We no longer set the default conversion manager, as my understanding was that this would set it at the root level within the OC4J instance (meaning that each deployment would override the previous).
Additionally, we have had to sepcify the class loader to use, within the ovverriden convertObject method, as otherwise start up of Toplink falied, as it was unable to solve references to application classes specified within class indicator mappings. We do this as follows:
*@Override*
*public Object convertObject(final Object source, final Class javaClass) {*
super.setShouldUseClassLoaderFromCurrentThread(true);
The only know issue with this, is that if I try and use OEM to veiw the Toplink Cache, I just get and AnnotatedClassNotFoundException as it is attempting to use the system class loader (that does not contain our Application classes).
Two questions therefore:
1. Is the deployment we have now stable, i.e. overriding the class loader within the overriden Conversion Manager, and only loading this against the session??
2. How can I get mutiple versions of the application to still work, together with being able to view the Toplink Cache from within OE:M.
Any help or insight, would be greatly appreciated.
Marc

Looks fine, you may also wish to investigate using Converters in your mappings instead of customizing the ConversionManager.
For the OEM issue, try setting the class loader to be your application class loader instead of the thread one, i.e. MyAppClass.getLoader().
James : http://www.eclipselink.org

Similar Messages

  • Does resteasy API have class loader issues when using via OSGi

    Does resteasy API have class loader issues when using via OSGi

    Hi Scott,
    THis isnt an answer to ur Question, but could u tell me which jar files are needed for the packages:
    com.sap.portal.pcm.system.ISystems
    com.sap.portal.pcm.system.ISystem
    and under which path I coul dfind them.
    Thnx
    Regards
    Meesum.

  • Integrated WL/Jdeveloper class loading issue

    Hello,
    I am trying to run a deployed project , getting into this class loading issue. Any idea?
    javax.security.auth.login.LoginException: java.lang.LinkageError: loader constraint violation: when resolving interface method "com.scat.util.identity.UserFactory.lookup(Ljava/lang/String;)Lcom/scat/domain/identity/User;" the class loader (instance of weblogic/utils/classloaders/ChangeAwareClassLoader) of the current class, com/scat/auth/authentication/login/UserLoginModule, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for resolved class, com/scatl/util/identity/UserFactory, have different Class objects for the type com/scat/domain/identity/User used in the signature
    Thanks
    Ram

    How many times are you loading the com/scat/domain/identity/User type?
    Is this in the system classloader and the application? and are you using class loading filtering in the application, for example,
    in weblogic.xml - prefer-web-inf-classes?

  • WebSphere class loading issue

    Hi,
    We ran into this issue and have been trying to resolve since yesterday with no luck. I'm wondering if anybody else has encountered this and has any thoughts ...
    We are trying to call the methods of the com.ibm.websphere.runtime.ServerName class in a utility class that is packaged into a jar and put onto the JVM classpath in WebSphere 6.1. And we are running into NoClassDefFound errors. So we just did Class.forName("com.ibm.websphere.runtime.ServerName") in that utility class and got the ClassNotFoundException as expected. But when we do the same in a separate utility class that is outside of the classpath, both the forName and the actual method calls work without any problem.
    That kind of suggested that the com.ibm.websphere.runtime.ServerName class is not "available"(/loaded) by the time our utility class gets loaded, may be. So we turned on the Verbose Class Loading to see the order in which the classes are loaded when the JVM starts up. But the com.ibm.websphere.runtime.ServerName class is loaded way before our utility class from the jar in the classpath.
    So I'm wondering:
    Why would it give me a ClassNotFound exception in my utility class (which is put on the classpath) when the log shows that the utility class is already loaded by the time this class starts loading?
    Any feedback or thoughts would be greatly appreciated.
    Thanks,
    Bharathi

    Java_Unlimited wrote:
    We could figure out the answer from your responses, thank you guys!
    It is true that our jar is being loaded by a different class loader, to which the ServerName class is not available. Also in one of the articles quoted in the responses, it mentioned specifying the jar in the ws.ext.dirs property, not in the classpath for the ws ext classes to be available to the jar. And that fixed the problem. We defined a custom property ws.ext.dirs and put the jar file in there.
    Thanks everyone!
    Edited by: Java_Unlimited on Feb 6, 2009 10:42 AMBharati, we're glad to help and thanks for lettings us know what you did to make it work.

  • Weblogic Class Loading issue

    Note: I am not sure what is the best suitable subject for this issue.
    Stack Trace:
    Error 1)
    <Dec 30, 2011 11:02:51 AM GMT+05:30> <Error> <HTTP> <BEA-101017> <[ServletContext@29472630[app:EM11X module:Web path:/Web spec-version:2.5], request: weblogic.servlet.internal.ServletRequestImpl@14d05d1[
    POST /Web/GenerateMealPlanAction.do HTTP/1.1
    Via: 1.1 INDCHN-MGMT01
    Cookie: org.ditchnet.jsp.tabs:CommercialFormulaTabs=; org.ditchnet.jsp.tabs:KitchenTabs=; JSESSIONID=sZQFT9MJQc6vS6MCSXtdjWwSTLCcG6nqL12Fdyj1NFHcp4WnpkCB!1348500068
    Referer: http://130.78.88.83:7001/Web/GenerateMealPlanAction.do?vo.viewCode=generateMealPlanFrame&method=1&&menu_id=DS_DFLT&module_id=DS&function_id=DS_GEN_MEAL_PLAN&function_name=Generate%20Meal%20Plan&function_type=R&access=YYYYN&desktopFlag=N&vo.functionId=DS_GEN_MEAL_PLAN
    Content-Type: application/x-www-form-urlencoded
    User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; InfoPath.1)
    Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
    Accept-Language: en-us
    Pragma: no-cache
    Connection: Keep-Alive
    Content-Length: 488
    ]] Root cause of ServletException.
    java.lang.IllegalArgumentException: Cannot invoke com.vo.GenerateMealPlanVO.setServingDate on bean class 'class com.vo.GenerateMealPlanVO' - argument type mismatch - had objects of type "java.lang.String" but expected signature "com.core.util.Date"
         at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2181)
         at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:2141)
         at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1948)
         at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:2054)
         at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1015)
         Truncated. see log file for complete stacktrace
    Caused By: java.lang.IllegalArgumentException: argument type mismatch
         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:597)
         at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2155)
         Truncated. see log file for complete stacktrace
    >
    Error 2)
    <Dec 30, 2011 11:11:19 AM GMT+05:30> <Error> <HTTP> <INDCHN-EPORT01> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1325223679258> <BEA-101017> <[ServletContext@29472630[app:EM11X module:Web path:/Web spec-version:2.5], request: weblogic.servlet.internal.ServletRequestImpl@1da8bfe[
    POST /Web/LookupAction.do HTTP/1.1
    Via: 1.1 INDCHN-MGMT01
    Cookie: org.ditchnet.jsp.tabs:CommercialFormulaTabs=; org.ditchnet.jsp.tabs:KitchenTabs=; JSESSIONID=GhG4T9TJ0ytD8dhRSGBFv2c3v1hNLftTTCJQHp6Qn9C5SnMGTVYF!1348500068
    Referer: http://130.78.88.83:7001/Web/core/lookup/jsp/LookupCriteria.jsp?undefined
    Content-Type: application/x-www-form-urlencoded
    User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; InfoPath.1)
    Accept: */*
    Accept-Language: en-us
    Pragma: no-cache
    Connection: Keep-Alive
    Content-Length: 304
    ]] Root cause of ServletException.
    java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String
         at com.lookup.pojo.web.LookupAction.doActionQuery(LookupAction.java:107)
         at com.core.pojo.web.BaseAction.execute(BaseAction.java:97)
         at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3717)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    >
    [b]Analysis:
    Migrating J2EE Application from Oracle 10g Application Server to Oracle 11g Weblogic Server. I am stuck with above two issues. This issue not present while running in Oracle 10g Application Server
    1) I was thinking it is something to do with JSTL versions and the below command is executed to make the JSTL version to jstl 1.1.2
    java weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password weblogic -deploy -library D:/Oracle/Middleware/wlserver_10.3/common/deployable-libraries/jstl-1.1.2.war
    The problem remains same.
    2) Now <wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes> is added to weblogic.xml to make the Web application to load application specific libraries from WEB-INF/lib directory.
    The problem remains same.
    3) I checked Class Loader Analysis Tool and found conflicting classes and based on CAT recommendation the below list is added to weblogic.xml and <wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes> is removed since both cannot co-exist.
         <wls:prefer-application-packages>
                   <wls:package-name>antlr.*</wls:package-name>
                   <wls:package-name>antlr.collections.*</wls:package-name>
                   <wls:package-name>antlr.collections.impl.*</wls:package-name>
                   <wls:package-name>antlr.debug.misc.*</wls:package-name>
                   <wls:package-name>com.mysql.jdbc.*</wls:package-name>
                   <wls:package-name>javax.ejb.*</wls:package-name>
                   <wls:package-name>javax.ejb.spi.*</wls:package-name>
                   <wls:package-name>javax.enterprise.deploy.*</wls:package-name>
                   <wls:package-name>javax.jms.*</wls:package-name>
                   <wls:package-name>javax.management.j2ee.*</wls:package-name>
                   <wls:package-name>javax.resource.*</wls:package-name>
                   <wls:package-name>javax.resource.cci.*</wls:package-name>
                   <wls:package-name>javax.resource.spi.*</wls:package-name>
                   <wls:package-name>javax.security.jacc.*</wls:package-name>
                   <wls:package-name>javax.servlet.*</wls:package-name>
                   <wls:package-name>javax.servlet.http.*</wls:package-name>
                   <wls:package-name>javax.servlet.jsp.*</wls:package-name>
                   <wls:package-name>javax.transaction.*</wls:package-name>
                   <wls:package-name>javax.transaction.xa.*</wls:package-name>
                   <wls:package-name>javax.xml.*</wls:package-name>
                   <wls:package-name>javax.xml.datatype.*</wls:package-name>
                   <wls:package-name>javax.xml.namespace.*</wls:package-name>
                   <wls:package-name>javax.xml.parsers.*</wls:package-name>
                   <wls:package-name>javax.xml.registry.*</wls:package-name>
                   <wls:package-name>javax.xml.transform.*</wls:package-name>
                   <wls:package-name>javax.xml.validation.*</wls:package-name>
                   <wls:package-name>javax.xml.xpath.*</wls:package-name>
                   <wls:package-name>oracle.core.lmx.*</wls:package-name>
                   <wls:package-name>oracle.core.lvf.*</wls:package-name>
                   <wls:package-name>oracle.jdbc.*</wls:package-name>
                   <wls:package-name>oracle.jdbc.aq.*</wls:package-name>
                   <wls:package-name>oracle.jdbc.connector.*</wls:package-name>
                   <wls:package-name>oracle.jdbc.dcn.*</wls:package-name>
                   <wls:package-name>oracle.jdbc.diagnostics.*</wls:package-name>
                   <wls:package-name>oracle.jdbc.driver.*</wls:package-name>
                   <wls:package-name>oracle.jdbc.internal.*</wls:package-name>
                   <wls:package-name>oracle.jdbc.oci.*</wls:package-name>
                   <wls:package-name>oracle.jdbc.oracore.*</wls:package-name>
                   <wls:package-name>oracle.jdbc.pool.*</wls:package-name>
                   <wls:package-name>oracle.jdbc.rowset.*</wls:package-name>
                   <wls:package-name>oracle.jdbc.util.*</wls:package-name>
                   <wls:package-name>oracle.jdbc.xa.*</wls:package-name>
                   <wls:package-name>oracle.jpub.runtime.*</wls:package-name>
                   <wls:package-name>oracle.jsp.provider.*</wls:package-name>
                   <wls:package-name>oracle.net.ano.*</wls:package-name>
                   <wls:package-name>oracle.net.aso.*</wls:package-name>
                   <wls:package-name>oracle.net.jdbc.*</wls:package-name>
                   <wls:package-name>oracle.net.jndi.*</wls:package-name>
                   <wls:package-name>oracle.net.ns.*</wls:package-name>
                   <wls:package-name>oracle.net.nt.*</wls:package-name>
                   <wls:package-name>oracle.net.resolver.*</wls:package-name>
                   <wls:package-name>oracle.security.o3logon.*</wls:package-name>
                   <wls:package-name>oracle.security.o5logon.*</wls:package-name>
                   <wls:package-name>oracle.sql.*</wls:package-name>
                   <wls:package-name>oracle.sql.converter.*</wls:package-name>
                   <wls:package-name>org.apache.commons.*</wls:package-name>
                   <wls:package-name>org.apache.derby.*</wls:package-name>
                   <wls:package-name>org.apache.oro.*</wls:package-name>
                   <wls:package-name>org.apache.xerces.*</wls:package-name>
                   <wls:package-name>org.apache.xmlcommons.*</wls:package-name>
                   <wls:package-name>org.gjt.mm.*</wls:package-name>
                   <wls:package-name>org.joda.time.*</wls:package-name>
                   <wls:package-name>org.w3c.dom.*</wls:package-name>
                   <wls:package-name>org.xml.sax.*</wls:package-name>
              </wls:prefer-application-packages>
    The problem remains same.
    Your help is greatly appreciated as I am stuck with this issue.

    No I cannot ignore this error while deplyment. I'm not able to deploy the war.
    More ovet this needs to be working as during startup, the servlet loads some xml files and convert into tables for the kiosk in the airport to be working.
    Edited by: [email protected] on Mar 27, 2009 12:24 PM

  • Oracle Class Loading issue

    Hello All
    I am trying to implement Dbunit in my project. My project uses OAS 10.1.3 and JDK 1.5. I have my dbunit.jar, slf4j-api.jar and slf4j-simple.jar in my shared-library and I have imported them using the class loader while deploying my application. But still I am getting NoclassDefFoundError Missing Dependent class LoggerFactory NotFound.
    Please let me know what could be issue.
    Thanks
    Sri

    Hello All
    I am trying to implement Dbunit in my project. My project uses OAS 10.1.3 and JDK 1.5. I have my dbunit.jar, slf4j-api.jar and slf4j-simple.jar in my shared-library and I have imported them using the class loader while deploying my application. But still I am getting NoclassDefFoundError Missing Dependent class LoggerFactory NotFound.
    Please let me know what could be issue.
    Thanks
    Sri

  • Help! -- different class loader issue

    From within an EJB I am trying to cast a serializable object, that was passed into this EJB, to its original type. The process ended with a ClassCastException, even though I have double checked that the object being casted is of the correct type and fully qualified package path. It turns out that the problem is caused by the involvment of 2 different class loaders -- The class loader that loads the object is not the same one that loads the EJB doing the casting. The thing that confuses me the most is that this program used to work fine without the exception when it was running in an older environment. Is this a VM issue? Do we have control over what class loader to use when load certain classes/objects? What's the fix to the problem?
    Please help!
    Thanks in advance.
    Lifeng

    It is a Java platform version issue. Since Java 2 The classloaders are lay out in a hierarchy. You can read about it in the public chapters of the book "Inside the Java 2 Virtual Machine" by Bill Venners at
    www.artima.com
    This may be helpful for you . It specifies the class loaders used by a thread to load subsequent classes: aThread.setContextClassLoader(aClassLoader)
    Other soulution is to have the object and EJB being loaded by the same class loader, which could be a common parent class loader for the ones that in your code are actually asked to load these objects
    Otherwise, java.lang.reflect can deal with objects whose type is not known by the compiler.

  • Apparent EJB Class Loader Issue

    I am having a problem loading narrowing an EJB. It appears to be a class loader
    problem. I am getting a ClassCastException with the following message: Cannot
    narrow remote object to com.dte.ejb.facade.AccessoryServiceHome.
    Here is my code that looks up the EJB (I've ommitted the 'catch' clauses):
    EJBHome ejbHome = (EJBHome) cache.get(homeClass);
    try {
    Object temp = ctx.lookup("ejb/" + homeClass.getName());
    if (ejbHome == null) {
    ejbHome = (EJBHome) PortableRemoteObject.narrow(temp, homeClass);
    cache.put(homeClass, ejbHome);
    Here is the output of some debugging information from the above method. Here I've
    displayed the class.getName and the class.getClassLoader for the Class object
    passed to this method and the remote object being cast by the narrow method:
    homeClass : com.dte.ejb.facade.AccessoryServiceHome
    homeClass : weblogic.utils.classloaders.ChangeAwareClassLoader@29164c finder:
    weblogic.utils.classloaders.MultiClassFinder@300ec4
    From Lookup: com.dte.ejb.facade.AccessoryServiceBean_krx5el_HomeImpl
    From Lookup: weblogic.utils.classloaders.GenericClassLoader@1ea02f finder: weblogic.utils.classloaders.MultiClassFinder@6fca08
    As you can see, the Class passed into this method has been loaded with the ChangeAwareClassLoader
    but the HomeImpl class was loaded with the GenericClassLoader. I think that is
    the problem (please correct me if I am wrong).
    The application in question is an .ear with 2 .war modules and a ejb.jar file.
    It was my understanding that all classes needed by any module in a .ear were all
    loaded with the same class loader. Is this true? If so, then why am I having this
    problem?
    Thank you in advance for your help.

    I just want to add few comments hoping the iPlanet engineer will be able to help me.
    I mange to get one deployment of a war file with the client weblogic EJB to work; only if I add the Installation Directory path of the war file plus “web-inf/classes” to the classpath of the JVM configuration.
    This tells me that the class loader looks for the JVM classpath to load the EJB home class at run time. I think; if I can make iPlanet class loader to look for the application classpath instead of the JVM my problem will go away.
    Thank you in advance,
    Nad

  • MBean calling ejb class loading issue

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

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

  • Class Loader Issues

    I am dynamically creating .class files on the fly in my application. Often I need to rebuild the same class (including client classes) multiple times. The problem is that the system ClassLoader keeps the 1st .class file in memory and will not return to the disk to retrieve the new version after the class file(s) have changed.
    Do I need to write a new Classloader and substitute it for the main systems class loader? Is there a better way to instantiate the class other than Class.forName( blah ) that will solve this problem?
    Thanks,
    -Jeff Harman

    Like we told you. If the code for a class changes, Java will not automatically notice and load the new version, until you start up the JVM again. If you do not want to re-start the VM, you can create a new ClassLoader (CL), and use it to load the new code for the class.
    Now, the problem is, the second CL may think it has to reload many of other classes, since it has no record of loading them itself. You will end up with duplicates of many classes.
    If that doesn't suit you, there is not much alternatives.
    You could rename the new version of the class, which would mean you'd have to manually track down all the old versions and upgrade them ( by using the new Ctor). You'd then have to update all the references to make them point to the new object. You can make that particular job easier by making both classes (old and new) extend a common base class, or implements the same interface, and use the interface reference (i.e program to an interface).
    Another less-than-perfect possibility would be to use serialization where you serialise version-marked objects and reconstitute them with new code...
    Good luck.

  • Class loading issue in 10.1.2?  commons-codec

    Hi All,
    I'm attempting to deploy a pretty strait forward web application (wrapped in an EAR) that includes commons-codec-1.2.jar (used by axis2). The codec jar is included in the WEB-INF\lib directory but doesn't appear to be picked (I get a NoClassDefFoundError) up unless I copy it into the ...\system\appserver\oc4j\j2ee\home\applib directory? I'm guessing this is a weird classloader issue but I can't seem to find the codec jar in another location...
    I can get around the problem but I was wondering if anyone had an explanation?
    Cheers,
    Dan

    Dan,
    You need to set the search-local-classes-first attribute of element web-app-class-loader in file "orion-web.xml" to 'true' (the default is 'false') in order for OC4J to locate the "axis2" classes. Please refer to the White Paper, Classloading in OC4J (PDF):
    http://www.oracle.com/technology/tech/java/oc4j/pdf/ClassLoadingInOC4J_WP.pdf
    Or, if you don't like your Web browser directly opening PDF files (like I don't), there is a link to the White Paper from this Web page:
    http://www.oracle.com/technology/tech/java/oc4j/index.html
    Note however, that in OC4J 10.1.3 the class loading mechanisms are completely different to previous versions (including 10.1.2).
    Good Luck,
    Avi.

  • Re: MBean calling ejb class loading issue

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

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

  • Class loading issue

    I have a parent movie that loads several other swf's which
    each contain several different versions of the same class.
    The player seems to load the first swf and use the class
    compiled in that from then on.
    Is there a way to force a reload of the class for every swf
    thats loaded in

    The ONLY way to unload it is to use a class loader.
    There is no other way.
    J2EE containers almost always employ class loaders so you could simply create it as an entity that way. And thus it would be encapsulate in a class loader although not one that you provided.
    Alternatively just ignore the spec (where does it say that exactly) and create a class loader.
    Of course you could always shell out to another VM, which would be using a class loader as well. That would be a lot of work though (and that might be against the spec rules as well.)

  • EP 6.20 Class loader issues with irj application

    Hi All,
    I have a servlet to interface with the SAP UM API.  I had deployed this as a WAR, but the SAP UM cannot be initialised outside of the irj application (SAP Support advised this it is abailable outside the irj application in 6.40).
    As a result, I tried to deploy it within the irj application - I copied my jars to the WEB-INF\lib directory, and modified the WEB-INF\web.xml to include a new servlet and servlet-mapping.
    I also had to copy some other SAP supporting jars into WEB-INF\lib (the XML parser impls).
    This works fine for the UM stuff.  Ideally I'd like to redeploy the irj application so I don't have to hack the files and it would allow me to specify the additional libaries required, however there is now way I've found in the Deploy Tool to do this (you need the WAR of the irj application, or the project file).  So this is problem 1.
    Problem 2.  The next extension included support for user mapping data.
    Using -
    IUserMapping iUserMapping = UMFactory.getUserMapping();
    iUserMapping.getUserMappingData(systemAlias, iUser, mapLogonData);
    I was able to read the mapping data, but this required knowing beforehand, all the system aliases.  With a response from SAP Security, it was suggested
    IUserMappingService iums = (IUserMappingService)PortalRuntime.getRuntimeResources().getService(IUserMappingService.KEY);
    IUserMappingData mappingData = iums.getMappingData (systemAlias, iUser);
    be used to obtain mapping data, and that
    com.sap.portal.pcm.system.ISystems sysSrv = (ISystems)PortalRuntime.getRuntimeResources().getService(ISystems.KEY);
    String[] systemAliases = sysSrv.getAliases();
    be used to obtain the system aliases.
    The problem is with the class loader.  If I copy the jars with the classes for the IUserMappingService and the ISystems, to the irj WEB-INF\lib I cause a class def not found with other EP6 applications.  This is also the case when I add them to the JVM classpath (I know this is bad - but it was a last resort!).
    Hoping someone can help me redeploy irj with my application that will resolve problem 2! If not, maybe some advice on problem 2?
    Cheers,
    Scott...

    Hi Scott,
    THis isnt an answer to ur Question, but could u tell me which jar files are needed for the packages:
    com.sap.portal.pcm.system.ISystems
    com.sap.portal.pcm.system.ISystem
    and under which path I coul dfind them.
    Thnx
    Regards
    Meesum.

  • ObjectInputStream and Class Loading

    Hello,
    I have a serializable object that I have to pass as an argument to a session bean. It therefore is serialised/deserialised with a default object inputstream, which uses the bootstrap class loader as default. However, the object contains objects of which the classes cannot be loaded by the bootstrap class loader, in fact the class definitions are in a .jar file. I thus would need to be able to deserialise these objects with a custom class loader at the receiver's end. The receiver has the .jar file and the object that is to be deserialised is a trusted object.
    I could manually control the deserialization of the object by defining the following method:
    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    }I could also deserialize objects from a self created ObjectInputStream with a class loader of choice with the following class:
    public class CustomObjectInputStream extends ObjectInputStream {
        private ClassLoader classLoader;
        public CustomObjectInputStream(InputStream in, ClassLoader classLoader) throws IOException {
            super(in);
            this.classLoader = classLoader;
        protected Class<?> resolveClass(ObjectStreamClass desc) throws ClassNotFoundException {
            return Class.forName(desc.getName(), false, classLoader);
    }However I have no control over the type of ObjectInputstream passed as argument to the readObject method, which uses the bootstrap class loader.
    I give 5 duke stars to who can explain me a working solution.

    Thanks for the suggestion, but it doesn't work. Thread.currentThread().setContextClassLoader() appears to have no effect whatsoever on the class loader. Your suggestion about latestUserDefinedLoader() made me realise though that the situation is serious. This is a native method and it appears to be conceptually impossible to crack the standard ObjectInputStream for it to use the class loader of your choice. I filed a bug request for this.
    However, after a bit of thought I found a work around: if you can't control the way the EJB container serializes and deserializes objects, then serialize the objects before the EJB serializes them, pass the arguments as byte arrays and deserialize them only after the EJB container has deserialized them as byte arrays.
    You didn't give me the solution, but you made me realise that it wouldn't make sense to look for a conventional solution anymore, as there wouldn't be one so I give you one duke star. Thanks for the suggestion!

Maybe you are looking for

  • Confirmation

    we are facing error  in SRM 7.0 confirmation Line 1: No goods receipt possible for purchase order 7500000043 00001

  • Battery not charging

    Hi, I am using macbook white 2010-11 model. I was using this laptop in India and it was working fine. I have moved to Australia while charging my laptop it is showing a message near charging sign (Not Charging) i have followed few steps from earlier

  • What is the best (used) model of Xserve?

    Hello Xserve folk. I plan on purchasing a used Xserve soon somewhere like on eBay and using it in a data center to host some websites. (I now use an old Sun Raq 550) My question to you all: what would be the best model/configuration? Naturally a bran

  • If Apple EarPods just randomly decided to break into 2 pieces and get stuck in the headphone jack, will Apple replace or repair the iPad for free?

    After I was done listening to some music, I of course puller out the EarPods from the headphone jack. But then I noticed how the tip broke into 2, so half of the tip is stuck in the headphone jack. Since they were Apple EarPods, and I didn't inflict

  • ABAP client proxy   401 error

    Hi i have generated a ABAP client proxy in my ECC system and sending an outbound message to XI.  i get the following error. HTTP response contains status code 401 with the description Unauthorized Error while sending by HTTP (error code: 401, error t