United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-8021368 : Launch of Java Web Start app fails with ClassCircularityError exception in 7u25

Details
Type:
Bug
Submit Date:
2013-07-23
Status:
Resolved
Updated Date:
2014-01-16
Project Name:
JDK
Resolved Date:
2013-12-19
Component:
core-libs
OS:
linux_oracle_6.0
Sub-Component:
java.lang
CPU:
Priority:
P3
Resolution:
Fixed
Affected Versions:
7u25
Fixed Versions:
7u60 (b03)

Related Reports
Relates:

Sub Tasks

Description
FULL PRODUCT VERSION :
java version  " 1.7.0_25 " 
Java(TM) SE Runtime Environment (build 1.7.0_25-b33)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b02, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Linux adc6140581 2.6.18-164.0.0.0.1.el5xen #1 SMP Wed Sep 2 22:48:20 EDT 2009 i686 i686 i386 GNU/Linux

but the same results occur on Mac OS X 10.7.5


EXTRA RELEVANT SYSTEM CONFIGURATION :
Using released GlassFish 4.0

A DESCRIPTION OF THE PROBLEM :
GlassFish automatically supports launching of Java EE app clients using Java Web Start.  Starting with Java SE 7u25 these launches fail with the stack trace supplied below (from the console output or the trace file).

REGRESSION.  Last worked in version 7u21

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Enable the creation of Java Web Start trace files and/or set the console to automatically open during Java Web Start launches.

Download GlassFish 4.0 from

http://download.java.net/glassfish/4.0/release/glassfish-4.0.zip

Unzip it into the directory of your choice (call it $INSTALL_DIR).

Start the server using

$INSTALL_DIR/glassfish4/glassfish/bin/asadmin start-domain

Build the test JAR:
1. Compile the attached Java code using  " java TestClient.java " 
2. Build a JAR:  " jar fce test.jar TestClient TestClient*.class

Deploy the test JAR:
$INSTALL_DIR/glassfish4/glassfish/bin/asadmin deploy test.jar

Attempt to launch the client using

javaws  " http://your-host:8080/test?arg=Testing " 

