Skip to main content

LoadingException

com.sun.org.apache.bcel.internal.verifier.exc.LoadingException

LoadingException is described in the javadoc comments as:

When loading a class file, BCEL will throw an instance of LoadingException if the class file is malformed; so it is not conforming to the 'Pass 1' verification process as described in the Java Virtual Machine specification, 2nd. edition.
version: $Id: LoadingException.java,v 1.1.1.1 2001/10/29 20:00:33 jvanzyl Exp $ author: Enver Haase

Where is this exception thrown?

Following, is a list of exception messages cross-referenced to the source code responsible for throwing them. Click on the method link to view the code and see how the exception is thrown.

How is this exception thrown?

The following sub-sections identify where this exception is thrown, and how (or why) the code is throwing the exception.

Any source code quoted in this section is subject to the Java Research License unless stated otherwise.

com.sun.org.apache.bcel.internal.verifier.statics.Pass1Verifier.do_verify()

/**
  * Pass-one verification basically means loading in a class file.
  * The Java Virtual Machine Specification is not too precise about
  * what makes the difference between passes one and two.
  * The answer is that only pass one is performed on a class file as
  * long as its resolution is not requested; whereas pass two and
  * pass three are performed during the resolution process.
  * Only four constraints to be checked are explicitely stated by
  * The Java Virtual Machine Specification, 2nd edition:
  * <UL>
  *  <LI>The first four bytes must contain the right magic number (0xCAFEBABE).
  *  <LI>All recognized attributes must be of the proper length.
  *  <LI>The class file must not be truncated or have extra bytes at the end.
  *  <LI>The constant pool must not contain any superficially unrecognizable information.
  * </UL>
  * A more in-depth documentation of what pass one should do was written by
  * <A HREF=mailto:pwfong@cs.sfu.ca>Philip W. L. Fong</A>:
  * <UL>
  *  <LI> the file should not be truncated.
  *  <LI> the file should not have extra bytes at the end.
  *  <LI> all variable-length structures should be well-formatted:
  *  <UL>
  *   <LI> there should only be constant_pool_count-1 many entries in the constant pool.
  *   <LI> all constant pool entries should have size the same as indicated by their type tag.
  *   <LI> there are exactly interfaces_count many entries in the interfaces array of the class file.
  *   <LI> there are exactly fields_count many entries in the fields array of the class file.
  *   <LI> there are exactly methods_count many entries in the methods array of the class file.
  *   <LI> there are exactly attributes_count many entries in the attributes array of the class file, fields, methods, and code attribute.
  *   <LI> there should be exactly attribute_length many bytes in each attribute. Inconsistency between attribute_length and the actually size of the attribute content should be uncovered. For example, in an Exceptions attribute, the actual number of exceptions as required by the number_of_exceptions field might yeild an attribute size that doesn't match the attribute_length. Such an anomaly should be detected.
  *   <LI> all attributes should have proper length. In particular, under certain context (e.g. while parsing method_info), recognizable attributes (e.g. 'Code' attribute) should have correct format (e.g. attribute_length is 2).
  *  </UL>
  *  <LI> Also, certain constant values are checked for validity:
  *  <UL>
  *   <LI> The magic number should be 0xCAFEBABE.
  *   <LI> The major and minor version numbers are valid.
  *   <LI> All the constant pool type tags are recognizable.
  *   <LI> All undocumented access flags are masked off before use. Strictly speaking, this is not really a check.
  *   <LI> The field this_class should point to a string that represents a legal non-array class name, and this name should be the same as the class file being loaded.
  *   <LI> the field super_class should point to a string that represents a legal non-array class name.
  *   <LI> Because some of the above checks require cross referencing the constant pool entries, guards are set up to make sure that the referenced entries are of the right type and the indices are within the legal range (0 < index < constant_pool_count).
  *  </UL>
  *  <LI> Extra checks done in pass 1:
  *  <UL>
  *   <LI> the constant values of static fields should have the same type as the fields.
  *   <LI> the number of words in a parameter list does not exceed 255 and locals_max.
  *   <LI> the name and signature of fields and methods are verified to be of legal format.
  *  </UL>
  * </UL>
  * (From the Paper <A HREF=http://www.cs.sfu.ca/people/GradStudents/pwfong/personal/JVM/pass1/>The Mysterious Pass One, first draft, September 2, 1997</A>.)
  * </BR>
  * However, most of this is done by parsing a class file or generating a class file into BCEL's internal data structure.
  * <B>Therefore, all that is really done here is look up the class file from BCEL's repository.</B>
  * This is also motivated by the fact that some omitted things
  * (like the check for extra bytes at the end of the class file) are handy when actually using BCEL to repair a class file (otherwise you would not be
  * able to load it into BCEL).
  *
  * @see com.sun.org.apache.bcel.internal.Repository
  */
