ERLEDIGT
NEIN
NEIN
ANTWORTEN
3
3
ZUGRIFFE
381
381
EMPFEHLEN
-
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 :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
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 :1 2 3 4 5 6 7 8 9 10 11 12 13
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 :1 2 3 4 5 6 7 8 9 10 11 12
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 :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
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.
-
Hat keiner ne Idee?
-
Mmmhhhh....so wie es aussieht müssen die Interface-Namen gleich sein. Aber gehen tut es immer noch nicht
Geändert von ceene (11.10.10 um 13:30 Uhr)
-
19.10.10 22:31 #4
- Registriert seit
- Jun 2002
- Ort
- Saarbrücken (Saarland)
- Beiträge
- 9.886
- Blog-Einträge
- 29
Hallo,
schau mal hier:
http://www.tutorials.de/enterprise-j...d-ejb-3-a.html
Gruß TomJava rocks!
How to become a good Java Programmer?
Does IT in Java and .Net
The only valid measurement of code quality: WTFs / minute
Blog
Xing
Twitter
Ähnliche Themen
-
Interfaces in anderen Interfaces implementieren
Von mueslirocker im Forum Algorithmen & Datenstrukturen mit JavaAntworten: 0Letzter Beitrag: 12.09.10, 18:12 -
Hibernate Cast [Ljava.lang.Object; cannot be cast to Data.Data.TeilAufgabe
Von luigied im Forum JavaAntworten: 8Letzter Beitrag: 03.06.10, 22:09 -
[C] cast: INT zu CHAR
Von myhonor im Forum C/C++Antworten: 3Letzter Beitrag: 14.12.09, 13:43 -
Reflection + Cast
Von meinereiner85 im Forum JavaAntworten: 13Letzter Beitrag: 02.10.08, 13:00 -
cast
Von masterjcl im Forum C/C++Antworten: 3Letzter Beitrag: 25.11.04, 20:20





Zitieren

Login





