incubator-yoko-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Salishev (JIRA)" <j...@apache.org>
Subject [jira] Created: (YOKO-360) java.lang.Error: cannot find computeSerialVersionUID method when running Caucho Resin AppServer on Harmony
Date Thu, 26 Apr 2007 15:49:16 GMT
java.lang.Error: cannot find computeSerialVersionUID method when running Caucho Resin AppServer
on Harmony
----------------------------------------------------------------------------------------------------------

                 Key: YOKO-360
                 URL: https://issues.apache.org/jira/browse/YOKO-360
             Project: Yoko - CORBA Server
          Issue Type: Bug
          Components: RMI-IIOP
    Affects Versions: Incubation
            Reporter: Sergey Salishev


java.lang.Error: cannot find computeSerialVersionUID method 
        at org.apache.yoko.rmi.impl.ValueDescriptor$1.run(ValueDescriptor.java:158) 
        at java.security.AccessController.doPrivilegedImpl(AccessController.java:171) 
        at java.security.AccessController.doPrivileged(AccessController.java:53) 
        at org.apache.yoko.rmi.impl.ValueDescriptor.getSerialVersionUID(ValueDescriptor.java:138)

        at org.apache.yoko.rmi.impl.ValueDescriptor.getRepositoryID(ValueDescriptor.java:109)

        at org.apache.yoko.rmi.impl.TypeRepository.init(TypeRepository.java:81) 
        at org.apache.yoko.rmi.impl.TypeRepository.<init>(TypeRepository.java:45) 
        at org.apache.yoko.rmi.impl.RMIState.getTypeRepository(RMIState.java:63) 
        at org.apache.yoko.rmi.impl.RMIState.createValueHandler(RMIState.java:146) 
        at org.apache.yoko.rmi.impl.UtilImpl.createValueHandler(UtilImpl.java:450) 
        at javax.rmi.CORBA.Util.createValueHandler(Util.java:61) 
        at com.caucho.iiop.any.TypeCodeFactory.<clinit>(TypeCodeFactory.java:40) 
        at com.caucho.iiop.orb.ORBImpl.<init>(ORBImpl.java:57) 
        at com.caucho.loader.EnvironmentClassLoader.initializeEnvironment(EnvironmentClassLoader.java:567)

        at com.caucho.loader.EnvironmentClassLoader.init(EnvironmentClassLoader.java:161)

        at com.caucho.loader.ClassLoaderConfig.init(ClassLoaderConfig.java:164) 
        at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java) 
        at java.lang.reflect.Method.invoke(Method.java:381) 
        at com.caucho.config.j2ee.PostConstructProgram.configureImpl(PostConstructProgram.java:62)

        at com.caucho.config.BeanTypeStrategy.init(BeanTypeStrategy.java:355) 
        at com.caucho.config.NodeBuilder.configureImpl(NodeBuilder.java:253) 
        at com.caucho.config.EnvironmentAttributeStrategy.configure(EnvironmentAttributeStrategy.java:60)

        at com.caucho.config.NodeBuilder.configureAttributeImpl(NodeBuilder.java:390) 
        at com.caucho.config.NodeBuilder.configureBeanImpl(NodeBuilder.java:329) 
        at com.caucho.config.TypeStrategy.configureBean(TypeStrategy.java:104) 
        at com.caucho.config.BeanTypeStrategy.configureBean(BeanTypeStrategy.java:257) 
        at com.caucho.config.EnvironmentTypeStrategy.configureBean(EnvironmentTypeStrategy.java:65)

        at com.caucho.config.NodeBuilder.configureImpl(NodeBuilder.java:251) 
        at com.caucho.config.NodeBuilder.configure(NodeBuilder.java:160) 
        at com.caucho.config.Config.configure(Config.java:232) 
        at com.caucho.config.Config.configure(Config.java:176) 
        at com.caucho.boot.ResinBoot.<init>(ResinBoot.java:134) 
        at com.caucho.boot.ResinBoot.main(ResinBoot.java:397) 
        at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java) 
        at java.lang.reflect.Method.invoke(Method.java:381) 
        at org.apache.harmony.vm.JarRunner.main(JarRunner.java:80) 
Caused by: java.lang.NoSuchMethodException: computeDefaultSUID(java.lang.Class) 
        at java.lang.Class.findMatchingMethod(Class.java:802) 
        at java.lang.Class.getDeclaredMethod(Class.java:429) 
        at org.apache.yoko.rmi.impl.ValueDescriptor$1.run(ValueDescriptor.java:149) 
        at java.security.AccessController.doPrivilegedImpl(AccessController.java:171) 

This failure occurs as Yoko depends on private java.lang.Class.computeSerialVersionUID method
which is of course not present in Harmony. 

The org.apache.yoko.rmi.impl.ValueDescriptor.getSerialVersionUID code looks very strange as
some sort of hacky performance optimization. I've made simple patch which fixes the problem
by removing all the suspicious code.

Index: rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueDescriptor.java
===================================================================
--- rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueDescriptor.java	(revision 532714)
+++ rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueDescriptor.java	(working copy)
@@ -122,8 +122,6 @@
         return _repid;
     }
 
-    static java.lang.reflect.Method computeSerialVersionUID_method = null;
-
     long getSerialVersionUID() {
         if (_serial_version_uid_field != null) {
 
@@ -134,55 +132,10 @@
             }
         }
 
-        if (computeSerialVersionUID_method == null) {
-            java.security.AccessController
-                    .doPrivileged(new java.security.PrivilegedAction() {
-                        public Object run() {
+        java.io.ObjectStreamClass serialForm = java.io.ObjectStreamClass.lookup(getJavaClass());
+       
+        return serialForm != null ? serialForm.getSerialVersionUID() : 0L;
 
-                            try {
-                                try {
-                                    computeSerialVersionUID_method = java.io.ObjectStreamClass.class
-                                            .getDeclaredMethod(
-                                                    "computeSerialVersionUID",
-                                                    new Class[] { Class.class });
-                                } catch (Exception ex) {
-                                    computeSerialVersionUID_method = java.io.ObjectStreamClass.class
-                                            .getDeclaredMethod(
-                                                    "computeDefaultSUID",
-                                                    new Class[] { Class.class });
-                                }
-                                computeSerialVersionUID_method
-                                        .setAccessible(true);
-
-                            } catch (Exception ex) {
-                                throw new Error(
-                                        "cannot find computeSerialVersionUID method",
-                                        ex);
-                            }
-
-                            return null;
-                        }
-                    });
-        }
-
-        try {
-            if (computeSerialVersionUID_method != null) {
-                Long result = (Long) computeSerialVersionUID_method.invoke(
-                        null, new Object[] { getJavaClass() });
-
-                return result.longValue();
-            }
-
-            return java.io.ObjectStreamClass.lookup(getJavaClass())
-                    .getSerialVersionUID();
-
-        } catch (Throwable ex) {
-            logger.finer("Cannot compute serial version UID. "
-                    + "This may be because you're running "
-                    + "the Apache Yoko RMI on a JVM which is not compatible. "
-                    + ex);
-            return 0;
-        }
     }
 
     public void init() {



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message