0 Replies Latest reply on Dec 5, 2011 5:33 AM by aupres

    jsp exception..!

    aupres

      I use eclipse indigo and jboss 7.

       

      I coded ejb3 like below

       

      import javax.ejb.Remote;

       

      @Remote

      public interface IHelloWorldPort {

          public String sayHello(String name);

      }

       

      ======

      import javax.ejb.Stateless;

       

      @Stateless

      public class HelloWorldBean implements IHelloWorldPort {

      public String sayHello(String name) {

        // TODO Auto-generated method stub

        return "Hello " + name ;

      }

      }

       

      in another web project I coded like below

       

      ====== display.jsp =======

       

      <%@ page import="javax.naming.*"%>

      <%@ page import="com.aaa.ejb3.IHelloWorldPort"%> // this line throws exception !

       

      <html>

      <head>

      <meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">

      <title>EJB Hello World</title>

      </head>

      <body>

      <%

      try {

          Context ctx = new InitialContext();

          IHelloWorldPort hello = (IHelloWorldPort)ctx.lookup("HelloWorldBean/remote"); // exception !!

          String id = request.getParameter("id");

          out.println(hello.sayHello(id));

       

      Exceptions are thrown like below :

       

      org.apache.jasper.JasperException: Unable to compile class for JSP:

       

      An error occurred at line: 7 in the generated java file

      Only a type can be imported. com.aaa.ejb3.IHelloWorldPort resolves to a package

       

      An error occurred at line: 18 in the jsp file: /display.jsp

      IHelloWorldPort cannot be resolved to a type

       

      I can't import ejb3 interface on jsp file. jsp web project is connected to ejb3 project by build path. I have no idea what is wrong

      Kindly inform me of your advice! Thanks in advance.