0 Replies Latest reply on Apr 12, 2007 3:47 AM by Dinesh Agrawalla

    Invoking session object from other web application

    Dinesh Agrawalla Newbie

      I am new to EJB3. Created a new EJB3 TRAIL project in eclipse and deployed one stateless session bean. I created a client jsp in the same Trail project and deployed Trail.ear in jboss default directory. It went well and successfully invoked the session bean from client. Next I create a dynamic web project WebTest and copied the client jsp code from Trail application to the web project, then i created a WebTest.war file and deployed that in same jboss server where my Session bean is deployed in Trail application. I got the following error while i Invoke JSP client of WebTest project. Do i need to include any other jars in my webproject as The EJB is deployed in other application??


      13:11:26,392 ERROR [STDERR] java.lang.ClassCastException: $Proxy70
      13:11:26,392 ERROR [STDERR] at org.apache.jsp.Hello_jsp.jspInit(Hello_jsp.java:18)
      13:11:26,392 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:78)
      13:11:26,392 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServlet
      Wrapper.java:155)
      13:11:26,392 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.getDependants(JspServ
      letWrapper.java:258)
      13:11:26,392 ERROR [STDERR] at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:406)

      13:11:26,392 ERROR [STDERR] at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:332)

      13:11:26,392 ERROR [STDERR] at org.apache.jasper.JspCompilationContext.compile(JspCompilationCon
      text.java:560)
      13:11:26,392 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWra
      pper.java:305)
      13:11:26,392 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.ja
      va:314)
      13:11:26,392 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

      13:11:26,392 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      13:11:26,392 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
      ApplicationFilterChain.java:252)
      13:11:26,392 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicat
      ionFilterChain.java:173)
      13:11:26,392 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHead
      erFilter.java:96)
      13:11:26,392 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
      ApplicationFilterChain.java:202)
      13:11:26,392 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicat
      ionFilterChain.java:173)
      13:11:26,392 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrap
      perValve.java:213)
      13:11:26,392 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardCont
      extValve.java:178)
      13:11:26,392 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Sec
      urityAssociationValve.java:175)
      13:11:26,392 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContext
      Valve.java:74)
      13:11:26,392 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostVal
      ve.java:126)
      13:11:26,392 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportVal
      ve.java:105)
      13:11:26,392 ERROR [STDERR] at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedC
      onnectionValve.java:156)
      13:11:26,392 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngin
      eValve.java:107)

      JSP clinet
      
      <%@ page import="trail.slsb.*, javax.naming.*, java.text.*"%>
      
      <%!
       private Calculator cal = null;
       public void jspInit () {
       try {
       InitialContext ctx = new InitialContext();
       cal = (Calculator) ctx.lookup("Trail/StatelessCalculator/local");
      
       } catch (Exception e) {
       e.printStackTrace ();
       }
       }
      %>
      
      <%
       String result;
       int start = 25;
       int end = 65;
       double growthrate = 0.08;
       double saving = 300.0;
       try {
      
      
       NumberFormat nf = NumberFormat.getInstance();
       nf.setMaximumFractionDigits(2);
       result = nf.format(cal.calculate(start, end, growthrate, saving));
      
       } catch (Exception e) {
       // e.printStackTrace ();
       result = "Not valid." + e.getMessage();
       }
      %>