aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ancoron Luciferis (JIRA)" <>
Subject [jira] [Created] (ARIES-1288) ClassCastException with proxy set in bean of generic class
Date Wed, 21 Jan 2015 17:24:35 GMT
Ancoron Luciferis created ARIES-1288:

             Summary: ClassCastException with proxy set in bean of generic class
                 Key: ARIES-1288
             Project: Aries
          Issue Type: Bug
          Components: Blueprint
    Affects Versions: blueprint-core-1.4.2
            Reporter: Ancoron Luciferis

I have a blueprint configuration as follows (actually from a third-party application):
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns=""

    <bean id="meterDaoBean" class="">
        <jpa:context unitname="MeterUnit" property="entityManager" />

    <reference id="securityService" interface="" availability="optional"/>

    <bean id="secureMeterDaoBean" class="">
        <property name="dao" ref="meterDaoBean" />
        <property name="securityService" ref="securityService" />

    <bean id="meterBean" class="">
        <tx:transaction method="*" value="Required" />

        <property name="meterDao" ref="secureMeterDaoBean" />

    <service ref="meterBean" interface=""/>


...and the (for this issue relevant) class definitions look as follows:
public interface CrudDao<T> {

public abstract class SecureDao<T, R extends CrudDao<T>> implements CrudDao<T>
    protected R dao;

    // ...

    public void setDao(R dao) {
        this.dao = dao;

public interface MeterDao extends CrudDao<MeterEntity> {

public class JpaMeterDao extends JpaCrudDao<MeterEntity> implements MeterDao {

public class SecureMeterDao extends SecureDao<MeterEntity, MeterDao> implements MeterDao

    // ...

    public MeterEntity get(String id) {
        // some security stuff...

\\ with that usage of generics the proxy that gets created for the "dao" member in the
{{SecureMeterDao}} bean instance only implements {{CrudDao}}, but not {{MeterDao}}.

So, although the initial blueprint setup of beans and services is fine, any call traveling
through the {{SecureMeterDao}} results in a {{ClassCastException}}:
java.lang.ClassCastException: Proxyf427f861_7a7d_41e8_98c7_a09aea99f756 cannot be cast to
	at Proxy8bef53d7_0df3_4724_a67c_fb296af2aee2.get(Unknown Source)
	at Proxya8f9ae87_fa39_42ae_bf11_baa82efa76cc.get(Unknown Source)

This message was sent by Atlassian JIRA

View raw message