public VerificationResult do_verify() {
    JavaClass jc;
    try {
        jc = getJavaClass();
        if (jc != null) {
            if (!myOwner.getClassName().equals(jc.getClassName())) {
                throw new LoadingException('Wrong name: the internal name of the .class file '' + jc.getClassName() + '' does not match the file's name '' + myOwner.getClassName() + ''.');
            }
        }
    } catch (LoadingException e) {
        return new VerificationResult(VerificationResult.VERIFIED_REJECTED, e.getMessage());
    } catch (ClassFormatError e) {
        return new VerificationResult(VerificationResult.VERIFIED_REJECTED, e.getMessage());
    } catch (RuntimeException e) {
        return new VerificationResult(VerificationResult.VERIFIED_REJECTED, 'Parsing via BCEL did not succeed. ' + e.getClass().getName() + ' occured:\n' + Utility.getStackTrace(e));
    }
    if (jc != null) {
        return VerificationResult.VR_OK;
    } else {
        return new VerificationResult(VerificationResult.VERIFIED_REJECTED, 'Repository.lookup() failed. FILE NOT FOUND?');
    }
}

Source: "Java SE Downloads: Java SE 6 JDK Source Code", at: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Comments

Popular posts from this blog

Connection refused: No available router to destination

This is a simple symptom-cause-solution blog entry only. I hope these blogs will help fellow administrators.
Symptom

The following exception occurs in WebLogic server logs. Most likely to occur during WebLogic server start-up, but similar exceptions may occur at other times.
java.net.ConnectException: t3://myserver:8000: Destination unreachable; nested exception is: java.net.ConnectException: Connection refused: connect; No available router to destination] at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:49) at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:773) at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:363) at weblogic.jndi.Environment.getContext(Environment.java:307) at weblogic.jndi.Environment.getContext(Environment.java:277)
Cause
This message (Connection refused: connect; No available router to destination) is a kind of "catch…

BAD_CERTIFICATE - A corrupt or unuseable certificate...

This is a simple symptom-cause-solution blog entry only. I hope these blogs will help fellow administrators.
Symptom
In wls_utc, when trying to test a webservice using SSL, the following error message is received: javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received.
If SSL debugging is enabled, the following error also appears in the logs: ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)' <1254822672320>>
verification failed because RSA key public exponent [3] is too small
Cause
The certificate encryption is of a weaker strength than expected by newer versions of Java.
Solution
Add the flag "-Dweblogic.security.SSL.allowSmallRSAExponent=true" to the server startup parameters.
References


None.

WebLogic Admin Console

WebLogic Admin Console
The WebLogic Admin Console is a web-based, user interface used to configure and control a set of WebLogic servers or clusters (i.e. a "domain"). In any logical group of WebLogic servers there must exist one admin server, which hosts the WebLogic Admin Console application and manages the associated configuration files.
WebLogic Administrators will use the Administration Console for a number of tasks, including:
Starting and stopping WebLogic servers or entire clusters.Configuring server parameters, security, database connections and deployed applications.Viewing server status, health and metrics. Note: It is not strictly necessary to use the Weblogic Admin Console to perform these tasks, as they can be scripted using WLST (the WebLogic Scripting Tool).
Accessing the Admin Console
WebLogic Admin Console Url: http://hostname:port/console.
To access the WebLogic Administration Console, assuming the admin server has been started, goto the above url. Where hostname…