users@glassfish.java.net

Glassfish v3 & EJB 3

From: <glassfish_at_javadesktop.org>
Date: Thu, 18 Feb 2010 00:33:57 PST

have error, why ?:
[i]Feb 18, 2010 12:56:13 PM com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
Exception in thread "main" java.lang.ClassCastException: [b]ru._NewSessionBeanRemote_Wrapper cannot be cast to ru.NewSessionBean[/b]
        at ejb_client.Main.main(Main.java:31)[/i]


[b]ejb server:[/b]

NewSessionBeanRemote.java:

[i]package ru;
import javax.ejb.Remote;

@Remote
public interface NewSessionBeanRemote {

    String businessMethod(String parameter);
    
}
[/i]

NewSessionBean.java:

[i]package ru;

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

@Stateless

public class NewSessionBean implements NewSessionBeanRemote {

    public String businessMethod(String parameter) {
         return "Hello EJB World";
    }
}[/i]


[b]client:[/b]

[i]public class Main {
    public static void main(String[] args) {
        try {
            InitialContext ctx = new InitialContext();
            NewSessionBean testEJB = (NewSessionBean) ctx.lookup("ru.NewSessionBeanRemote");
            System.out.println(testEJB.businessMethod(null));
        } catch (NamingException nex) {
            nex.printStackTrace();
        }
    }
    }[/i]

In classpath: gf-client.jar
[Message sent by forum member 'technomen' (tomskiy_at_gmail.com)]

http://forums.java.net/jive/thread.jspa?messageID=387338