thomas2004ch
Grünschnabel
Habe ein klines Programm geschrieben nach einem Tutor "http://trailblazer.demo.jboss.com/EJB3Trail/persistence/index.html".
Das Programm besteht aus einem EJB-Projekt (JAR) und einem Web-Projekt (WAR). Die beiden funtionieren ganz gut auf JBoss 4.2.2 Server.
Nun habe ich das Web-Projekt (WAR) auf Tomcat 6 deployt. Als ich versuche meine Seite aufzurufen, kriege ich Exception, dass irgendwie bei JNDI binding nicht funktionieren.
Hier sind Exceptionmeldung aus dem Browser:
Hier sind die Excption-Meldung aus Tomcat Console:
Meine JSP-Seite sieht so aus:
Hat jemand Erfahrung?
Gruß
Thomas
Das Programm besteht aus einem EJB-Projekt (JAR) und einem Web-Projekt (WAR). Die beiden funtionieren ganz gut auf JBoss 4.2.2 Server.
Nun habe ich das Web-Projekt (WAR) auf Tomcat 6 deployt. Als ich versuche meine Seite aufzurufen, kriege ich Exception, dass irgendwie bei JNDI binding nicht funktionieren.
Hier sind Exceptionmeldung aus dem Browser:
Code:
org.apache.jasper.JasperException: An exception occurred processing JSP page /addfund.jsp at line 46
43: <br />
44:
45: <%
46: Collection <Fund> funds = cal.getFunds();
47:
48: %>
49:
Hier sind die Excption-Meldung aus Tomcat Console:
Code:
INFO: Deploying web application archive TestJBossEJB3Web.war
javax.naming.NameNotFoundException: Name EntityCalculator is not bound in this C
ontext
at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.apache.jsp.addfund_jsp.jspInit(addfund_jsp.java:21)
at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:51)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrap
per.java:159)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:329)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
20)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
7)
at java.lang.Thread.run(Thread.java:595)
Meine JSP-Seite sieht so aus:
Code:
...
<%!private Calculator cal = null;
private NumberFormat nf = null;
public void jspInit() {
try {
InitialContext ctx = new InitialContext();
cal = (Calculator) ctx.lookup("EntityCalculator/remote");
} catch (Exception e) {
e.printStackTrace();
}
nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(2);
}%>
<%
if ("AddFund".equals(request.getParameter("action"))) {
cal.addFund(request.getParameter("fundname"), Double
.parseDouble(request.getParameter("fundrate")));
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
</head>
<body>
<p>Add a new Fund:<br />
<form action="addfund.jsp" method="POST">Fund Name : <input
type="text" name="fundname" value=""> Growth rate : <input
type="text" name="fundrate" value="0.05"><input type="hidden"
name="action" value="AddFund"><br />
<input type="submit" value="Add fund"><INPUT type="button"
value="Close Window" onClick="window.close()"></form>
<br />
<%
Collection <Fund> funds = cal.getFunds();
%>
Hat jemand Erfahrung?
Gruß
Thomas