Fehler: $Proxy294 cannot be cast to src.interfaces.DataProtectionInterface

ceene

Erfahrenes Mitglied
Hallo Leute

Ich habe ein kleines Problem mit meiner Web-Anwendung.
Ich arbeite mit dem JBoss 4.2.3, Seam 2.1
Ich möchte in meinem Web-Projekt ein Bean aufrufen, und es dann in meinem Projekt verwenden. Leider bekomme ich immer den Fehler "$Proxy294 cannot be cast to src.interfaces.DataProtectionInterface"

Hier die Klasse in dem ich das Versuche das Bean aufzurufen:
Code:
package src.ejb;

import java.util.List;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import src.entity.RecipientData;
import src.interfaces.DataProtectionInterface;
import src.klassen.AdressIdType;

public class DataProtectionService implements DataProtectionInterface {
	
	private DataProtectionInterface manager;
	
	public DataProtectionService() throws NamingException
    {
        Context context = new InitialContext();
       /*Hier tritt der Fehler auf*/
        manager = (DataProtectionInterface) context.lookup("DataProtectionBean/remote");
    }
	
	@Override
	public List<RecipientData> getRecipients(String country, AdressIdType type,
			long id) {
		// TODO Auto-generated method stub
		return (manager.getRecipients(country, type, id));
	}

}

Hier das Interface dazu:
Code:
package src.interfaces;

import java.util.List;

import src.entity.RecipientData;
import src.klassen.AdressIdType;

public interface DataProtectionInterface {

    List<RecipientData> getRecipients(String country,
                                      AdressIdType type,
                                      long id);
}

Hier noch das RemoteInterface vom Bean:
Code:
package com;

import java.util.List;

import javax.ejb.Remote;

@Remote
public interface DataProtection {

	List<RecipientData> getRecipients(String country, AdressIdType type, long id);

}

und das Bean:
Code:
package com;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.Remote;
import javax.ejb.Stateless;

@Stateless
@Remote(DataProtection.class)
public class DataProtectionBean implements DataProtection {

	public List<RecipientData> getRecipients(String country, AdressIdType type, long id)
    {
		RecipientData data;
        List<RecipientData> result = new ArrayList<RecipientData>();
        
        for(int i = 0; i<=4; i++)
        {
        	data = new RecipientData();
        	data.setId(new Integer(i).toString());
        	data.setAdrLine1("Name" + new Integer(i).toString());
        	data.setAdrLine2("Strasse" + new Integer(i).toString());
        	data.setAdrLine3("Zip" + new Integer(i).toString() + " " + "City");
        	data.setAdrLine4("Country" + new Integer(i).toString());
        	result.add(data);
        }
        
        return result;
    }
	
}

Ich kann einfach nicht nachvollziehen wo das Problem liegt. Ich hoffe hier kann mir jemand helfen.
 
Mmmhhhh....so wie es aussieht müssen die Interface-Namen gleich sein. Aber gehen tut es immer noch nicht :-(
 
Zuletzt bearbeitet:

Neue Beiträge

Zurück