[JBoss JIRA] Created: (EJBTHREE-1163) java.lang.ClassCastException
by Masoodah Ahmed (JIRA)
java.lang.ClassCastException
----------------------------
Key: EJBTHREE-1163
URL: http://jira.jboss.com/jira/browse/EJBTHREE-1163
Project: EJB 3.0
Issue Type: Bug
Components: EJB3 Extensions
Environment: Windows XP
Reporter: Masoodah Ahmed
Hi,
I am currently experimenting with EJB.
I receive java.lang.ClassCastException: $Proxy489 cannot be cast to com.jbossatwork.ejb.InventoryFacadeLocalHome
error when I cast the EJBLocalHome object to the Class InventoryFacadeLocalHome.
My JNDI look up is OK.
what could be my problem.
Context c = new InitialContext();
System.out.println( "lookupInventoryFacadeBean");
Object localObj = c.lookup("java:comp/env/ejb/InventoryFacadeLocal");
System.out.println( "1. class name [" +localObj.toString()+"]");
EJBLocalHome localHome = null;
localHome = (EJBLocalHome) localObj;
if (localHome != null) {
System.out.println("localHome is not null");
} else {
System.out.println("localHome is null");
}
System.out.println("2. class name [" + localHome.toString() + "]");
InventoryFacadeLocalHome rv = (InventoryFacadeLocalHome)localHome;
System.out.println("3. class name [" + localHome.toString() + "]");
my output is
15:33:10,015 INFO [EARDeployer] Init J2EE application: file:/C:/Program Files/jboss-4.0.5.GA/server/default/deploy/DreamPlay.ear
15:33:10,656 INFO [EjbModule] Deploying InventoryFacadeBean
15:33:10,656 INFO [EjbModule] Deploying FiboBean
15:33:10,687 INFO [BaseLocalProxyFactory] Bound EJB LocalHome 'InventoryFacadeBean' to jndi 'InventoryFacadeLocal'
15:33:10,687 INFO [ProxyFactory] Bound EJB Home 'InventoryFacadeBean' to jndi 'InventoryFacadeRemote'
15:33:10,687 INFO [ProxyFactory] Bound EJB Home 'FiboBean' to jndi 'FiboRemote'
15:33:10,687 INFO [EJBDeployer] Deployed: file:/C:/Program Files/jboss-4.0.5.GA/server/default/tmp/deploy/tmp31233DreamPlay.ear-contents/DreamPlay-ejb.jar
15:33:11,015 INFO [TomcatDeployer] deploy, ctxPath=/DreamPlay, warUrl=.../tmp/deploy/tmp31233DreamPlay.ear-contents/DreamPlay-webapp-exp.war/
15:33:11,077 INFO [EARDeployer] Started J2EE application: file:/C:/Program Files/jboss-4.0.5.GA/server/default/deploy/DreamPlay.ear
15:33:13,999 INFO [STDOUT] lookupInventoryFacadeBean
15:33:13,999 INFO [STDOUT] 1. class name [InventoryFacadeLocalHome]
15:33:13,999 INFO [STDOUT] localHome is not null
15:33:13,999 INFO [STDOUT] 2. class name [InventoryFacadeLocalHome]
15:33:13,999 ERROR [[Controller]] Servlet.service() for servlet Controller threw exception
java.lang.ClassCastException: $Proxy513 cannot be cast to com.jbossatwork.ejb.InventoryFacadeLocalHome
at ControllerServlet.lookupInventoryFacadeBean2(ControllerServlet.java:456)
at ControllerServlet.processRequest(ControllerServlet.java:163)
at ControllerServlet.doGet(ControllerServlet.java:145)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:619)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years
[JBoss JIRA] Created: (EJBTHREE-1162) CLONE -EJB3 Remoting New Client Socket is Being Created
by Kumarselvan Somasundaram (JIRA)
CLONE -EJB3 Remoting New Client Socket is Being Created
-------------------------------------------------------
Key: EJBTHREE-1162
URL: http://jira.jboss.com/jira/browse/EJBTHREE-1162
Project: EJB 3.0
Issue Type: Bug
Affects Versions: AS 4.2.0 GA
Environment: JBoss 4.2.0 GA, JDK 1.5.0_08-b03, Windows XP SP2
Reporter: Kumarselvan Somasundaram
Assigned To: Carlo de Wolf
Priority: Critical
Fix For: AS 5.0.0.Beta3, AS 4.2.2.GA
After a lot of call (>3000) to an EJB3 SLSB this exception is throwed :
org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://127.0.0.1:3873/]
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:530)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
at org.jboss.remoting.Client.invoke(Client.java:1550)
at org.jboss.remoting.Client.invoke(Client.java:530)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
at $Proxy0.bar(Unknown Source)
at client.Test.main(Test.java:22)
Caused by: java.net.BindException: Address already in use: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:516)
at org.jboss.remoting.transport.socket.SocketClientInvoker.createSocket(SocketClientInvoker.java:187)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.java:801)
at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:526)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
at org.jboss.remoting.Client.invoke(Client.java:1550)
at org.jboss.remoting.Client.invoke(Client.java:530)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
at $Proxy0.bar(Unknown Source)
at client.Test.main(Test.java:22)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
... 10 more
Jboss server and test client are on the same host.
For each call, a new TCP connection is opened, with a different local port. So there is also a performance problem.
Here is a simple code to reproduce :
-- EJB3 remote Interface --
package ejb;
import javax.ejb.Remote;
@Remote
public interface Foo {
public void bar();
}
-- EJB3 Implementation --
package ejb;
import javax.ejb.Stateless;
@Stateless
public class FooBean implements Foo {
public void bar() {
}
}
-- client --
package client;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import ejb.Foo;
public class Test {
public static void main(String[] args) {
try {
Properties env = new Properties();
env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put("jnp.disableDiscovery", "true");
Context context = new InitialContext(env);
Foo foo = (Foo)context.lookup("FooBean/remote");
while(true) {
foo.bar();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years