Thank you for your answer. I finally solve this problem. But now i cant call a EJB with
success. Jboss 4.2.1 throws me ClassCantCastException.
00:31:12,157 INFO [Server] Starting JBoss (MX MicroKernel)...
00:31:12,161 INFO [Server] Release ID: JBoss [Trinity] 4.2.1.GA (build:
SVNTag=JBoss_4_2_1_GA date=200707131605)
00:31:12,163 INFO [Server] Home Dir: /usr/java/jboss-4.2.1.GA
00:31:12,163 INFO [Server] Home URL: file:/usr/java/jboss-4.2.1.GA/
00:31:12,165 INFO [Server] Patch URL: null
00:31:12,165 INFO [Server] Server Name: jboss-config
00:31:12,165 INFO [Server] Server Home Dir:
/home/anavarro/workspace/HelloWorldServlet/domains/jboss-config
00:31:12,166 INFO [Server] Server Home URL:
file:/home/anavarro/workspace/HelloWorldServlet/domains/jboss-config/
00:31:12,166 INFO [Server] Server Log Dir:
/home/anavarro/workspace/HelloWorldServlet/domains/jboss-config/log
00:31:12,166 INFO [Server] Server Temp Dir:
/home/anavarro/workspace/HelloWorldServlet/domains/jboss-config/tmp
00:31:12,166 INFO [Server] Root Deployment Filename: jboss-service.xml
00:31:13,282 INFO [ServerInfo] Java version: 1.5.0_12,Sun Microsystems Inc.
00:31:13,283 INFO [ServerInfo] Java VM: Java HotSpot(TM) Client VM 1.5.0_12-b04,Sun
Microsystems Inc.
00:31:13,283 INFO [ServerInfo] OS-System: Linux 2.6.20-15-generic,i386
00:31:14,094 INFO [Server] Core system initialized
00:31:17,682 INFO [WebService] Using RMI server codebase:
http://127.0.0.1:8083/
00:31:17,688 INFO [Log4jService$URLWatchTimerTask] Configuring from URL:
resource:jboss-log4j.xml
00:31:18,946 INFO [TransactionManagerService] JBossTS Transaction Service (JTA version) -
JBoss Inc.
00:31:18,947 INFO [TransactionManagerService] Setting up property manager MBean and JMX
layer
00:31:19,404 INFO [TransactionManagerService] Starting recovery manager
00:31:19,635 INFO [TransactionManagerService] Recovery manager started
00:31:19,636 INFO [TransactionManagerService] Binding TransactionManager JNDI Reference
00:31:25,508 INFO [EJB3Deployer] Starting java:comp multiplexer
00:31:28,722 INFO [ServiceEndpointManager] jbossws-1.2.1.GA (build=200704151756)
00:31:32,121 INFO [AprLifecycleListener] The Apache Tomcat Native library which allows
optimal performance in production environments was not found on the java.library.path:
/usr/java/jdk1.5.0_12/jre/lib/i386/client:/usr/java/jdk1.5.0_12/jre/lib/i386:/usr/java/jdk1.5.0_12/jre/../lib/i386:/usr/lib/firefox/
00:31:32,344 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-127.0.0.1-8080
00:31:32,346 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009
00:31:32,347 INFO [Catalina] Initialization processed in 626 ms
00:31:32,347 INFO [StandardService] Starting service jboss.web
00:31:32,353 INFO [StandardEngine] Starting Servlet Engine: JBossWeb/2.0.0.GA
00:31:32,969 INFO [Catalina] Server startup in 622 ms
00:31:33,256 INFO [TomcatDeployer] deploy, ctxPath=/,
warUrl=.../deploy/jboss-web.deployer/ROOT.war/
00:31:34,741 INFO [TomcatDeployer] deploy, ctxPath=/invoker,
warUrl=.../deploy/http-invoker.sar/invoker.war/
00:31:35,151 INFO [TomcatDeployer] deploy, ctxPath=/jbossws,
warUrl=.../tmp/deploy/tmp21714jbossws-context-exp.war/
00:31:35,474 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil,
warUrl=.../deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
00:31:37,701 INFO [TomcatDeployer] deploy, ctxPath=/web-console,
warUrl=.../deploy/management/console-mgr.sar/web-console.war/
00:31:38,890 INFO [MailService] Mail Service bound to java:/Mail
00:31:39,192 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in
.../deploy/jboss-ha-local-jdbc.rar
00:31:39,282 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in
.../deploy/jboss-ha-xa-jdbc.rar
00:31:39,365 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in
.../deploy/jboss-local-jdbc.rar
00:31:39,453 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in
.../deploy/jboss-xa-jdbc.rar
00:31:39,634 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in
.../deploy/jms/jms-ra.rar
00:31:39,721 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in
.../deploy/quartz-ra.rar
00:31:39,742 INFO [QuartzResourceAdapter] start quartz!!!
00:31:39,923 INFO [SimpleThreadPool] Job execution threads will use class loader of
thread: main
00:31:39,978 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
00:31:39,996 INFO [RAMJobStore] RAMJobStore initialized.
00:31:39,997 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler'
initialized from default resource file in Quartz package: 'quartz.properties'
00:31:39,998 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
00:31:39,998 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED
started.
00:31:41,325 INFO [ConnectionFactoryBindingService] Bound ConnectionManager
'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name
'java:DefaultDS'
00:31:42,037 INFO [A] Bound to JNDI name: queue/A
00:31:42,041 INFO [B] Bound to JNDI name: queue/B
00:31:42,045 INFO [C] Bound to JNDI name: queue/C
00:31:42,049 INFO [D] Bound to JNDI name: queue/D
00:31:42,055 INFO [ex] Bound to JNDI name: queue/ex
00:31:42,107 INFO [testTopic] Bound to JNDI name: topic/testTopic
00:31:42,112 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
00:31:42,118 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
00:31:42,125 INFO [testQueue] Bound to JNDI name: queue/testQueue
00:31:42,281 INFO [UILServerILService] JBossMQ UIL service available at :
/127.0.0.1:8093
00:31:43,422 INFO [DLQ] Bound to JNDI name: queue/DLQ
00:31:43,700 INFO [ConnectionFactoryBindingService] Bound ConnectionManager
'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name
'java:JmsXA'
00:31:43,769 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console,
warUrl=.../deploy/jmx-console.war/
00:31:44,348 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
00:31:44,389 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
00:31:44,423 INFO [Server] JBoss (MX MicroKernel) [4.2.1.GA (build: SVNTag=JBoss_4_2_1_GA
date=200707131605)] Started in 32s:251ms
00:32:34,418 INFO [EARDeployer] Init J2EE application:
file:/home/anavarro/workspace/HelloWorldServlet/domains/jboss-config/deploy/HelloWorld.ear
00:32:35,359 INFO [JmxKernelAbstraction] creating wrapper delegate for:
org.jboss.ejb3.stateless.StatelessContainer
00:32:35,395 INFO [JmxKernelAbstraction] installing MBean:
jboss.j2ee:ear=HelloWorld.ear,jar=HelloWorld.jar,name=LocalRemoteCalculator,service=EJB3
with dependencies:
00:32:35,850 INFO [EJBContainer] STARTED EJB:
test.ejb.stateless.calculator.LocalRemoteCalculator ejbName: LocalRemoteCalculator
00:32:36,077 INFO [JmxKernelAbstraction] creating wrapper delegate for:
org.jboss.ejb3.stateless.StatelessContainer
00:32:36,077 INFO [JmxKernelAbstraction] installing MBean:
jboss.j2ee:ear=HelloWorld.ear,jar=HelloWorld.jar,name=StatelessCalculator,service=EJB3
with dependencies:
00:32:36,105 INFO [EJBContainer] STARTED EJB:
test.ejb.stateless.calculator.StatelessCalculator ejbName: StatelessCalculator
00:32:36,121 INFO [JmxKernelAbstraction] creating wrapper delegate for:
org.jboss.ejb3.stateless.StatelessContainer
00:32:36,121 INFO [JmxKernelAbstraction] installing MBean:
jboss.j2ee:ear=HelloWorld.ear,jar=HelloWorld.jar,name=HelloBean,service=EJB3 with
dependencies:
00:32:36,139 INFO [EJBContainer] STARTED EJB: test.ejb.stateless.hello.HelloBean ejbName:
HelloBean
00:32:36,178 INFO [EJB3Deployer] Deployed:
file:/home/anavarro/workspace/HelloWorldServlet/domains/jboss-config/tmp/deploy/tmp21743HelloWorld.ear-contents/HelloWorld.jar
00:32:36,186 INFO [TomcatDeployer] deploy, ctxPath=/HelloWorld,
warUrl=.../tmp/deploy/tmp21743HelloWorld.ear-contents/HelloWorld-exp.war/
00:32:36,496 INFO [EARDeployer] Started J2EE application:
file:/home/anavarro/workspace/HelloWorldServlet/domains/jboss-config/deploy/HelloWorld.ear
00:32:44,392 ERROR [STDERR] java.lang.ClassCastException: $Proxy71
00:32:44,393 ERROR [STDERR] at HelloWorld.service(HelloWorld.java:39)
00:32:44,393 ERROR [STDERR] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
00:32:44,393 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
00:32:44,393 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
00:32:44,393 ERROR [STDERR] at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
00:32:44,393 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
00:32:44,394 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
00:32:44,394 ERROR [STDERR] at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
00:32:44,394 ERROR [STDERR] at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
00:32:44,394 ERROR [STDERR] at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
00:32:44,394 ERROR [STDERR] at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
00:32:44,394 ERROR [STDERR] at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
00:32:44,395 ERROR [STDERR] at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
00:32:44,395 ERROR [STDERR] at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
00:32:44,395 ERROR [STDERR] at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
00:32:44,395 ERROR [STDERR] at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
00:32:44,395 ERROR [STDERR] at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
00:32:44,395 ERROR [STDERR] at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
00:32:44,395 ERROR [STDERR] at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
00:32:44,395 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
this is the jboss log.
public class HelloWorld extends HttpServlet {
public void service(HttpServletRequest request, HttpServletResponse response) throws
IOException, ServletException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String saludo = "";
try {
/*
InitialContext ctx = new InitialContext();
Object o = ctx.lookup("HelloWorld/HelloBean");
Hello h = (Hello) o;
saludo = h.hello();
*/
InitialContext ctx = new InitialContext();
Calculator cal = (Calculator)
ctx.lookup("HelloWorld/StatelessCalculator/local");
cal.calculate(1, 65, 5.5, 4.3);
} catch (Exception e) {
e.printStackTrace ();
}
out.println("");
out.println("");
out.println("Hello World Servlet!");
out.println("");
out.println("");
out.println("<p align=\"center\"><font size=\"5\"
color=\"#000080\">" + saludo + "!");
out.println("<p align=\"center\"><a
href=\"javascript:history.back()\">Go to Home");
out.println("");
out.println("");
}
}
this is the servlet.
package test.ejb.stateless.calculator;
public interface Calculator {
public double calculate (int start, int end, double growthrate, double saving);
}
package test.ejb.stateless.calculator;
import org.jboss.annotation.ejb.LocalBinding;
import org.jboss.annotation.ejb.RemoteBinding;
import javax.ejb.*;
@Stateless
@Local ({Calculator.class})
@LocalBinding (jndiBinding="EJB3Trail/LocalCalculator")
@Remote ({RemoteCalculator.class})
@RemoteBinding (jndiBinding="EJB3Trail/RemoteCalculator")
public class LocalRemoteCalculator implements Calculator, RemoteCalculator {
public double calculate (int start, int end, double growthrate, double saving) {
double tmp = Math.pow(1. + growthrate / 12., 12. * (end - start) + 1);
return saving * 12. * (tmp - 1) / growthrate;
}
public String getServerInfo () {
return "This is the JBoss EJB 3.0 Trail Blazer";
}
}
package test.ejb.stateless.calculator;
public interface RemoteCalculator {
public double calculate (int start, int end, double growthrate, double saving);
public String getServerInfo ();
}
package test.ejb.stateless.calculator;
import org.jboss.annotation.ejb.LocalBinding;
import javax.ejb.*;
@Stateless
// @LocalBinding (jndiBinding="EJB3Trail/slsb/Calculator")
public class StatelessCalculator implements Calculator {
public double calculate (int start, int end, double growthrate, double saving) {
double tmp = Math.pow(1. + growthrate / 12., 12. * (end - start) + 1);
return saving * 12. * (tmp - 1) / growthrate;
}
}
and this are the classes source code of the EJB 3 bean
I hope you can find my problem.
Thank you for your time .
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079413#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...