Too early class loading

Hello,
From the vm spec, it is not clear when should the Exception class should be loaded.
After compiling the following, I just removed XException.class.
In case there is no exception thrown by f(), no java.lang.NoClassDefFoundError should thrown. But java 1.4.2_04 does throw:
Exception in thread "main" java.lang.NoClassDefFoundError: XException
-------------------x cut here x--------------------------------------------
class XException extends java.io.IOException {}
public class A {
static void f () throws XException{
if ((int)Math.random() == 1) {
System.out.println ("I'm throwing!");
throw new XException(); }}
public static void main (String args[]) {
try { f (); } catch (XException e) {}}
-------------------x cut here x--------------------------------------------

Why is it that verification process of method requires
the exception class mentioned in the exceptions
classes should be loaded? I couldn't find any
reference related to exception tables in the
verification procedures.
I know that current implementation of SUN does load
the exception class. But the question is:
Is it strictly required behavior for the conformance
to the JVM spec?
The specification is sometimes to obscure in the sense
that the class loading time is not explicitly
specified except the class should be initialized
before its first active use and loading and resolving
should be happened before the initialization.Like I said I was not able to find any thing in the spec that said that it should happen that way.
On the other hand I couldn't find anything that said it shouldn't either.
Nor did I find anything in the Java Spec Report either for or against.

Similar Messages

  • Force early class loading

    Hi there!
    Correct me if I'm wrong, but the later JVMs are loading classes when needed instead of right when starting the JVM. At least this is a common complaint here...
    This is quite bad for our app, it loads at system startup and runs a server thread, waiting for a connection from another machine, and upon establishing the connection, it pops up a rather complex GUI. You might guess, class loading here takes up a lot of time and results in a slow percepted response time.
    I don't want to "preload" the GUI for some reasons. Is there a way to force the JVM to load all classes in advance?

    Good idea, but not suitable for 1300 classes, I guess. Thanks anyway.

  • JSP class loader

