-
1. Re: Serialization, NoSuchMethodException in ProfileServiceUn
starksm64 Dec 17, 2007 12:21 PM (in response to starksm64)The problem looks to be an incorrect generation of the ClassLoader.defineClass(byte[], int, int) method. What shows up on the test client is a ReflectMethodInfoImpl(defineClass) object that has a parameterTypes[0] value of ArrayInfoImpl@4532be10{name=[Ljava.lang.Object;}. There is no defineClass method that takes an array of Objects.
-
2. Re: Serialization, NoSuchMethodException in ProfileServiceUn
alesj Dec 17, 2007 12:48 PM (in response to starksm64)You're right. :-(
This test shows it:public class Test { public static void main(String[] args) { try { Configuration configuration = new PropertyConfiguration(); BeanInfo beanInfo = configuration.getBeanInfo(ClassLoader.class); Set<MethodInfo> methods = beanInfo.getMethods(); for(MethodInfo mi : methods) { byte[] bytes = serialize((Serializable)mi); Object o = deserialize(bytes); System.out.println("o = " + o); } } catch (Exception e) { e.printStackTrace(); } } protected static byte[] serialize(Serializable object) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(object); oos.close(); return baos.toByteArray(); } protected static Object deserialize(byte[] bytes) throws Exception { ByteArrayInputStream bais = new ByteArrayInputStream(bytes); ObjectInputStream ois = new ObjectInputStream(bais); return ois.readObject(); } }
Any ideas?
I'll have a look at it.
Trying to fix it, and commit together with all the changes needed for Alexey. -
3. Re: Serialization, NoSuchMethodException in ProfileServiceUn
alesj Dec 17, 2007 1:26 PM (in response to starksm64)Found it. :-)
From WeakTypeCache:private T getGenericArrayType(GenericArrayType type) { // TODO JBMICROCONT-131 this needs implementing properly return get(Object[].class); }
Adrian? :-)
Or what to do?
Since if implementing this was trivial, it would have been already done. ;-) -
4. Re: Serialization, NoSuchMethodException in ProfileServiceUn
starksm64 Dec 17, 2007 1:34 PM (in response to starksm64)Its already there in some form as this test produces the correct primitive ArrayInfo:
public void testByteArrayInfo() { TypeInfoFactory factory = getTypeInfoFactory(); byte[] x = {}; TypeInfo xinfo = factory.getTypeInfo(x.getClass()); getLog().debug(xinfo); assertTrue(xinfo instanceof ArrayInfo); ArrayInfo ainfo = (ArrayInfo) xinfo; } 28 DEBUG [ByteArrayUnitTestCase] ArrayInfoImpl@3148aa23{name=[B}
-
5. Re: Serialization, NoSuchMethodException in ProfileServiceUn
alesj Dec 17, 2007 1:41 PM (in response to starksm64)Yes.
This is when you are trying to transform runtime type instance - which is generics unaware.
If you did something like this:public class MyClass { public byte[] someBytes(); }
And then (pseudo) MyClass.getMethod("someBytes").getGenericReturnType().
Then it would fail.
In this codepublic T get(Type type) { if (type == null) throw new IllegalArgumentException("Null type"); if (type instanceof ParameterizedType) return getParameterizedType((ParameterizedType) type); else if (type instanceof Class) return getClass((Class<?>) type); else if (type instanceof TypeVariable) // TODO Figure out why we need this cast with the Sun compiler? return (T) getTypeVariable((TypeVariable) type); else if (type instanceof GenericArrayType) return getGenericArrayType((GenericArrayType) type); else if (type instanceof WildcardType) return getWildcardType((WildcardType) type); else throw new UnsupportedOperationException("Unknown type: " + type + " class=" + type.getClass()); }
The first example is picked up by (instance of Class), where the 2nd one is by the method I mentioned before. -
6. Re: Serialization, NoSuchMethodException in ProfileServiceUn
starksm64 Dec 17, 2007 1:57 PM (in response to starksm64)Ok, I see. The initial implementation getGenericArrayType that should be simple is to handle primitive arrays.
The problem is that the getGenericArrayType does not belong in the WeakTypeClass as a private method as it cannot be override to return an ArrayInfo. The implementation should simply be the following in IntrospectionTypeInfoFactoryImpl:protected ArrayInfo getGenericArrayType(GenericArrayType type) { Type compType = type.getGenericComponentType(); TypeInfo componentType = getTypeInfo(compType); ArrayInfoImpl result = new ArrayInfoImpl(componentType); return result; }
-
7. Re: Serialization, NoSuchMethodException in ProfileServiceUn
alesj Dec 17, 2007 2:13 PM (in response to starksm64)OK, I'll fix this.
But you'll have to do the release - in this case of commons as well. :-) -
8. Re: Serialization, NoSuchMethodException in ProfileServiceUn
starksm64 Dec 17, 2007 2:57 PM (in response to starksm64)OK.
-
9. Re: Serialization, NoSuchMethodException in ProfileServiceUn
alesj Dec 17, 2007 7:50 PM (in response to starksm64)"scott.stark@jboss.org" wrote:
OK.
I've updated and commited commons core.
And I'll comment this code in IntrospectionTypeInfoFactoryImplprotected TypeInfo getGenericArrayType(GenericArrayType type) { Type compType = type.getGenericComponentType(); TypeInfo componentType = getTypeInfo(compType); return new ArrayInfoImpl(componentType); }
otherwise current MC build would complain.
So, once you've updated Commons-core, please uncomment this code. :-) -
10. Re: Serialization, NoSuchMethodException in ProfileServiceUn
starksm64 Dec 17, 2007 8:11 PM (in response to starksm64)Just check in the other changes as I have the IntrospectionTypeInfoFactoryImpl change done with a test case and am releasing common 2.2.3.GA now.
-
11. Re: Serialization, NoSuchMethodException in ProfileServiceUn
alesj Dec 17, 2007 8:14 PM (in response to starksm64)Just commited other changes.
-
12. Re: Serialization, NoSuchMethodException in ProfileServiceUn
starksm64 Dec 17, 2007 10:55 PM (in response to starksm64)The server fails to load any deployers with the current mc trunk jars:
19:49:59,750 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): *** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State} WSDeployerHook_JAXRPC_POST_JSE -> WebServiceDeployerPostJSE{Installed:Instantiated} -> WebServiceDeployerPostJSE{Installed:Instantiated} -> WSDeployerHook_JAXRPC_POST_JSE{Installed:Configured} -> WSDeployerHook_JAXRPC_POST_JSE{Installed:Configured} -> WebServiceDeployerPostJSE{Start:Instantiated} -> WebServiceDeployerPostJSE{Create:Instantiated} WSDeployerHook_JAXRPC_PRE_JSE -> WebServiceDeployerPreJSE{Installed:Instantiated} -> WebServiceDeployerPreJSE{Start:Instantiated} -> WSDeployerHook_JAXRPC_PRE_JSE{Installed:Configured} -> WebServiceDeployerPreJSE{Create:Instantiated} -> WebServiceDeployerPreJSE{Installed:Instantiated} -> WSDeployerHook_JAXRPC_PRE_JSE{Installed:Configured} WSDeployerHook_JAXWS_POST_JSE -> WebServiceDeployerPostJSE{Installed:Instantiated} -> WebServiceDeployerPostJSE{Start:Instantiated} -> WSDeployerHook_JAXWS_POST_JSE{Installed:Configured} -> WSDeployerHook_JAXWS_POST_JSE{Installed:Configured} -> WebServiceDeployerPostJSE{Installed:Instantiated} -> WebServiceDeployerPostJSE{Create:Instantiated} WSDeployerHook_JAXWS_PRE_JSE -> WebServiceDeployerPreJSE{Create:Instantiated} -> WebServiceDeployerPreJSE{Installed:Instantiated} -> WebServiceDeployerPreJSE{Installed:Instantiated} -> WSDeployerHook_JAXWS_PRE_JSE{Installed:Configured} -> WSDeployerHook_JAXWS_PRE_JSE{Installed:Configured} -> WebServiceDeployerPreJSE{Start:Instantiated} WebServiceDeployerPostJSE -> WarDeployer{Configured:** NOT FOUND **} -> WebAppParsingDeployer{Create:** NOT FOUND **} -> WebAppParsingDeployer{Start:** NOT FOUND **} WebServiceDeployerPreJSE -> WebAppParsingDeployer{Start:** NOT FOUND **} -> WarDeployer{Configured:** NOT FOUND **} -> WebAppParsingDeployer{Create:** NOT FOUND **} *** CONTEXTS IN ERROR: Name -> Error WarDeployer -> ** NOT FOUND ** WebAppParsingDeployer -> ** NOT FOUND ** 19:49:59,752 INFO [ServerImpl] JBoss (Microcontainer) [5.0.0.Beta3 (build: SVNTag=JBoss_5_0_0_Beta3 date=200712171832)] Started in 24s:687ms
have you tried trunk against jbossas? I'm looking into what has changed. -
13. Re: Serialization, NoSuchMethodException in ProfileServiceUn
starksm64 Dec 17, 2007 11:41 PM (in response to starksm64)It was the change in the jboss-structure.xml that broke the jbossweb.deployer.
-
14. Re: Serialization, NoSuchMethodException in ProfileServiceUn
starksm64 Dec 18, 2007 12:17 AM (in response to starksm64)Still seeing a marshalling problem:
Caused by: java.lang.NoSuchMethodException: class org.jboss.resource.connectionmanager.JBossManagedConnectionPool.access$000 - [class org.jboss.resource.connectionmanager.JBossManagedConnectionPool] at org.jboss.reflect.plugins.introspection.ReflectionUtils.findExactMethod(ReflectionUtils.java:240) at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.readObject(ReflectMethodInfoImpl.java:129) at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946) ... 157 more
We are returning too much information, the org.jboss.resource.connectionmanager.JBossManagedConnectionPool should not be seen by the client. Am I the only one seeing these marshalling errors?