Wildfly 8.2.1에서 실행되는 EJB 상태없는 프로젝트 (helloworld)가 있습니다. Java 1.7 및 클라이언트 응용 프로그램이있는 최종 서버 자바 1.8. 오류가 발생했습니다. 스레드에서 당신java.lang.ClassCastException : org.jboss.ejb.client.naming.ejb.EjbNamingContext를
예외 감사 "주"java.lang.ClassCastException가이 : org.jboss.ejb.client.naming.ejb.EjbNamingContext는 닷컴에서 com.aburak.sb.SessionBeanRemote으로 캐스팅 할 수 없습니다. aburak.sb.Driver.main (Driver.java:15는)
이 클라이언트 응용 프로그램을
public class Driver {
public static void main(String[] args) throws NamingException {
Context context=Driver.getInitialContext();
SessionBeanRemote sbRemote= (SessionBeanRemote) context.lookup("ejb:SessionBean/SessionBean!com.aburak.sb.SessionBeanRemote");
sbRemote.sessionBeanMethod();
}
public static Context getInitialContext() throws NamingException{
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
properties.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
properties.setProperty(Context.PROVIDER_URL, "http://127.0.0.1:8080");
return new InitialContext(properties);
}
}
원격 BeanSession
내 드라이버 클래스입니다@Stateless
@TransactionManagement(TransactionManagementType.BEAN)
public class SessionBean implements SessionBeanRemote, SessionBeanLocal{
private static final long serialVersionUID = -7201692010023776738L;
@Override
public void sessionBeanMethod() {
System.out.println("SessionBean executed...");
}
SessionBeanRemote
@Remote
public interface SessionBeanRemote extends SessionBeanIF{
}
SessionBeanIF
public interface SessionBeanIF extends Serializable{
public void sessionBeanMethod();
}
(SessionBeanLocal 정확한 같은 @Local 주석을 제외하고 SessionBeanRemote이다)이 클라이언트 드라이브 클래스
public class Driver {
public static void main(String[] args) throws NamingException {
Context context=Driver.getInitialContext();
SessionBeanRemote sbRemote= (SessionBeanRemote) context.lookup("ejb:SessionBean/SessionBean!com.aburak.sb.SessionBeanRemote");
sbRemote.sessionBeanMethod();
}
public static Context getInitialContext() throws NamingException{
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
properties.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
properties.setProperty(Context.PROVIDER_URL, "http://127.0.0.1:8080");
return new InitialContext(properties);
}
}
입니다
SessionBeanClient >>의 pom.xml
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-ejb-client-bom</artifactId>
<version>8.2.1.Final</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-jms-client-bom</artifactId>
<version>8.2.1.Final</version>
<type>pom</type>
</dependency>
</dependencies>
세션빈 >>의 pom.xml
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>javax.ejb-api</artifactId>
<version>3.2</version>
<scope>compile</scope>
</dependency>
나는 this tutorial video 따라하지만 난 그것을 뭔가 애플리케이션 서버 등 을 변경하고도 오류가 this을 찾을 검색하지만, 내 문제를 해결하지 못했습니다.
이 내 Package explorer
감사합니다 네 당신의 도움이됩니다.