              Hi,
              I have a static block within a JSP page that get executed twice when it's being executed!
              Based on the output, you can see that it's being loaded by two separated class loaders:
              'weblogic.utils.classloaders.RecursiveReloadOnModifyClassLoader$Slave' and 'weblogic.servlet.jsp.OneOffJspLoader'.
              Can anyone shed some light on this issue? I can see that this might cause a lot
              of problem if the logic relies on the static block only executing once.
              thanks,
              -vu
              /** Code starts here **/
              <%!
              static
                   System.out.println("\n\nThis is the static block!!!!");
                   try {
              System.out.println("Static classloader: " +
              Class.forName("jsp_servlet._helloworld").getClassLoader().getClass().getName()
              + "\n\n");
                   catch (java.lang.ClassNotFoundException cne) { }
              %>
              <%
                   System.out.println("Hello World.");
                   System.out.println("Class name: " + this.getClass().getName());
                   System.out.println("Class loader: " +
              page.getClass().getClassLoader().getClass().getName());
              %>
              /** code ends here **/
              /** Program's Output to Stdout **/
              This is the static block!!!!
              Static classloader: weblogic.utils.classloaders.RecursiveReloadOnModifyClassLoader$Slave
              This is the static block!!!!
              Static classloader: weblogic.servlet.jsp.OneOffJspLoader
              Hello World.
              Class name: jsp_servlet._helloworld
              Class loader: weblogic.servlet.jsp.OneOffJspLoader
              /** End OUtput **/
              

              Well, I wouldn't say expected - obviously this poster (and others)
              don't expect it, and correct is debatable.
              Why in the *&^%* is it necessary to load the class twice? And I
              don't mean two hours apart either - when you hit a JSP for the
              first time, it gets loaded twice - one right after the other.
              This wastes time and memory. When the JVMs and WLS clusters are
              failing (and they are) because of too much class loading - it is
              a big problem.
              Mike
              "Cameron Purdy" <[email protected]> wrote:
              >Don't rely on static code only being executed once. What
              >you are seeing is
              >not only legal, it is expected and correct behavior.
              >
              >BTW - don't put static blocks in your JSP page. Use lazy
              >initializers that
              >store the result in app scope if you have to.
              >
              >Peace,
              >
              >--
              >Cameron Purdy
              >Tangosol, Inc.
              >http://www.tangosol.com
              >+1.617.623.5782
              >WebLogic Consulting Available
              >
              >
              >"Vu Nguyen" <[email protected]> wrote in message
              >news:[email protected]...
              >>
              >> Hi,
              >>
              >> I have a static block within a JSP page that get executed
              >twice when it's
              >being executed!
              >> Based on the output, you can see that it's being loaded
              >by two separated
              >class loaders:
              >> 'weblogic.utils.classloaders.RecursiveReloadOnModifyClassLoader$Slave'
              >and
              >'weblogic.servlet.jsp.OneOffJspLoader'.
              >> Can anyone shed some light on this issue? I can see
              >that this might
              >cause a lot
              >> of problem if the logic relies on the static block only
              >executing once.
              >>
              >> thanks,
              >> -vu
              >>
              >>
              >>
              >> /** Code starts here **/
              >> <%!
              >> static
              >> {
              >> System.out.println("\n\nThis is the static block!!!!");
              >> try {
              >> System.out.println("Static classloader:
              >" +
              >>
              >Class.forName("jsp_servlet._helloworld").getClassLoader().getClass().getName
              >()
              >> + "\n\n");
              >> }
              >> catch (java.lang.ClassNotFoundException cne) { }
              >> }
              >> %>
              >>
              >> <%
              >> System.out.println("Hello World.");
              >> System.out.println("Class name: " + this.getClass().getName());
              >> System.out.println("Class loader: " +
              >> page.getClass().getClassLoader().getClass().getName());
              >> %>
              >> /** code ends here **/
              >>
              >>
              >> /** Program's Output to Stdout **/
              >> This is the static block!!!!
              >> Static classloader:
              >weblogic.utils.classloaders.RecursiveReloadOnModifyClassLoader$Slave
              >>
              >>
              >>
              >>
              >> This is the static block!!!!
              >> Static classloader: weblogic.servlet.jsp.OneOffJspLoader
              >>
              >>
              >> Hello World.
              >> Class name: jsp_servlet._helloworld
              >> Class loader: weblogic.servlet.jsp.OneOffJspLoader
              >>
              >> /** End OUtput **/
              >
              >
              

  • Safari gives up loading images too early

    Hi
    I have noticed that Safari (currently I am using 3.1.1 but I had noticed this behavior on earlier versions as well) usually gives up on loading images too early.
    I have a 30Mbps internet connection and also in Firefox and Opera I do not experience the same problem.
    Is this a known issue? Are there currently any workarounds around this problem?
    Regards,
    Behrang

    From your Safari menu bar click Safari > Preferences then select the Privacy tab.
    Click:   Remove All Website Data
    Then delete the cache.
    Open a Finder window. From the Finder menu bar click Go > Go to Folder
    Type or copy paste the following
    ~/Library/Caches/com.apple.Safari/Cache.db
    Click Go then move the Cache.db file to the Trash.
    Quit and relaunch Safari to test.
    If nothing above helped, troubleshoot Safari extensions.
    From the Safari menu bar click Safari > Preferences then select the Extensions tab. Turn that OFF, quit and relaunch Safari to test.
    If that helped, turn one extension on then quit and relaunch Safari to test until you find the incompatible extension then click uninstall.

  • Does loading too many classes into jvm slow down performance?

    hi all,
    does loading too many classes into jvm will slow down performance. Our application is CPU bound, if we use any framework we need to load all the classes related to that framework in JVM. Does this have any effect on the performance of the JVM.
    thanks and regards,
    akmal

    does loading many classes into jvm slow down performance.It will increase the time it takes for the JVM to load your application.
    Our application is CPU boundThe time it takes the JVM to load your application is not likely to be an issue for you then.

  • Systemd: some services starting too early and then failing

    Hello everyone,
    I freshly installed Arch on this new laptop (Asus Zenbook Prime UX32VD) and from the start, I wanted to have a pure systemd setup. I'm using services only and I've uninstalled initscripts and so far it's working relatively well.
    However, some services seem to start too early by default and the workarounds are unsatisfactory.
    Problem 1: asus-screen-brightness and asus-kbd-backlight
    On this lap top, the stock screen brightness buttons do not work (yet). A script and a service file (which are both available via the asus-screen-brightness AUR package) have to be used to allow users to change the brightness via the script. The problem is, with that service enabled, it only succeeds sometimes. About have of the time booting the laptop it fails, most likely because the necessary nodes in /sys/ do not exist yet. Restarting the service manually after booting does the trick:
    [root@tachychineta shapeshifter]# sc status asus-screen-brightness
    asus-screen-brightness.service - Allow user access to screen brightness
    Loaded: loaded (/etc/systemd/system/asus-screen-brightness.service; enabled)
    Active: active (exited) since Fri, 12 Oct 2012 11:23:44 +0200; 1min 1s ago
    Process: 320 ExecStart=/usr/bin/asus-screen-brightness allowusers (code=exited, status=0/SUCCESS)
    CGroup: name=systemd:/system/asus-screen-brightness.service
    Oct 12 11:23:44 tachychineta systemd[1]: Starting Allow user access to screen brightness...
    Oct 12 11:23:44 tachychineta sudo[349]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness
    Oct 12 11:23:44 tachychineta sudo[349]: pam_unix(sudo:session): session opened for user root by (uid=0)
    Oct 12 11:23:44 tachychineta asus-screen-brightness[320]: cat: /sys/class/backlight/intel_backlight/max_brightness: No such file or directory
    Oct 12 11:23:44 tachychineta asus-screen-brightness[320]: /usr/bin/asus-screen-brightness: line 8: /10: syntax error: operand expected (error token is "/10")
    Oct 12 11:23:44 tachychineta asus-screen-brightness[320]: /usr/bin/asus-screen-brightness: line 10: 2*: syntax error: operand expected (error token is "*")
    Oct 12 11:23:44 tachychineta asus-screen-brightness[320]: cat: /sys/class/backlight/intel_backlight/brightness: No such file or directory
    Oct 12 11:23:44 tachychineta asus-screen-brightness[320]: chgrp: cannot access ‘/sys/class/backlight/intel_backlight/brightness’: No such file or directory
    Oct 12 11:23:44 tachychineta asus-screen-brightness[320]: chmod: cannot access ‘/sys/class/backlight/intel_backlight/brightness’: No such file or directory
    Oct 12 11:23:44 tachychineta systemd[1]: Started Allow user access to screen brightness.
    [root@tachychineta shapeshifter]# sc restart asus-screen-brightness
    [root@tachychineta shapeshifter]# sc status asus-screen-brightness
    asus-screen-brightness.service - Allow user access to screen brightness
    Loaded: loaded (/etc/systemd/system/asus-screen-brightness.service; enabled)
    Active: active (exited) since Fri, 12 Oct 2012 11:25:28 +0200; 2s ago
    Process: 2547 ExecStop=/usr/bin/asus-screen-brightness disallowusers (code=exited, status=0/SUCCESS)
    Process: 2579 ExecStart=/usr/bin/asus-screen-brightness allowusers (code=exited, status=0/SUCCESS)
    CGroup: name=systemd:/system/asus-screen-brightness.service
    Oct 12 11:25:28 tachychineta systemd[1]: Starting Allow user access to screen brightness...
    Oct 12 11:25:28 tachychineta sudo[2593]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/chgrp users /sys/class/backlight/intel_backlight/brightness
    Oct 12 11:25:28 tachychineta sudo[2593]: pam_unix(sudo:session): session opened for user root by (uid=0)
    Oct 12 11:25:28 tachychineta sudo[2597]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness
    Oct 12 11:25:28 tachychineta sudo[2597]: pam_unix(sudo:session): session opened for user root by (uid=0)
    Oct 12 11:25:28 tachychineta systemd[1]: Started Allow user access to screen brightness.
    Exactly the same problem occurs with asus-kbd-backlight.service which is needed to allow users to control the keyboard backlight. It also fails because of missing /sys/ entries if started too early.
    Problem 2: automatic login & X11
    I use the method described on the wiki to autologin into TTY1 with my user and my .bash_profile contains
    [[ $(fgconsole) = 1 ]] && startx
    and my .xserverrc is configured as explained in this fantastically useful article by falconindy.
    This way, X starts automatically and my session is properly authenticated for things like udiskie. I'm not using [testing] but instead rebuilt polkit with --enable-systemd and it's working just fine. The problem is, just like in problem 1, Xorg fails to start every now and then, failing with
    (EE) No devices detected.
    I don't have a full log because it hasn't happened in a while, but I'm very certain it's because the chipset isn't ready, yet.
    Solutions?
    I added "i915" to /etc/modules-load.d/static.conf hoping that would cover both the Xorg and backlight problems but it doesn't help. I then tried adding i915 to my MODULES in mkinitcpio.conf and rebuilding the initramfs and at least it looked like that way the problems went away but it added about 4 seconds to the time spent by the "kernel" during boot which is quite unacceptable. (Plots with and without i915 in MODULES).
    I read the systemd.unit and systemd.service man pages but I can't find a way to speficy required kernel modules for a service file. I'm not sure if specifying the modules in /etc/modules-load.d shouldn't be enough (because apparently it's supposed to load for sysinit.target, which is early) but apparently it isn't.
    Any ideas how I can get these services to work properly without sacrificing too much boot time?
    Thank you
    Last edited by Shapeshifter (2012-10-12 10:20:09)

