tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iagla...@vacosolventus.com
Subject java.lang.ClassCastException: $Proxy8
Date Mon, 02 Feb 2009 10:01:49 GMT
Hello,

I am trying to run a simple OpenEJB project using JSP and Tomcat. I could not find a proper
way to reference EJB from JSP so I tired using the same code that works fine in a unit test,
but not in JSP.

<%
        Properties p = new Properties();
	p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
	InitialContext initialContext = new InitialContext( p );
	Object o = initialContext.lookup("SayHelloLocal");
	SayHelloLocal local = (SayHelloLocal)o;
%>

However, during the cast operation on the last line above, the class loader throws java.lang.ClassCastException:
$Proxy8. This seems to happen when JasperClassLoader trying to load the SayHelloLocal class.

I am using the latest OpenEJB release so I only have the ejb-jar.xml file and I use annotations
to discover and load EJBs. This works fine during unit testing.

Is there a correct way to reference the EJB from JSP using JNDI name that works with OpenEJB?
Did I not set the classpath correctly for Tomcat? I am using Tomcat 6.0. The below output
is from Console window within Eclipse 3.4.

Cheers,
Arkady

Feb 2, 2009 10:40:21 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source'
to 'org.eclipse.jst.jee.server:SayHelloWeb' did not find a matching property.
Feb 2, 2009 10:40:21 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production
environments was not found on the java.library.path: /usr/java/jdk1.5.0_16/jre/lib/i386/client:/usr/java/jdk1.5.0_16/jre/lib/i386:/usr/java/jdk1.5.0_16/jre/../lib/i386:/opt/MozillaFirefox/lib
Feb 2, 2009 10:40:21 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Feb 2, 2009 10:40:21 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1004 ms
Feb 2, 2009 10:40:21 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 2, 2009 10:40:22 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
Feb 2, 2009 10:40:23 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Feb 2, 2009 10:40:23 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Feb 2, 2009 10:40:24 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/124  config=null
Feb 2, 2009 10:40:24 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2163 ms
Apache OpenEJB 3.1    build: 20081009-03:31
http://openejb.apache.org/
INFO - openejb.home = /home/aglabek
INFO - openejb.base = /home/aglabek
INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default
Security Service)
INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default
Transaction Manager)
INFO - Found EjbModule in classpath: /home/aglabek/.eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/SayHelloWeb/WEB-INF/lib/SayHello.jar
INFO - Beginning load: /home/aglabek/.eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/SayHelloWeb/WEB-INF/lib/SayHello.jar
INFO - Configuring enterprise application: classpath.ear
INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default
Stateless Container)
INFO - Auto-creating a container for bean SayHello: Container(type=STATELESS, id=Default Stateless
Container)
INFO - Enterprise application "classpath.ear" loaded.
INFO - Assembling app: classpath.ear
INFO - Jndi(name=SayHelloLocal) --> Ejb(deployment-id=SayHello)
INFO - Jndi(name=SayHelloRemote) --> Ejb(deployment-id=SayHello)
INFO - Created Ejb(deployment-id=SayHello, ejb-name=SayHello, container=Default Stateless
Container)
INFO - Deployed Application(path=classpath.ear)
Feb 2, 2009 10:40:30 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.ClassCastException: $Proxy8
	at org.apache.jsp.index_jsp._jspService(index_jsp.java:71)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Thread.java:595)





Mime
View raw message