There are quite a few JARs downloaded by Java Web Start during the first launch.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Long list of warnings about missing Codebase and Permission manifest attributes in the console and trace file, followed by the test app displaying the  " arg "  query parameters ( " Testing "  in the above example 'javaws' command) in a simple GUI list.
ACTUAL -
The trace file and/or the console displays the attached stack trace reporting a ClassCircularityError exception.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread  " javawsApplicationMain "  java.lang.ClassCircularityError: com/sun/enterprise/security/ee/PermissionCache
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
at java.lang.Class.getMethod0(Class.java:2764)
at java.lang.Class.isCheckMemberAccessOverridden(Class.java:2204)
at java.lang.Class.checkMemberAccess(Class.java:2223)
at java.lang.Class.newInstance(Class.java:330)
at java.net.URL.getURLStreamHandler(URL.java:1199)
at java.net.URL.<init>(URL.java:590)
at java.net.URL.<init>(URL.java:482)
at java.net.URL.<init>(URL.java:431)
at com.sun.deploy.util.URLUtil.checkTargetURL(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.checkResource(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
at java.net.URLClassLoader$1.run(URLClassLoader.java:358)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
at java.lang.Class.getMethod0(Class.java:2764)
at java.lang.Class.isCheckMemberAccessOverridden(Class.java:2204)
at java.lang.Class.checkMemberAccess(Class.java:2223)
at java.lang.Class.newInstance(Class.java:330)
at java.net.URL.getURLStreamHandler(URL.java:1199)
at java.net.URL.<init>(URL.java:590)
at java.net.URL.<init>(URL.java:482)
at java.net.URL.<init>(URL.java:431)
at com.sun.deploy.net.HttpUtils.removeQueryStringFromURL(Unknown Source)
at com.sun.deploy.cache.Cache.getKey(Unknown Source)
at com.sun.deploy.cache.Cache.getLapFileName(Unknown Source)
at com.sun.deploy.cache.Cache.putLapData(Unknown Source)
at com.sun.deploy.cache.DefaultLocalApplicationProperties.putLocalApplicationPropertiesStorage(Unknown Source)
at com.sun.deploy.cache.DefaultLocalApplicationProperties.store(Unknown Source)
at com.sun.deploy.security.SandboxSecurity.resetAcceptedVersion(Unknown Source)
at com.sun.javaws.ui.SecureStaticVersioning.resetAcceptedVersion(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Thread.java:724)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
/*
 * TestClient.java
 *
 * Created on November 1, 2005, 2:02 PM
 */

//package com.sun.appserv.test.client;

import java.awt.Color;
import java.lang.reflect.Field;
import java.util.Arrays;

/**
 *
 * @author  tjquinn
 */
public class TestClient extends javax.swing.JFrame {


    public TestClient() {
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate= " collapsed "  desc= " Generated Code " >//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jTextArea1 = new javax.swing.JTextArea();
        jScrollPane1 = new javax.swing.JScrollPane();
        argValueList = new javax.swing.JList();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel1.setLayout(new java.awt.BorderLayout());

        jTextArea1.setBackground(javax.swing.UIManager.getDefaults().getColor( " Panel.background " ));
        jTextArea1.setEditable(false);
        jTextArea1.setFont(new java.awt.Font( " Arial " , 0, 13));
        jTextArea1.setLineWrap(true);
        jTextArea1.setText( " Below are the command line arguments received during launch " );
        jTextArea1.setWrapStyleWord(true);
        jPanel1.add(jTextArea1, java.awt.BorderLayout.NORTH);

        jScrollPane1.setViewportView(argValueList);

        jPanel1.add(jScrollPane1, java.awt.BorderLayout.CENTER);

        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        jLabel1.setFont(new java.awt.Font( " Arial " , 0, 18));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText( " Sample Application Client U/I " );
        getContentPane().add(jLabel1, java.awt.BorderLayout.NORTH);

        pack();
    }// </editor-fold>//GEN-END:initComponents
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            private TestClient client;
            public void run() {
                System.out.println( " About to set visible to TRUE " );
                client.setVisible(true);
                System.out.println( " Just set visible to TRUE " );
            }
            
            public Runnable init(String args[]) {
                client = new TestClient();
                client.initArgs(args);
                String overridingColorName = System.getProperty( " color " );
                if (overridingColorName != null) {
                    final Color overridingColor = toColor(overridingColorName);
                    if (overridingColor != null) {
                        client.argValueList.setBackground(overridingColor);
                    }
                }
                System.out.println( " Just finished initArgs call with arguments =  "  + Arrays.toString(args));
                return this;
            }
        }.init(args));
        System.out.println( " About to return from static main " );
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JList argValueList;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;
    // End of variables declaration//GEN-END:variables
    
    private void initArgs(String[] args) {
        argValueList.setListData(args);
    }

    private static Color toColor(final String colorName) {
        try {
            final Field colorField = Color.class.getField(colorName);
            return (Color) (colorField.get(null));
        } catch (NoSuchFieldException ex) {
            return null;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
None known.
                                    

Comments
URL:   http://hg.openjdk.java.net/jdk7u/jdk7u/jdk/rev/ad8490675e4c
User:  lana
Date:  2013-12-30 06:31:14 +0000

                                     
2013-12-30
It is related to the fix for JDK-8010117.  Class.getMethod to look up the named method may resolve parameter types and returned type of other public methods declared in this class.  In the reported problem, the custom security manager is com.sun.enterprise.security.ee.J2EESecurityManager that does not overrride checkMemberAccess method.  Class.newInstance requires to check package access but it calls the common method that will first determine if the checkMemberAccess method is overridden by the custom security manager that has a public method whose parameter type, com.sun.enterprise.security.ee.PermissionCache [1], has not been loaded and so the VM attempts to resolve it and fails.

    public synchronized void enablePermissionCache(PermissionCache c);

[1] http://grepcode.com/file/maven.java.net/content/groups/promoted/org.glassfish.main.security/security-ee/4.0-b60/com/sun/enterprise/security/ee/J2EESecurityManager.java/

This fix may require a special VM entry point for the library to query if a given class overrides a method without the side effect of loading any class.
                                     
2013-08-22
SQE is ok to take the fix in 7u60.
                                     
2013-12-16
URL:   http://hg.openjdk.java.net/jdk7u/jdk7u-dev/jdk/rev/ad8490675e4c
User:  mchung
Date:  2013-12-19 00:49:00 +0000

                                     
2013-12-19
Seems to be related with changes in java.langClass.checkMemberAccess method done in JDK-8010117
                                     
2013-08-02



Hardware and Software, Engineered to Work Together