    Please fill a bug report.

  • Performance issues with class loader on Windows server

    We are observing some performance issues in our application. We are Using weblogic 11g with Java6 on a windows 2003 server
    The thread dumps indicate many threads are waiting in queue for the native file methods:
    "[ACTIVE] ExecuteThread: '106' for queue: 'weblogic.kernel.Default (self-tuning)'" RUNNABLE
         java.io.WinNTFileSystem.getBooleanAttributes(Native Method)
         java.io.File.exists(Unknown Source)
         weblogic.utils.classloaders.ClasspathClassFinder.getFileSource(ClasspathClassFinder.java:398)
         weblogic.utils.classloaders.ClasspathClassFinder.getSourcesInternal(ClasspathClassFinder.java:347)
         weblogic.utils.classloaders.ClasspathClassFinder.getSource(ClasspathClassFinder.java:316)
         weblogic.application.io.ManifestFinder.getSource(ManifestFinder.java:75)
         weblogic.utils.classloaders.MultiClassFinder.getSource(MultiClassFinder.java:67)
         weblogic.application.utils.CompositeWebAppFinder.getSource(CompositeWebAppFinder.java:71)
         weblogic.utils.classloaders.MultiClassFinder.getSource(MultiClassFinder.java:67)
         weblogic.utils.classloaders.MultiClassFinder.getSource(MultiClassFinder.java:67)
         weblogic.utils.classloaders.CodeGenClassFinder.getSource(CodeGenClassFinder.java:33)
         weblogic.utils.classloaders.GenericClassLoader.findResource(GenericClassLoader.java:210)
         weblogic.utils.classloaders.GenericClassLoader.getResourceInternal(GenericClassLoader.java:160)
         weblogic.utils.classloaders.GenericClassLoader.getResource(GenericClassLoader.java:182)
         java.lang.ClassLoader.getResourceAsStream(Unknown Source)
         javax.xml.parsers.SecuritySupport$4.run(Unknown Source)
         java.security.AccessController.doPrivileged(Native Method)
         javax.xml.parsers.SecuritySupport.getResourceAsStream(Unknown Source)
         javax.xml.parsers.FactoryFinder.findJarServiceProvider(Unknown Source)
         javax.xml.parsers.FactoryFinder.find(Unknown Source)
         javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
         org.ajax4jsf.context.ResponseWriterContentHandler.<init>(ResponseWriterContentHandler.java:48)
         org.ajax4jsf.context.ViewResources$HeadResponseWriter.<init>(ViewResources.java:259)
         org.ajax4jsf.context.ViewResources.processHeadResources(ViewResources.java:445)
         org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:193)
         org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
         org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
    On googling this seems to be an issue with java file handling on windows servers and I couldn't find a solution yet. Any recommendation or pointer is appreciated

    Hi shubhu,
    I just analyzed your partial Thread Dump data, the problem is that the ajax4jsf framework ResponseWriterContentHandler triggers internally a new instance of the DocumentBuilderFactory; every time; triggering heavy IO contention because of Class loader / JAR file search operations.
    Too many of these IO operations under heavy load will create excessive contention and severe performance degradation; regardless of the OS you are running your JVM on.
    Please review the link below and see if this is related to your problem.. This is a known issue in JBOSS JIRA when using RichFaces / ajaxJSF.
    https://issues.jboss.org/browse/JBPAPP-6166
    Regards,
    P-H
    http://javaeesupportpatterns.blogspot.com/

  • Class Loader Hierarchy in Weblogic 7.0

    I have read the BEA documentation on the class loader hierarchy in Weblogic Server,
    and I have some questions regarding some behavior I am seeing.
    I am running Weblogic Server 7.0.
    I have an ear file that contains 3 web apps (wars) and several utility jars. The
    web apps' manifests contain the Class-Path entry for the utility jars. My understanding
    of this is that each web app SHOULD have its own class loader. Also, the utility
    jars will be scoped in a separate class loader and WILL NOT have visibility to
    the web app classes. The web app classes should have visibility to the utility
    jars.
    Is this correct????
    I added a static segment of code in each web app and printed the class loader
    for each servlet when it was loaded. I also printed the class loader from a class
    that is DEFINITELY contained in one of the utility jars. Here is the result:
    Utility Class ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04 Utility Class
    Parent ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    Servlet 1 ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04 Servlet 1 Parent
    ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    Servlet 2 ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04 Servlet 2 Parent
    ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    I'm a little confused.... I expected to see 3 different class loaders (i.e. one
    for each class above). I believe the above printout says that all 3 classes are
    being loaded by the SAME class loader instance (Launcher$AppClassLoader@b9d04).
    Am I interpreting this correctly? If so, what's going on?

    I rechecked the classpath for the user that starts Weblogic, and in the classpath
    I found the project "src" directory (must have missed it earlier). When we did
    our build, the classes are placed in the src structure then copied to the build
    area. That's the reason I was not seeing the appropriate class loader hierarchy.
    Thanks for all of the comments.
    "Sanjeev Chopra" <[email protected]> wrote:
    >
    "Mark Cotherman" <[email protected]> wrote in message
    news:[email protected]...
    Thanks for your comments again Mark. I'm just trying to get a goodhandle
    on how
    this is working.
    I'll assume that somehow my web app classes are being loaded into theroot
    classloader.
    The next question is... why??Just to be sure - is there any way these classes are sneaking into the
    system classpath ?
    My ear file contains the following:
    a.war
    b.war
    c.war
    lib/util1.jar
    lib/util2.jar
    lib/util3.jar
    lib/util4.jar
    The manifest in all three wars reference all util jars. This ear deployssuccessfully
    on Weblogic with no errors.
    How could these separate servlets (one in each war) not have seperateclass loaders
    seperate from the root where the utils should reside. I don't thinkthat
    I have
    any control over where Weblogic loads the war classes, or do I?
    See comments below....
    Mark Spotswood <[email protected]> wrote:
    Mark Cotherman wrote:
    Thanks for the follow-up.
    I want to make sure I follow what you are saying. All classes in
    the
    manifest
    Class-Path of WARs are exported to the parent classloader.That's right.
    To me this is the correct behavior since the manifest Class-Path
    is
    meant to provide
    a way to share common utility classes among several web apps. AllEJB jars and
    manifest Class-Path entries should be loaded by the same class loader.Its a way to share class definitions, but not necessarilly class
    instances. I don't think that a web application should be extending
    the classpath of its parent's classloader. This leads to namespace
    problems as well as reloadability issues.
    Ok, you lost me here. Shouldn't delegation handle the namespacecollisions??
    If the web app class loader has a class definition (webapp:com.xyz.ClassA) with
    exactly the same name in the same package as the root class loader(rootloader:
    com.xyz.ClassA), I thought the web app would use (delegate loading)the
    class
    definition from the root class loader when PreferWebInf is set to false.
    Isn't this why the PreferWebInf attribute, when set to true, can causeClassCastExceptions??
    The web app when creating an instance of (webapp: com.xyz.ClassA)from
    the web
    app class loader can potentially pass a reference to this instanceto a
    class
    instance loaded from the root loader. The root class loader has adifferent class
    definition for ClassA.
    REALLY what makes since is that all common jar files be defined
    in
    the manifest
    Class-Path OF THE ear FILE (if the WAR(s) are in an ear). These
    jar
    files should
    then be loaded by the same class loader as the EJB jars. There shouldbe no need
    for the WARs to have any reference to the utility jars since the
    EJB
    class loader
    is the parent of the WAR class loaders.The ear file doesn't have a manifest classpath, but what you are getting
    at makes sense. If you add a manifest to any EJBs in your app, theall
    webapps (as well as all other EJBs) will be able to see it, sincewith
    our structure, EJBs are loaded into the application's root classloader.
    My problem is that the ACTUAL SERVLET classes are NOT being loadedby a separate
    class loader from the EJB and common jar class loader. This is
    completely
    against
    what is being said in the Weblogic documentation. The Manifest
    Class-Path
    should
    have nothing to do with where the classes that reside in
    WEB-INF/classes
    of my
    servlet are loaded.Classloaders will ask their parent for the class first before loading
    it
    themselves. So if the parent classloader somehow has visibility to
    classes that your webpapp references, then it will get loaded by the
    parent classloader.
    I am in the middle of migrating an app from an older version of
    Weblogic,
    and
    it would be helpful to have the ACTUAL class loading hierarchy welldocumented.
    The basic hierarchy is all EJBs are in a root shared classloader and
    each web application is loaded by a classloader that is a child of
    that root.
    Again, am I missing something here???My suspicion is that somehow these servlets are in the classpath ofthe
    root classloader, so when the webapp classloaders delegate to thatone,
    it will come up with the class.
    mark
    Mark Spotswood <[email protected]> wrote:
    I believe what you are seeing is a bug in the servlet container.
    The classloader organization is what you expect, but each webapp
    is exporting the classpath information from its manifest to the
    classloader above its classloader (which is common to all
    three webapps) rather than to its own classloader. So because
    of the delegation that happens with classloading, the common
    parent classloader is the one that loads the class.
    I believe that this behavior exists as an attempt to avoid
    ClassCastExceptions, but I don't think that it is the right
    solution to this problem. In our 8.1 release, this behavior
    has been changed. That is, web applications no longer export
    manifest classpath information to the parent of their classloader.
    This change has not been ported back to the 7.x line, but a bug
    report has been created (CR099889). You should be able to follow
    up with support with this CR number.
    mark
    Mark Cotherman wrote:
    I have read the BEA documentation on the class loader hierarchy
    in
    Weblogic Server,
    and I have some questions regarding some behavior I am seeing.
    I am running Weblogic Server 7.0.
    I have an ear file that contains 3 web apps (wars) and several
    utility
    jars. The
    web apps' manifests contain the Class-Path entry for the utility
    jars.
    My understanding
    of this is that each web app SHOULD have its own class loader.
    Also,
    the utility
    jars will be scoped in a separate class loader and WILL NOT have
    visibility
    to
    the web app classes. The web app classes should have visibility
    to
    the utility
    jars.
    Is this correct????
    I added a static segment of code in each web app and printed the
    class
    loader
    for each servlet when it was loaded. I also printed the class loaderfrom a class
    that is DEFINITELY contained in one of the utility jars. Here is
    the
    result:
    Utility Class ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04
    Utility
    Class
    Parent ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    Servlet 1 ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04 Servlet1 Parent
    ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    Servlet 2 ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04 Servlet2 Parent
    ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    I'm a little confused.... I expected to see 3 different class loaders(i.e. one
    for each class above). I believe the above printout says that all
    3
    classes are
    being loaded by the SAME class loader instance
    (Launcher$AppClassLoader@b9d04).
    Am I interpreting this correctly? If so, what's going on?

  • Class loader - ClassFormatError

    Hey guys,
    I have a problem with my loading a class file, I get this error:
    Exception in thread "AWT-EventQueue-0" java.lang.ClassFormatError: Code segment has wrong length in class file j2MeDataChunkGenerator_Plugin/DataChunkGenerator.class
    I know I compiled it right, since other classes does load, I didn't try to manipulate the byte code or any thing like this, could anything code related might generate this kind of exception??
    in the beginning I thought this was an error with my class loading process, but once I recreated an empty duplicate of the problem, it works fine, and all the classes are been loaded correctly.
    Any help or idea would be greatly appreciated, I've been at it for 4 evenings ;..(
    Thanks in advance,
    Adam.

    I should have put this earlier:
    the class loading method:
         public static class PluginClassLoader extends ClassLoader {
              // public PluginClassLoader() {
              // super(new URL[] {});
              private ArrayList<JarFile> jars = new ArrayList<JarFile>();
              public synchronized void add(JarFile jar) throws MalformedURLException {
                   jars.add(jar);
              public Class<?> loadClass(String className) throws ClassNotFoundException {
                   try {
                        try {
                             System.out.println("Looking in super.loadClass(className=" + className + ")");
                             Class<?> _class=super.loadClass(className);
                             System.out.println("Class was found: "+className);
                             return _class;
                             // return checkIfClassWasLoaded(className, false);
                        } catch (ClassNotFoundException e1) {
                             System.out.println("Class was not found: "+className);
                             System.out.println("Looking in the Jar files for className=" + className);
                             for (int i = 0; i < jars.size(); i++) {
                                  JarFile jar = jars.get(i);
                                  Enumeration<JarEntry> enumeration = jar.entries();
                                  while (enumeration.hasMoreElements()) {
                                       java.util.jar.JarEntry file = (JarEntry) enumeration.nextElement();
                                       if (file.getName().equals(className.replace(".", "/") + ".class")) {
                                            System.out.println("A match to " + className + " was found in: \n" + jar.getName().replace("\\", "/") + "!/" + file.getName()+"\n");
                                            InputStream is = jar.getInputStream(file);
                                            byte[] bytes;
                                            int length = is.available();
                                            bytes = new byte[length];
                                            is.read(bytes);
                                            return defineClass(className, bytes, 0, bytes.length);
                   } catch (IOException e) {
                        System.out.println("Unable to locate class file: " + className);
                        e.printStackTrace();
                   throw new ClassNotFoundException(className);
              private Class<?> checkIfClassWasLoaded(String className, boolean pResolve) throws ClassNotFoundException {
                   System.out.println("checkIfClassWasLoaded(" + className + ", " + pResolve + ")");
                   Class<?> lClass = findLoadedClass(className);
                   if (lClass == null) {
                        try {
                             ClassLoader lParent = getParent();
                             if (lParent == null) {
                                  lClass = getSystemClassLoader().loadClass(className);
                             } else {
                                  lClass = lParent.loadClass(className);
                        } catch (ClassNotFoundException cnfe) {
                             lClass = findSystemClass(className);
                   try {
                        if (pResolve) {
                             System.out.println("resolve class: " + lClass);
                             resolveClass(lClass);
                   } catch (Error e) {
                        e.printStackTrace();
                        throw e;
                   return lClass;
               * checks if this plugin .jar file was loaded already into this class
               * loader jar list.
               * @param file
               *            - the file of the plugin jar
               * @return
               * @throws IOException
              public JarFile contains(String jarPath) {
                   for (JarFile file : jars)
                        if (file.getName().equalsIgnoreCase(jarPath))
                             return file;
                   return null;
         }

  • Unknown deployment tag - web-app-class-loader

    I can create the ear file with jdeveloper, but when deploy in 9iAs with the ear file, the next error apaers:
    Deployment failed:
    Unknown deployment tag in
    orion-web.xml:
    <web-app-class-loader>;
    nested exception is:
    java.lang.InstantiationException:
    when deploy the system show the web module.
    I have a CMP entity bean and too show in deploy.
    I don't know wath can I do.
    Please Help Me
    Miguel Angel Caro
    [email protected]

    I manually hacked the EAR file generated by JDeveloper 10g and removed the offending tag from the orion-web.xml
    After removing the tag I was able to deploy the EAR to 9iAS (9.0.2.3) but now I am getting runtime errors...
    Anyone who has gone through this please let me know!
    Thanks!

  • Codebase classes loading on their own?

    I have been tracking down a performance issue. So I am tracing the classes loaded by my clients VM. I have a class defined like so
    public final class GraphicFactory implements IGraphicFactory, Serializable{
         private static final long serialVersionUID = 1L;
         public IDSComponentInstance createComponentInstance(Point location, Dimension size){
            if (location == null || size == null) {
                throw new NullPointerException();
            return new DBComponentInstance(location,size);
        public IDSFunctionConnection createFunctionConnection(Point sourceLocation, Point targetLocation) {
            if(sourceLocation == null || targetLocation == null){
                throw new NullPointerException();
            return new DBFunctionConnection(sourceLocation,targetLocation);
    }I want to pass this class to the client. So the client calls a method, and this class is returned. When that happens, the client immediately loads this class via the codebase. The thing I can not see is when the client loads the "DBFunctionConnection" and "DBComponentInstance" classes. These classes are also in jar files which can be found by the codebase. Obviously the client is getting them because its working. And they are definitely coming from the server. But I do not see any log of them being loaded.
    Its like they get loaded in secret. I bet they do too. I think classes loaded as a result of another class loading are not logged.
    But at the same time, I thought a class would not be loaded until it is needed!? If its loading it right away, then this is a good thing because otherwise the RMI system could throw an exception at a most unusual place when the class gets loaded because a method is called.
    I can't quite figure out what is happening here :(

    I guess RMI classloader is just different.
    From testing I can see that when the main class is
    marshalled it seems as if the classes it contains are
    also marshalled.RMIClassLoader is little more than a URLClassLoader. Classes are neither marshalled nor unmarshalled in RMI, they are loaded via the codebase mechanism, using whatever WEB or other protocol you define in the codebase URL.
    The log is not telling me when classes are loaded,So you're logging the wrong thing?
    So I am still stuck having a hard time knowing when
    the RMI is transferring classes.RMI isn't transferring classes. The RMIClassLoader is transferring classes in response to class-loading requirements. This is completely separate from RMI marshalling. It is more strongly associated with RMI unmarshalling but these are still distinct operations.

  • Custom class loader and local class accessing local variable

    I have written my own class loader to solve a specific problem. It
    seemed to work very well, but then I started noticing strange errors in
    the log output. Here is an example. Some of the names are in Norwegian,
    but they are not important to this discussion. JavaNotis.Oppstart is the
    name of my class loader class.
    java.lang.ClassFormatError: JavaNotis/SendMeldingDialog$1 (Illegal
    variable name " val$indeks")
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:431)
    at JavaNotis.Oppstart.findClass(Oppstart.java:193)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    at JavaNotis.SendMeldingDialog.init(SendMeldingDialog.java:78)
    at JavaNotis.SendMeldingDialog.<init>(SendMeldingDialog.java:54)
    at JavaNotis.Notistavle.sendMelding(Notistavle.java:542)
    at JavaNotis.Notistavle.access$900(Notistavle.java:59)
    at JavaNotis.Notistavle$27.actionPerformed(Notistavle.java:427)
    JavaNotis/SendMeldingDialog$1 is a local class in the method
    JavaNotis.SendMeldingDialog.init, and it's accessing a final local
    variable named indeks. The compiler automatically turns this into a
    variable in the inner class called val$indeks. But look at the error
    message, there is an extra space in front of the variable name.
    This error doesn't occur when I don't use my custom class loader and
    instead load the classes through the default class loader in the JVM.
    Here is my class loading code. Is there something wrong with it?
    Again some Norwegian words, but it should still be understandable I hope.
         protected Class findClass(String name) throws ClassNotFoundException
             byte[] b = loadClassData(name);
             return defineClass(name, b, 0, b.length);
         private byte[] loadClassData(String name) throws ClassNotFoundException
             ByteArrayOutputStream ut = null;
             InputStream inn = null;
             try
                 JarEntry klasse = arkiv.getJarEntry(name.replace('.', '/')
    + ".class");
                 if (klasse == null)
                    throw new ClassNotFoundException("Finner ikke klassen "
    + NOTISKLASSE);
                 inn = arkiv.getInputStream(klasse);
                 ut = new ByteArrayOutputStream(inn.available());
                 byte[] kode = new byte[4096];
                 int antall = inn.read(kode);
                 while (antall > 0)
                     ut.write(kode, 0, antall);
                     antall = inn.read(kode);
                 return ut.toByteArray();
             catch (IOException ioe)
                 throw new RuntimeException(ioe.getMessage());
             finally
                 try
                    if (inn != null)
                       inn.close();
                    if (ut != null)
                       ut.close();
                 catch (IOException ioe)
         }I hope somebody can help. :-)
    Regards,
    Knut St�re

    I'm not quite sure how Java handles local classes defined within a method, but from this example it seems as if the local class isn't loaded until it is actually needed, that is when the method is called, which seems like a good thing to me.
    The parent class is already loaded as you can see. It is the loading of the inner class that fails.
    But maybe there is something I've forgotten in my loading code? I know in the "early days" you had to do a lot more to load a class, but I think all that is taken care of by the superclass of my classloader now. All I have to do is provide the raw data of the class. Isn't it so?

  • RMI Dynamic Class Loading

    Hello,
    I have a standalone Java Client which is connecting to an RMI based svr component on WLS 6.0sp1. However, before connecting to the RMI Svr, I am trying to boot strap couple of other CLASS files from the App Svr. using the RMIClassLoader. Now here's the problem...
    I have placed my classes( one which I want to download and instantiate before I start making conventional calls to RMI Svr remote methods) in the folder WL_HOME/config/examples/rmi/*.class
    which is the code_base url I use. However, the error I get when trying to download the classs using RMIClass loader is:
    No Security Manager: RMI Class Loader disabled"...
    due to which I can not even get connected to my remote object after that. Can somebody please tell me how can I set whatever option it is so that I can get this thing working.
    I tried using the "Grant all" security policy too on the client side & server side in vain.
    Any help is truly appreciated. Thanks a lot!
    cl I am trying to

    I'll try having a crack at this, see inline comments
    Chirag Shah wrote:
    Hello,
    I have a standalone Java Client which is connecting to an RMI based svr component on WLS 6.0sp1. However, before connecting to the RMI Svr, I am trying to boot strap couple of other CLASS files from the App Svr. using the RMIClassLoader. Now here's the problem...
    I have placed my classes( one which I want to download and instantiate before I start making conventional calls to RMI Svr remote methods) in the folder WL_HOME/config/examples/rmi/*.class
    which is the code_base url I use. However, the error I get when trying to download the classs using RMIClass loader is:I'll assume that you're using a proper URL (file://) to instanciate your ClassLoader.
    >
    No Security Manager: RMI Class Loader disabled"...
    Does your client explicitly set a SecurityManager using the following command?
    if (System.getSecurityManager() == null) {
    System.setSecurityManager(new java.rmi.RMISecurityManager());
    Also,I believe that it should only be your client changing its policy file (for the network classload).
    >
    due to which I can not even get connected to my remote object after that. Can somebody please tell me how can I set whatever option it is so that I can get this thing working.
    I tried using the "Grant all" security policy too on the client side & server side in vain.
    Any help is truly appreciated. Thanks a lot!
    cl I am trying toHope it helps,
    Stephane Vaucher
    CIRANO
    Research Professional

  • 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).

  • Weblogic Class Loader issues.

    Hi all!
    Let me explain my problem.
    I have an EJB which has in its same Java package some support classes
    & also a startup class. I created an EJB jar file (containing the home,
    remote, bean, the deployment descriptors & the container generated stubs)
    for deployment. I also compiled all the support classes & the startup class
    into the /weblogic/myserver/serverclasses directory. I also added the
    required entries in the weblogic.properties file for the startup class.
    Now the problem is that the support classes & the startup class contain
    methods & constructors which have package level access (i.e the default
    access in Java). At runtime, when my bean tries to access one of these
    methods, an IllegalAccessException is thrown.
    I understand that this exception is thrown when one tries to access a
    method which should not be accessed (like private/protected/cross-package
    access). However, both the EJB & these classes are in the same package.
    So this should not be thrown.
    Now the next thing I thought is that the EJB & the support classes are
    being loaded by 2 different classloaders. I guess the classes under
    /weblogic/myserver/serverclasses are being loaded by the WebLogic
    Server ClassLoader & the EJB bean classes are being loaded by the
    specialized EJB ClassLoader.
    Now my question is,
    1) Is it the case that the WebLogic Server does not recognize that the
    EJB Bean class is in the same package as the support classes because
    they are loaded by 2 separate class loaders? Please note that the EJB
    jar file does not contain any support classes - so there is no
    duplicate classes here.
    2) Is this a bug?
    3) What should I do to prevent this problem?
    Some workarounds that I have done are:
    1) Copied the Bean.class (implementation class of EJB bean) into the
    serverclasses directory. Now the server does not throw any
    IllegalAccessException. -- This, however, does not appeal as a solution
    since it looks like the Bean class is now being loaded by the WebLogic
    Class Loader instead of from the EJB jar file.
    2) I changed all the default package access methods to public methods.
    Works like a charm. -- Problem is that this is a third party set of classes
    which I would like to avoid modifying.
    Hope this is not too confusing. Please let me know if you need any further info.
    Thanks much in advance,
    --Das

    You have to tell WLAS where to load your new classes. You can change
              workingDir of your JSP configuration in weblogic.properties to point to your
              new class directory.
              Cheers - Wei
              Hyung-Jin Kim <[email protected]> wrote in message
              news:[email protected]..
              > It seems that if I compile a class that a JSP uses while Weblogic is
              > running, Weblogic's class loader has this nasty habit of caching/writing
              > the class that already has loaded into memory into:
              >
              > weblogic/myServer/classfiles
              >
              > Weblogic then refers to the older class file under the above directory
              > when the server is started again. Is there any way to turn this "class
              > loader caching" off in Weblogic? Thanks!
              >
              > -hjk
              >
              

Maybe you are looking for

  • Editing SystemExec.vi to wrap up a program

    Hi there, I'm just full of questions today. I'm using SystemExec.vi to run a small, DOS-based external program. I then take the output that's sent to the console and manipulate it a bit. The problem is, the external program I'm executing does somethi

  • Web report without userid and password

    Hi Experts, I exported a BW web report to excel spreadsheet and sent it through mail to others, When recepients tried to open that exported spreadsheet, It is prompting for userid and password. I dont want this to be happened and it should open witho

  • Apple TV with Multiple Mac's in the same house & a PC

    Question-- I recently got a used Apple TV for christmas. I successfully synched it with my Macbook but I haven't tried to synch the content from my iMac or PC. I'm wondering if I can synch content from two seperate mac's & my PC and not have the cont

  • Witholding Tax Information system (J1INMIS) Not updating (FICA)

    Hi Experts,    We are using ECC 6.0 recently we upgrated with EHP 5. And the current system (FICO) is working fine with TDS calculations and Witholding Tax Information system (J1INMIS) gets updated perfectly. We are implimenting FICA (student Account

  • Temperatur​e control system using thermocoup​les and cooling fans

    Greetings labview community, I'm fairly new to the labview program and though I have watched the tutorial videos and tried to search these forums I couldn't find a solution to my problem. I need to write a program in labview that controls the tempera