EJB3,lookup到Bean后,不能强转成业务接口。请帮帮忙
这个是我的业务接口
package com.helloworld;import java.util.Date;public interface HelloWorldRemote { public String getAuthor(); public String getVersion(); public Date getDate(); public String getUUID();}package com.helloworld.bean;import java.util.Date;import java.util.UUID;import javax.annotation.PostConstruct;import javax.annotation.PreDestroy;import javax.ejb.Remote;import javax.ejb.Stateless;import com.helloworld.HelloWorldRemote;@Stateless@Remote (HelloWorldRemote.class)public class HelloWorldBean implements HelloWorldRemote { @PostConstruct public void postConstruct() { System.out.println(this.getClass().getName()+"被初始化!"); } @PreDestroy public void destory() { System.out.println(this.getClass().getName()+"被销毁!"); } public String getAuthor() { return "tyo"; } public Date getDate() { return new Date(); } public String getUUID() { return UUID.randomUUID().toString(); } public String getVersion() { return "v1.0"; }} public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); HelloWorldRemote h = null; try { Context context = new InitialContext(); h = (HelloWorldRemote)context.lookup("HelloWorldBean/remote"); } catch (NamingException e) { e.printStackTrace(); } out.flush(); out.close(); }