geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: ClassCastException when using a self written TypeConverter
Date Mon, 09 Jul 2007 14:28:51 GMT

On Jul 9, 2007, at 5:41 AM, MoleSon wrote:

>
> I just saw, that I made an mistake when deploying the app: I forgot  
> to update
> the deployment plan so that the typeconverter was not listed. This  
> means:
> deploying doesn't work at all.

I'm not quite sure exactly what you mean :-)

I'd guess that the class cast exception you got was due to the tranql  
TypeConverter being loaded in 2 classloaders.  Offhand I can't see  
how this is happening.  To investigate I would put a breakpoint where  
the class cast exception is happening and use inspection and  
evaluation capabilities of your IDE to investigate:
- which classloader A is loading your type converter
- which classloader B is loading TypeConverter
- the relationship between these classloaders
- what you get from
ClassLoader C = A.loadClass(TypeConverter.class.getName 
()).getClassLoader()
I think that if B == C then you should not get a CCE and if B != C  
you will get a CCE.  Knowing what all these classloaders are and how  
they are related should help figure out what is going on.

>
> @Gianny: there is no MultiParentClassLoader, but there is a  
> variable called
> cl which is a JarFileClassLoader and the id of this one is:
> default/<myAppName>/1.0/car

That's the multiparent classloader :-)
>
> I also tried out geronimo 2.0 but when I deploy my app, i get a
> NullPointerException without any serious information why it is  
> thrown. I
> also was not able to make eclipse debug geronimo 2.0 so I'll stay  
> with to
> 1.1 version for now and need to get my problems fixed there.
>
I think we'd appreciate more information about what went wrong with  
2.0.  Was there a stack trace?  Maybe in the geronimo.log?  If you  
can share a sample app showing the problem that would be excellent.

What went wrong when you tried to debug geronimo 2.0 in eclipse?  I  
haven't had any problems using Intellij IDEA.

thanks
david jencks

>
> MoleSon wrote:
>>
>> I managed to deploy my application now by adding the tranql jar to  
>> my ear
>> file, but this threw up a bunch of new errors now, so i'll follow  
>> your
>> suggestion to update to the new geronimo version ;)
>>
>> Manu George wrote:
>>>
>>> I remember facing a similar issue and I think that there is a bug  
>>> with
>>> the TypeConverter stuff in OpenEJB. I would second Gianny's  
>>> advice to
>>> use Geronimo 2.0 and OEJB 3.0 and get back if there are issues  
>>> there.
>>>
>>> Regards
>>> Manu
>>>
>>> On 7/5/07, Gianny Damour <gianny.damour@optusnet.com.au> wrote:
>>>> On 05/07/2007, at 10:34 PM, MoleSon wrote:
>>>>
>>>>> Could not deploy module
>>>>> org.apache.geronimo.common.DeploymentException: Could not deploy
>>>>> module
>>>>>       ...
>>>>> Caused by: org.apache.geronimo.common.DeploymentException: Cannot
>>>>> create
>>>>> type converter mypackage.MyTypeConverter
>>>>>       at
>>>>> org.openejb.deployment.SchemataBuilder.processEnterpriseBeans
>>>>> (SchemataBuilder.java:436)
>>>>>       ... 32 more
>>>>> Caused by: java.lang.ClassCastException: mypackage.MyTypeConverter
>>>>>       at
>>>>> org.openejb.deployment.SchemataBuilder.processEnterpriseBeans
>>>>> (SchemataBuilder.java:434)
>>>>>       ... 33 more
>>>>>
>>>>> I had a look at the geronimo source code and notices that the
>>>>> Exception is
>>>>> thrown at these lines in the ScemataBuilder:
>>>>> try
>>>>> {
>>>>>       Class typeConverterClass = cl.loadClass 
>>>>> (mapping.getTypeConverter
>>>>> ().trim());
>>>>>       typeConverter = (TypeConverter) 
>>>>> typeConverterClass.newInstance();
>>>>> }
>>>>> catch(Exception e)
>>>>> {
>>>>>       throw new DeploymentException("Cannot create type  
>>>>> converter " +
>>>>> mapping.getTypeConverter(), e);
>>>>> }
>>>>
>>>> It is hard to diagnostic. Could you please put a breakpoint after
>>>> cl.loadClass and tell us what the value of  
>>>> MultiParentClassLoader.id
>>>> is? Also, I strongly recommend you to migrate to the latest version
>>>> of Geronimo/OpenEJB, which uses OpenJPA as the underlying  
>>>> persistence
>>>> framework for CMPs. This migration should be "effortless" as you do
>>>> not need to change your OpenEJB deployment descriptors.  
>>>> Furthermore,
>>>> you will also be able to leverage the simplified programming  
>>>> model of
>>>> EJB3.
>>>>
>>>> Thanks,
>>>> Gianny
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/ 
> ClassCastException-when-using-a-self-written-TypeConverter- 
> tf4029440s134.html#a11498758
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>


Mime
View raw message