OC4J classloading precedence

I am trying to establish the order of precedence fllowed by OC4J when it's trying to locate a particular class.
Given this expanded/exploded directory structure
j2ee
|
--home
|
--classes
|
--lib
|
--my_web_app
|
--WEB-INF
|
--classes
|
--lib
My understanding is that J2EE applications ought to follow this order of precedence:
WEB-INF/classes
WEB-INF/lib
<home>/classes
<home>/lib
However, one of colleagues reckons he has an OC4J installation where WEB-INF/lib is taking precedence over WEB-INF/classes.
I have to say that I have found nothing in the Oracle documentation to confirm which way OC4J operates. Is my understanding of J2EE at fault?
Can anybody out there clarify the matter for me?
Cheers, APC

Here is the response I got through paid support:
"There are at least 4 class loaders within OC4J:
(a) system class loader: e.g. for java.util.Date
(b) application launcher class loader: classes from oc4j.jar when oc4j is started with "java -jar oc4j.jar"
(c) server wide class loader: e.g. jar from j2ee/home/lib
(d) web app class loader: e.g. classes from WEB-INF
[They are hirarchical in some sense.]"
I assume the bean container is between c and d, but don't quote me on it.

Similar Messages

  • OC4J ClassLoader defect ??

    Hello,
    I try to load some resources (xml documents) from within some JARs inside my EAR, deployed on the OC4J container (904).
    To do so, I'll use the getResources(String) operation on the ClassLoader. This operation always returns an empty enumeration (of URLs). However, when I try to load just one resource using getResource(String), I do receive the correct resource URL.
    After some investigation, I noticed the java.lang.ClassLoader has 2 methods to serve both operations: findResource(String) and findResources(String) which must be overriden by the OC4J classloader implementation. My sense is telling me, only the findResource(String) is overriden and not the findResources(String) (since they return an empty enum by default). Furthermore, when I inspect the com.sun.enterprise.util.EJBClassLoader, this feeling is confirmed since, this class only implements the findResource(String) operation. Is there a reason for this behaviour or a work-around or am I just totally wrong?
    Anyway, thanx in advance for looking at my problem,
    Kind regards,
    Stijn

    Hello,
    The first thing that I will check is how you get the class loader from your context. Since you are in a J2EE container/application it is always a good practise to take the class loader of the current thread Thread.currentThread().getContextClassLoader(). Is it the way you are getting access to the class loader or your are using the System one (default).
    I will invite you to read about ClassLoader and OC4J in this technical paper.
    Regards
    Tugdual Grall

  • OC4J CLassloading Information

    gday All --
    Classloading questions are quite common on this forum. It's a complicated area and each container will more than likely have slightly different nuances in how it works.
    We have a very good technical paper which explains general classloading and the specifics of the implementation used in OC4J available on OTN.
    This document usually is able to provide answers to questions and issues that arise.
    http://otn.oracle.com/tech/java/oc4j/pdf/ClassLoadingInOC4J_WP.pdf
    It's a great document so I'd really like to encourage you to have a good look at it when you are thinking about class packaging, loading, etc.
    I'll put a link to it on the front page of the OC4J OTN area so it's more readily accessible.
    cheers
    -steve-

    Here is the response I got through paid support:
    "There are at least 4 class loaders within OC4J:
    (a) system class loader: e.g. for java.util.Date
    (b) application launcher class loader: classes from oc4j.jar when oc4j is started with "java -jar oc4j.jar"
    (c) server wide class loader: e.g. jar from j2ee/home/lib
    (d) web app class loader: e.g. classes from WEB-INF
    [They are hirarchical in some sense.]"
    I assume the bean container is between c and d, but don't quote me on it.

  • Connector Class Loader in OC4J Classloader Tree

    Where does connector class loader fit in the OC4J class loader tree. Is it a parent to the EJB Classloader (as in SunOne) or does it use its own classloader to load classes (similar to weblogic). Becos it can impact visibility into resource adapter's classes.

    The classloader tree in the ClassLoadingInOC4J_WP.pdf applies to 10.1.2 and 9.0.4, probably even earlier, where the connector classcloader is the root classloader of an application.
    For 10.1.3, the root classloader of an application loads both connector jars and ejb jars. See chapter 3 of Oracle Containers for J2EE Developer's Guide(10.1.3 preview).

  • JUnitEE in OC4J 904 gives ClassNotFountException

    Hi,
    I try to run JUnitEE tests from a war-file generated using the ant task from JUnitEE. When I run the test, I always get a 'Class not found' message. I checked and double checked the war-file, but the class is present in the WEB-INF/classes directory.
    I never had any problems with this with JBoss or WebLogic.
    Why can't OC4J find the test classes ?
    Regards,
    Joost

    It does load clases from the web-inf/classes directory.
    Can you post a stacktrace?
    Do you have all the classes available -- ie is it depending on some common 3rd party lib, such as xerces, etc. whic may be supplied by the other products?
    I'm not intimately familiar with JUnitEE, are the framework classes available somewhere for the server?
    Another thing to try is changing the classloader precedence so webapp classes are loaded FIRST from web-inf/*. This can be done by altering a setting in the orion-web.xml generated for your application (see j2ee/home/application-deployments/<app-name>/<webmodule-name>.
    You'll see a tag to uncomment which sets this behaviour.
    <!-- Uncomment this element to control web application class loader behavior.
    <web-app-class-loader search-local-classes-first="true"  include-war-manifest-class-path="true" />
    -->cheers
    -steve-

  • Dabu etal: per war classloader vs XML API per war

    OC4J classloader folks;
    A general problem for the deployment folks/production env
    is
    how to host or configure the deployment of war's that need specific versions or
    specific vendor's XML apis.
    IMO the XML api vendors, designers have not helped at all with package name spaces and
    top level factories and
    VM wide system properties for determining the instandiated engine.
    Anybody have thoughts on how a OC4J production environment can effectively be
    a "job shop" for deploying anonymous wars who might have internal dependancies on specific XML parsers, versions or vendors?
    Ok, so a little easier, we're not an anonymous war job-shop. We do know what's
    being deployed and have complete control over the wars. What help is this in
    solving the problem? :)
    Thanks, curt

    Hi Lars,
    Hay, the new tag <web-app-class-loader search-local-classes-first="true" />
    for 903 is great!
    I stand corrected, I would have bet $10, maybe $50, that this
    is the default behavior of a J2EE container. :)
    But I'm on 902 OC4J so this isn't available anyway.
    BTW, whats the rationale for this NOT being default behavior?
    You know if other J2EE containers do class loading from world on down to war by default
    too?
    Thanks
    curt

  • OC4j CLASSPATH unable to find my jar, no EJB3 injection

    Hello,
    I have a problem deploying my application.
    I am working with OAS 10.1.3.3, developing an application with jdeveloper 10.1.x.
    I need to deploy an EJB3 application, but I have a lot of deployment problems. To find a solution I tried a step by step deployment.
    Firs: From my servlet I call some functions, which using classes from a separate jar file. The oc4j classloader can´t find my classes. I checked a lot to fix that with no success. The library is located in WEB-INF/lib, the element can be found. The error message states that the class can´t be found in the class path, only in the lib path. But this should be done automatically.
    I tried some different entries in the MANIFEST.mf, but with the same result. I thought it could be a loader problem, but as stated it´s the same loader. I still don´t have any idea.
    10/12/08 17:08:33.860 asn1-frontend-war: 10.1.3.3.0 Started
    10/12/08 17:10:06.999 asn1-frontend-war: Servlet error
    oracle.classloader.util.AnnotatedNoClassDefFoundError:
         Missing class: com.opensynergy.car2xreference.backend.model.typeuniverse.generic.communicationprotocol.Message
         Dependent class: com.opensynergy.car2xreference.backend.asn1.marben.impl.ASN1CoderFacade
         Loader: asn1-frontend-war.web.asn1-frontend-war:0.0.0
         Code-Source: /opt/oracle/ias10133/j2ee/home/applications/asn1-frontend-war/asn1-frontend-war/WEB-INF/classes/
         Configuration: WEB-INF/classes/ in /opt/oracle/ias10133/j2ee/home/applications/asn1-frontend-war/asn1-frontend-war/WEB-INF/classes
    The missing class is available from the following locations:
         1. Code-Source: /opt/oracle/ias10133/j2ee/home/applications/asn1-frontend-war/asn1-frontend-war/WEB-INF/lib/model-jar.jar (from WEB-INF/lib/ directory in /opt/oracle/ias10133/j2ee/home/applications/asn1-frontend-war/asn1-frontend-war/WEB-INF/lib)
         This code-source is available in loader asn1-frontend-war.web.asn1-frontend-war:0.0.0.
         at oracle.classloader.PolicyClassLoader.handleClassNotFound (PolicyClassLoader.java:2068) [opt/oracle/ias10133/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@27634497]
    Second problem is, that I get an NullPointerException, if I call any EJB from my servlet. My code isn´t special. To fix that I tried a simple hello world example from my servlet which fails.
    The code is
    public class VehicleEndpointBackingBeanImpl extends VehicleEndpoint {
    @EJB(name = "EJBManager")
    EJBManager manager;
    void process(){
    manager.sayHello();
    and the EJB looks like that:
    @Stateless(name="EJBManager")
    @StatelessDeployment(
    minInstances=5,
    poolCacheTimeout=90
    public class EJBManagerBean implements EJBManager, EJBManagerLocal {
    @PersistenceContext(unitName="JobEventMechanism")
    as you can see a simple hello world example.
    I checked the EnterpriseManager and found, that the application contains the EJB Session Bean. The table from em is:
    Session Beans
    Name [Sorted in ascending order]      Type     Active EJB Methods     Method Execution Time (seconds)     Method Execution Rate (per second)
    "EJBManager"     Stateless Session Bean     Unavailable     Unavailable     Unavailable
    In some examples I have seen that people working with InitialContext, but I am sure that in EJB3 it isn´t necessary.
    I extended the application with an ejb-jar.xml where I added
    <enterprise-beans>
    <session>
    <ejb-name>EJBManager</ejb-name>
    </session>
    with no effect. So how can I fix this?
    Any help welcome, I can´t find a solution. Are there some hints for JDEveloper or so?
    Bye
    Rolf-Dieter

    yes Everything you say is right in my prog. but it still does n't works.
    i haven't set my j2ee_classpath & does it have anything to do with my error.
    if so, where to find the drivers(MS-SQL) .jar file.
    Thank You for Your reply
    -Suresh Kumar.R

  • Class not found JBoss rules

    servlet crashes at run time:
    06/09/27 16:44:52 CharScanner; panic: ClassNotFoundException: org.antlr.stringtemplate.language.ChunkToken
    06/09/27 16:44:52 Shutting down OC4J...
    I've checked and the class is included in the project libraries (In fact I got a little frustrated and included all the JBoss rules jars.
    anyhow I don't see why it can't find an included library

    Can you try and see if copying the jar files to the
    [jdev-root]\j2ee\home\lib directory helps?That didn't help unfortunately. I've been trying to understand how oc4j classloading works - were you assuming that:
    "The missing class is present, but the loader configured to use it is a child of the initiating loader." - (from the ..conatainers for j2ee developers guide)?
    I've also tried deploying to a .war file in JDeveloper and tested it with tomcat where it works fine. Deploying the same .war file thorugh the oc4j (launched in standalone mode) web interface results in the same problem - bringing down the oc4j server - as it does clicking 'run' in JDeveloper.
    Is there some code I can put in my servlet (it's an extremely simple web-app to test using drools with oc4j) to output what classloaders are active and where they are looking? I've never had to do this before either.

  • AspectJ load time weaving AnnotatedNoClassDefFoundError

    I am trying to use AspectJ load time weaving on an application running on OC4J 10.1 on JRE 1.5. I get AnnotatedNoClassDefFoundError with Missing class: org.aspectj.runtime.internal.AroundClosure message.
    Here is what I am doing:
    1. Starting the server with JVM argument -javaagent:aspectjweaver.jar to enable AspectJ load time weaving.
    2. I put an AspectJ library MaintainJAspect.jar under j2ee\home\applib folder.
    3. I put the aspect defined in aop.xml at j2ee\home\applib\META-INF\aop.xml .
    The aspect defined in aop.xml is properly weaved into the application class (I can see in the dumped source). But when the application is running, it fails with the message pasted below.
    My question is, while it says that the missing class is available in oc4j classloader, which is parent of system and application class loaders, why is it not available to my application?
    Thanks in advance,
    Choudary Kothapalli.
    oracle.classloader.util.AnnotatedNoClassDefFoundError:
         Missing class: org.aspectj.runtime.internal.AroundClosure
         Dependent class: com.maintainj.aspect.ExecutionAspect
         Loader: global.libraries:1.0
         Code-Source: /C:/Programs/oc4j10/j2ee/home/applib/MaintainJAspect.jar
         Configuration: <code-source> in /c:/Programs/oc4j10/j2ee/home/config/server.xml
    The missing class is available from the following locations:
         1. Code-Source: /C:/Programs/oc4j10/j2ee/home/maintainj/aspectjweaver.jar (from system property java.class.path)
         This code-source is available in loader oc4j:10.1.3.
         at oracle.classloader.PolicyClassLoader.handleClassNotFound (PolicyClassLoader.java:2068) [C:/Programs/oc4j10/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@9627532]
         at oracle.classloader.PolicyClassLoader.internalLoadClass (PolicyClassLoader.java:1679) [C:/Programs/oc4j10/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@9627532]
         at oracle.classloader.PolicyClassLoader.loadClass (PolicyClassLoader.java:1635) [C:/Programs/oc4j10/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@9627532]
         at oracle.classloader.PolicyClassLoader.loadClass (PolicyClassLoader.java:1620) [C:/Programs/oc4j10/j2ee/home/lib/pcl.jar (from system property java.class.path), by sun.misc.Launcher$AppClassLoader@9627532]
         at java.lang.ClassLoader.loadClassInternal (ClassLoader.java:319) [jre bootstrap, by jre.bootstrap:1.5.0_08]
         at com.maintainj.aspect.ExecutionAspect.ajc$around$com_maintainj_aspect_ExecutionAspect$1$133697c9proceed (ExecutionAspect.aj:1) [C:/Programs/oc4j10/j2ee/home/applib/MaintainJAspect.jar (from <code-source> in /c:/Programs/oc4j10/j2ee/home/config/server.xml), by global.libraries:1.0]
         at com.maintainj.aspect.ExecutionAspect.ajc$around$com_maintainj_aspect_ExecutionAspect$1$133697c9 (ExecutionAspect.aj:42) [C:/Programs/oc4j10/j2ee/home/applib/MaintainJAspect.jar (from <code-source> in /c:/Programs/oc4j10/j2ee/home/config/server.xml), by global.libraries:1.0]
         at simple.SimpleServlet.<init> (SimpleServlet.java:12) [C:/Programs/oc4j10/j2ee/home/applications/SimpleWeb/SimpleWeb/WEB-INF/classes/ (from WEB-INF/classes/ in C:\Programs\oc4j10\j2ee\home\applications\SimpleWeb\SimpleWeb\WEB-INF\classes), by SimpleWeb.web.SimpleWeb:0.0.0]

    Not sure what you mean by "support". AspectJ rewrites bytecodes so the VM will just execute them. You'll probably encounter increased memory usage with load-time weaving as class loading/initialization occurs in Immortal memory. Also load-time weaving won't be compatible with Java RTS's Initialization Time Compilation (ITC) feature ... or at least not the pre-initialization part. It's likely that no-heap threads won't work well running weaved code if there are any references back to heap-allocated AspectJ runtime objects, and similarly (like most libraries) it's not likely to work from scoped memory.
    HTH.
    David Holmes

  • Jdbc 10.1.0.4 & OCF4 9.0.4

    Hi all,
    I've replaced the jdbc Thin driver 9i (nls_charset12.jar, classes12.jar) by the 10g version (ojdbc14.jar, orai18n.jar, ocrs12.jar) in my application.
    It compiles fine, but when the application is deployed in the middle tier (iAS & OC4J 9.0.4.0.0), I got this error:
    java.lang.NoSuchMethodError: oracle.sql.CharacterSet.AL32UTF8ToString([BII)Ljava/lang/String;     at oracle.jdbc.driver.DBConversion.CharBytesToString(DBConversion.java:527)     at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:672)     at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)     at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:348)     at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:151)     at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)     at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:563)     at java.sql.DriverManager.getConnection(DriverManager.java:512)     at java.sql.DriverManager.getConnection(DriverManager.java:140)     at oracle.toplink.sessions.DefaultConnector.connect(DefaultConnector.java:57)     at oracle.toplink.sessions.DatabaseLogin.connect(DatabaseLogin.java:218)     at oracle.toplink.internal.databaseaccess.DatabaseAccessor.connect(DatabaseAccessor.java:398)     at oracle.toplink.internal.databaseaccess.DatabaseAccessor.connect(DatabaseAccessor.java:423)     at oracle.toplink.threetier.ConnectionPool.buildConnection(ConnectionPool.java:90)     at oracle.toplink.threetier.ConnectionPool.startUp(ConnectionPool.java:328)     at oracle.toplink.threetier.ServerSession.connect(ServerSession.java:447)     at oracle.toplink.publicinterface.DatabaseSession.login(DatabaseSession.java:531)     at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(SessionManager.java:250)     at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(SessionManager.java:181)     at oracle.skill.model.toplink.common.ToplinkUtils.getSession(ToplinkUtils.java:174)     at oracle.skill.model.toplink.common.ToplinkUtils.getClientSession(ToplinkUtils.java:163)     at oracle.security.controller.struts.action.CheckAppAvailability.execute(CheckAppAvailability.java:83)     at oracle.jheadstart.controller.struts.action.JhsAction.execute(JhsAction.java:245)     at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)     at oracle.jheadstart.controller.struts.JhsRequestProcessor.processActionPerform(JhsRequestProcessor.java:351)     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)     at oracle.jheadstart.controller.struts.JhsRequestProcessor.process(JhsRequestProcessor.java:635)     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)     at oracle.jheadstart.controller.struts.JhsActionServlet.process(JhsActionServlet.java:139)     at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)     at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)     at oracle.security.controller.AuthenticationFilter.doFilter(AuthenticationFilter.java:171)     at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)     at oracle.jheadstart.controller.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:174)     at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:600)     at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)     at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)     at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)     at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)     at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)     at java.lang.Thread.run(Thread.java:534)
    I just want my application use only those libraries placed in the ear file, none from the continer ..
    In the Jdbc Forum, I was told that the issue is probably due to the way the OC4J Classloader works ..
    Could someone help me ?
    Thanks in advance,
    Eduardo.

    Eduardo,
    Have you either:
    (1) edited the MANIFEST.MF within oc4j.jar so that there is no reference to classes12.jar or classes12dms.jar and instead there are references to ojdbc14.jar which you will have copied into jdbc/lib
    or
    (2) have a look at Note:305679.1 - they have another way of editing the jdbc driver config there using java.ext.dir
    Regards,
    pj.

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

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

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

  • Problem with behavior of the Thread Context ClassLoader on OC4J 10.1.3.2.0

    Hi,
    We run into different behavior of the Thread Context ClassLoader on OC4J 10.1.3.1.0 (which is OK) and OC4J 10.1.3.2.0 (here we have problems). It appeared in the Threads directly and indirectly (e.g. through Timer) created by our application. Threads, created by OC4j (e.g. the Thread, where our start-up servlet are running) are OK.
    Thread Context ClassLoader (could be received from Thread.currentThread().getContextClassLoader()) on OC4J 10.1.3.1.0 in all threads is the same ClassLoader instance as the current ClassLoader (could be received from getClass().getClassLoader()). Actually the same is true for JBoss, WebLogic and WebSphere.
    Thread Context ClassLoader on OC4J 10.1.3.2.0 is NOT the same ClassLoader instance as the current ClassLoader, it is even the instance of the different Class. This ClassLoader does not see classes, available at application level, which causes multiple problems.
    Is it possible to configure OC4J 10.1.3.2.0 to behave similar to OC4J 10.1.3.1.0?
    We tried to use “–userThreads”, but it did not help.
    To investigate this problem we created a simple Web Application, which has Start-up Servlet, creates one thread and one Timer Task. From each point it is checking if Thread Context ClassLoader is the same ClassLoader instance as the current ClassLoader and printing Class Loaders if they are different. In addition it checks if correct parser accessed (should be xerces, which is in the Web App classpath and for which we added a shared library). Below you could see what we received on OC4J 10.1.3.1.0 (which is OK) and OC4J 10.1.3.2.0:
    E:\OracleAS_1\j2ee\home>java -Xms128m -Xmx1024m -jar oc4j.jar -userThreads
    07/04/30 10:33:00 Oracle Containers for J2EE 10g (10.1.3.1.0) initialized
    07/04/30 10:39:31 ------In StartupServlet Init-----
    07/04/30 10:39:31 +++++++ ++++++++++++++++++++++++++++++++++++ ++++++++
    07/04/30 10:39:31 +++++++ Executing Code in the StrtServlet... ++++++++
    07/04/30 10:39:31 +++++++ (this Thread created by App Server) +++++++++
    07/04/30 10:39:31 ClassLoaders: fromClass = getClass().getClassLoader() = <TestL
    oaders.web.TestLoaders:0.0.0>*******<class oracle.classloader.PolicyClassLoader
    07/04/30 10:39:31 fromThread =Thread.currentThread().getContextCla
    ssLoader() = <TestLoaders.web.TestLoaders:0.0.0>*******<class oracle.classloader
    .PolicyClassLoader
    07/04/30 10:39:31 ******* THE SAME CLASSLOADER USED IN BOTH PLACES!!! *******
    07/04/30 10:39:31 DocumentBuilderFactory = <org.apache.xerces.jaxp.DocumentBuild
    erFactoryImpl@1908ba7>*******
    07/04/30 10:39:31 C O R R E C T !!!
    07/04/30 10:39:31 -CWD- =E:\OracleAS_1\j2ee\home; uer directory = E:\OracleAS_1\
    j2ee\home
    07/04/30 10:39:31 Constructing the Timer Task...
    07/04/30 10:39:31 Starting some Timer...
    07/04/30 10:39:31 Some Timer is started ...
    07/04/30 10:39:31 ------All actions done Successfully--------
    07/04/30 10:39:41 +++++++ +++++++++++++++++++++++++++++++++++ ++++++++
    07/04/30 10:39:41 +++++++ Executing Code in the new Thread... ++++++++
    07/04/30 10:39:41 ClassLoaders: fromClass = getClass().getClassLoader() = <TestL
    oaders.web.TestLoaders:0.0.0>*******<class oracle.classloader.PolicyClassLoader
    07/04/30 10:39:41 fromThread =Thread.currentThread().getContextCla
    ssLoader() = <TestLoaders.web.TestLoaders:0.0.0>*******<class oracle.classloader
    .PolicyClassLoader
    07/04/30 10:39:41 ******* THE SAME CLASSLOADER USED IN BOTH PLACES!!! *******
    07/04/30 10:39:41 DocumentBuilderFactory = <org.apache.xerces.jaxp.DocumentBuild
    erFactoryImpl@17e5e56>*******
    07/04/30 10:39:41 C O R R E C T !!!
    07/04/30 10:40:31 +++++++ +++++++++++++++++++++++++++++++++++ ++++++++
    07/04/30 10:40:31 +++++++ Executing the Session Timer Task... ++++++++
    07/04/30 10:40:31 ClassLoaders: fromClass = getClass().getClassLoader() = <TestL
    oaders.web.TestLoaders:0.0.0>*******<class oracle.classloader.PolicyClassLoader
    07/04/30 10:40:31 fromThread =Thread.currentThread().getContextCla
    ssLoader() = <TestLoaders.web.TestLoaders:0.0.0>*******<class oracle.classloader
    .PolicyClassLoader
    07/04/30 10:40:31 ******* THE SAME CLASSLOADER USED IN BOTH PLACES!!! *******
    07/04/30 10:40:31 DocumentBuilderFactory = <org.apache.xerces.jaxp.DocumentBuild
    erFactoryImpl@1c6988d>*******
    07/04/30 10:40:31 C O R R E C T !!!
    07/04/30 10:44:01 Shutting down OC4J...
    07/04/30 10:44:01
    E:\OracleAS_1\j2ee\home>
    C:\oc4j\j2ee\home>java -Xms128m -Xmx1024m -classpath .;oc4j.jar;C:\oc4j\j2ee\hom
    e\properties -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socke
    t,address=3999,server=y,suspend=n -jar oc4j.jar -userThreads
    07/05/01 21:14:33 ------In StartupServlet Init-----
    07/05/01 21:14:33 +++++++ ++++++++++++++++++++++++++++++++++++ ++++++++
    07/05/01 21:14:33 +++++++ Executing Code in the StrtServlet... ++++++++
    07/05/01 21:14:33 +++++++ (this Thread created by App Server) +++++++++
    07/05/01 21:14:33 ClassLoaders: fromClass = getClass().getClassLoader() = <TestL
    oaders.web.TestLoaders:0.0.0>*******<class oracle.classloader.PolicyClassLoader
    07/05/01 21:14:33 fromThread =Thread.currentThread().getContextCla
    ssLoader() = <TestLoaders.web.TestLoaders:0.0.0>*******<class oracle.classloader
    .PolicyClassLoader
    07/05/01 21:14:33 ******* THE SAME CLASSLOADER USED IN BOTH PLACES!!! *******
    07/05/01 21:14:33 DocumentBuilderFactory = <org.apache.xerces.jaxp.DocumentBuild
    erFactoryImpl@723c42>*******
    07/05/01 21:14:33 C O R R E C T !!!
    07/05/01 21:14:33 -CWD- =C:\oc4j\j2ee\home; uer directory = C:\oc4j\j2ee\home
    07/05/01 21:14:33 Constructing the Timer Task...
    07/05/01 21:14:33 Starting some Timer...
    07/05/01 21:14:33 Some Timer is started ...
    07/05/01 21:14:33 ------All actions done Successfully--------
    07/05/01 21:14:33 Oracle Containers for J2EE 10g (10.1.3.2.0) initialized
    07/05/01 21:14:43 +++++++ +++++++++++++++++++++++++++++++++++ ++++++++
    07/05/01 21:14:43 +++++++ Executing Code in the new Thread... ++++++++
    07/05/01 21:14:43 ClassLoaders: fromClass = getClass().getClassLoader() = <TestL
    oaders.web.TestLoaders:0.0.0>*******<class oracle.classloader.PolicyClassLoader
    07/05/01 21:14:43 fromThread =Thread.currentThread().getContextCla
    ssLoader() = <[ThreadContextLoader, current context: TestLoaders.web.TestLoaders
    :0.0.0]>*******<class com.evermind.server.ApplicationContextClassLoader
    07/05/01 21:14:43 ******************************************************
    07/05/01 21:14:43 Chain of ClassLoaders from Class
    07/05/01 21:14:43 --- TestLoaders.root:0.0.0 --- class oracle.classloader.Polic
    yClassLoader
    07/05/01 21:14:43 --- default.root:0.0.0 --- class oracle.classloader.PolicyCla
    ssLoader
    07/05/01 21:14:43 --- system.root:0.0.0 --- class oracle.classloader.PolicyClas
    sLoader
    07/05/01 21:14:43 --- oc4j:10.1.3 --- class oracle.classloader.PolicyClassLoade
    r
    07/05/01 21:14:43 --- api:1.4.0 --- class oracle.classloader.PolicyClassLoader
    07/05/01 21:14:43 --- jre.extension:0.0.0 --- class oracle.classloader.PolicyCl
    assLoader
    07/05/01 21:14:43 --- jre.bootstrap:1.4.2_08 --- class oracle.classloader.Polic
    yClassLoader
    07/05/01 21:14:43 --- null ---
    07/05/01 21:14:43 ********** End of Chain of ClassLoaders **************
    07/05/01 21:14:43 ******************************************************
    07/05/01 21:14:43 Chain of ClassLoaders from Thread
    07/05/01 21:14:43 --- oc4j:10.1.3 --- class oracle.classloader.PolicyClassLoade
    r
    07/05/01 21:14:43 --- api:1.4.0 --- class oracle.classloader.PolicyClassLoader
    07/05/01 21:14:43 --- jre.extension:0.0.0 --- class oracle.classloader.PolicyCl
    assLoader
    07/05/01 21:14:43 --- jre.bootstrap:1.4.2_08 --- class oracle.classloader.Polic
    yClassLoader
    07/05/01 21:14:43 --- null ---
    07/05/01 21:14:43 ********** End of Chain of ClassLoaders **************
    07/05/01 21:14:43 DocumentBuilderFactory = <oracle.xml.jaxp.JXDocumentBuilderFac
    tory@74a138>*******
    07/05/01 21:14:43 WRONG !!! Should be org.apache.xerces.jaxp.DocumentBuilderFact
    oryImpl
    07/05/01 21:15:33 +++++++ +++++++++++++++++++++++++++++++++++ ++++++++
    07/05/01 21:15:33 +++++++ Executing the Session Timer Task... ++++++++
    07/05/01 21:15:33 ClassLoaders: fromClass = getClass().getClassLoader() = <TestL
    oaders.web.TestLoaders:0.0.0>*******<class oracle.classloader.PolicyClassLoader
    07/05/01 21:15:33 fromThread =Thread.currentThread().getContextCla
    ssLoader() = <[ThreadContextLoader, current context: TestLoaders.web.TestLoaders
    :0.0.0]>*******<class com.evermind.server.ApplicationContextClassLoader
    07/05/01 21:15:33 **************************************************
    07/05/01 21:15:33 Chain of ClassLoaders from Class
    07/05/01 21:15:33 --- TestLoaders.root:0.0.0 --- class oracle.classloader.Polic
    yClassLoader
    07/05/01 21:15:33 --- default.root:0.0.0 --- class oracle.classloader.PolicyCla
    ssLoader
    07/05/01 21:15:33 --- system.root:0.0.0 --- class oracle.classloader.PolicyClas
    sLoader
    07/05/01 21:15:33 --- oc4j:10.1.3 --- class oracle.classloader.PolicyClassLoade
    r
    07/05/01 21:15:33 --- api:1.4.0 --- class oracle.classloader.PolicyClassLoader
    07/05/01 21:15:33 --- jre.extension:0.0.0 --- class oracle.classloader.PolicyCl
    assLoader
    07/05/01 21:15:33 --- jre.bootstrap:1.4.2_08 --- class oracle.classloader.Polic
    yClassLoader
    07/05/01 21:15:33 --- null ---
    07/05/01 21:15:33 ********** End of Chain of ClassLoaders **********
    07/05/01 21:15:33 **************************************************
    07/05/01 21:15:33 Chain of ClassLoaders from Thread
    07/05/01 21:15:33 --- oc4j:10.1.3 --- class oracle.classloader.PolicyClassLoade
    r
    07/05/01 21:15:33 --- api:1.4.0 --- class oracle.classloader.PolicyClassLoader
    07/05/01 21:15:33 --- jre.extension:0.0.0 --- class oracle.classloader.PolicyCl
    assLoader
    07/05/01 21:15:33 --- jre.bootstrap:1.4.2_08 --- class oracle.classloader.Polic
    yClassLoader
    07/05/01 21:15:33 --- null ---
    07/05/01 21:15:33 ********** End of Chain of ClassLoaders **********
    07/05/01 21:15:33 DocumentBuilderFactory = <oracle.xml.jaxp.JXDocumentBuilderFac
    tory@1d12d43>*******
    07/05/01 21:15:33 WRONG !!! Should be org.apache.xerces.jaxp.DocumentBuilderFact
    oryImpl
    Any help will be greatly appreciated.
    Thanks

    Sorry for confusion, version of OC4J does not really meter, but jdk does. It happened that in the case where everything OK (OC4J 10.1.3.1.0) I accidentally used jdk 1.5. Now I tried both (OC4J 10.1.3.1.0 and OC4J 10.1.3.2.0) with j2sdk1.4.2_14 (besides I tried j2sdk1.4.2_09 and _08) and j2sdk1.5.0_06.
    With JDK 1.5 everything is OK and with JDK 1.4 we have a problem, described in the previous posting. I believe now I should reformulate my initial question:
    Is it possible to configure OC4J 10.1.3 running under j2sdk1.4.2_14 to force Thread Context ClassLoader to behave similar to OC4J 10.1.3 under j2sdk1.5.0_06? If yes, how we could do it?
    Thanks

  • OC4J (9.0.2) problem with the classloader

    Dear all,
    We have developped an application which will run into the Application Server.
    Our application writes a .java file at RunTime and compiles it with the javac compiler, into a custom directory. This is done without problems. After the building step, our application instantiates the new compiled classes. To perform this task, we have written a custom ClassLoader which searches (into a custom directory) and loads these classes.
    The PROBLEM is that this procedure, works very well if the application is running outside the application server ( launching it by hands ), but it crashes, with a java.lang.NoClassDefFoundError exception, when it's running into the OC4J AS. In particular our application, when is running into OC4J, is launched by a Session EJB.
    Do you have any suggestions ? I think this could be related to a security issue, but I'm not sure.
    Best regards,
    davide

    Davide,
    Why do you need a custom class loader ? Why can't you compile the class to a location that is in your application class path then use
    Thread.currentThread().getContextClassLoader() to load that class. We were having similar problems loading properties files in EJBs and we were able to fix it by using Thread.currentThread().getContextClassLoader to load the properties file.
    One caveat is that you need to specify the location of the compiled class/resource in the orion-application.xml file using the following tag. Please note that the path specified here is relative to the location of the orion-application.xml file (application-deployments directory)
    <library path="../../applications/cfaupdater/" />
    Of Course we did all this in 9.0.4 to load properties files so your situation is a little different but you could try this to see if it works

  • Strange classloader experience with toplink-essentials on Oc4j-10.1.3.3.0

    Hi,
    I am teaching classes at the Eotvos University/Budapest on a topic where OC4J has been used for 2 years. Students use jdeveloper (regularly updated) to create webapps with EJB3.0+toplink backends. They test their projects first with the JDeveloper embedded OC4J, but after that they deploy it on a central server running standalone OC4J.
    Students make quite an intensive and versatile use of the OC4J server, a noteworthy stress-test you may find interesting! The server is a Ubuntu Linux with JDK_1.5.0_14.
    1. The first known issue is that after about 10 projects are deployed (small class projects 3-4 EJBs, 3-4 JSP-s each), oc4j regularl goes into a "runaway" mode, i.e. the CPU utilization of the JVM process goes up to 99-100%. Static web content is still available, but all applications stop responding. I can state pretty safely that the applications deployed are fairly harmless and it is not even necessary to run them to make this happen. I.e. after 10-15 apps are depoyed it is enough to start the admin-client.jar or the admin console to experience this problem. (The applications have no problem individually: last year after these issues occurred, we installed them individually for grading and nothing like this happened).
    Let me point out that SO FAR this happened with Oc4j-10.1.3.1 and Oc4j-10.1.3.2 only, and this was the main reason we swithed to Oc4j-10.1.3.3.0
    2. Another issue that exists both with the earlier versions and 10.1.3.3.0 is that applications need to include the toplink-essentials.jar explicitely if they use EJB3.0 entities. It appears to me that this should not be neessary as there are default definitions for that in config/server.xml (a shared-library definition for toplink-essentials), and in config/system-application.xml (a corresponding import-shared-library tag), but still their applications cannot be deployed because of the follwing error:
    Deploy error: Deploy error: Operation failed with error:
    Hiányzó osztály: oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
    FĂĽggĹ' osztály: com.evermind.server.ejb.persistence.PersistenceUnitManagerImpl
    BetöltĹ': oc4j:10.1.3
    Kódforrás: /opt/oc4j_101330/j2ee/home/lib/oc4j-internal.jar
    (On our machines, JDK displays some errors in Hungarian: HiányzĂł osztály=Missing class; FĂĽggĹ' osztály=Dependent class; BetöltĹ'=Loader; KĂłdforrás=Code source.)
    To fix this issue, we used a workaround, i.e. their orion-application.xml is regularly extended with something like:
    <library path="/opt/oc4j/toplink/jlib/toplink-essentials.jar"/>
    And this solved the problem. Can you explain this?
    3. Now, with 10.1.3.3.0 this did not help much either. Although the toplink-essentials.jar was found, another nasty exception happened in the server still during deployment:
    Caused by: java.lang.NoSuchMethodException: oracle.toplink.essentials.platform.server.oc4j.Oc4jPlatform.<init>(oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl)
    at java.lang.Class.getConstructor0(Class.java:2678)
    at java.lang.Class.getConstructor(Class.java:1629)
    at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.updateServerPlatform(EntityManagerSetupImpl.java:309)
    Apparently a class in toplink-essentials.jar (version 2, build 41, i.e. the one that comes with oc4j) cannot properly invoke a the constructor of another class IN THE SAME JAR.
    I checked everything, even unzipped and checked the class signatures, and also made sure that there is no other toplink-essentials.jar in the classpath. Still the error remained.
    FInally, I tried to add the above libary tag to $OC4J_HOME/config/apllication.xml instead of the applications local orion-application.xml, and - voila!!! - it WORKS now!
    Can you explain all this to me? From the documentation the location of the <library> tag in the descriptor files should not amke any difference, but still it seems to do.
    Regards: Arpad Bakay

    Seems to be a bug. That was the response from Oracle support (Metalink)
    Response:
    Your issue seems to be related to bug 5594702 - Abstract: EJB30 ENTITY BEAN WITH @ID AND @COLUMN ANNOTATION FAILS TO DEPLOY ON AIX.
    There is an issue with the IBM JDK/JRE 1.5's processing of annotations.
    Links:
    http://www.theserverside.com/discussions/thread.tss?thread_id=37764
    http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?forum=367&thread=112543&cat=10
    When processing annotations it returns boolean values as false.
    Work-around:
    Fully specify the @Column annotation's boolean values. If insertable and updatable are set to false (which will happen due to this bug) then TopLink sets the PK
    mapping to read-only and the exception seen is expected.
    Note: nullable attribute of the @Colmun is not used in the EJB3/JPA preview of 10.1.3.0 If the customer MUST override the default column name then they should use:
    @Column(name="column-name", insertable=true, updatable=true)
    If they do not wish to override the default column name then simply do not use an @Column annotation.
    It can be deleted or commented out in the JDev generated code.
    There are two reported annotation processing issues with the AIX JVM. One was fixed in SR1 and the other is fixed
    in SR3 (due out Oc 11 - today). Upgrading to these more recent JVM releases may also address this issue.
    RECOMMENDED SOLUTIONS:
    1. Upgrade the IBM AIX JVM to SR3.
    OR
    2. Fix all generated @Column annotations as described above

  • Classloader problem on deployment in OC4J...

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

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

Maybe you are looking for