Using JSP examples in the tutorial of JSP Tomcat

I have installed Tomcat 4.0.4 and j2sdk1.4.0.
I have set the folowwing environment variables :
JAVA_HOME = c:\j2sdk1.4.0
CLASSPATH = c:\j2sdk1.4.0
When I try to run the examples from the tutorial, I have the following errors :
Apache Tomcat/4.0.4 - HTTP Status 500 - Internal Server Error
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: sun/tools/javac/Main
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:481)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
     at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
     at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
     at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
     at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
     at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
     at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
     at java.lang.Thread.run(Thread.java:536)
root cause
java.lang.NoClassDefFoundError: sun/tools/javac/Main
     at org.apache.jasper.compiler.SunJavaCompiler.compile(SunJavaCompiler.java:136)
     at org.apache.jasper.compiler.Compiler.compile(Compiler.java:272)
     at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548)
     at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
     at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188)
     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
     at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
     at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
     at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
     at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
     at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
     at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
     at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
     at java.lang.Thread.run(Thread.java:536)
What is wrong ?

Add this into your
CLASSPATH
<Drive you install Tomcat In>:\Apache Tomcat 4.0\common\lib\servlet.jar
(This enables Tomcat to find the servlet class files)
CATALINA_HOME
<Drive you install Tomcat In>:\Apache Tomcat 4.0
You should also read the documentation that comes with your Tomcat
Hope this helps!

Similar Messages

  • Applet Example in the Tutorial

    Why does the Appletviewer lock up my computer when
    I try the applet example in the tutorial? Even the
    example applet in the DEMO\ANIMATOR folder locks
    up when I type APPLETVIEWER example1.html. Actually,
    I did see something whirling around once, when I typed
    APPLETVIEWER example1.html, but now every applet
    example in the DEMO folder locks up my computer. I'm
    running Windows ME and I've got the following two
    instructions in AUTOEXEC.BAT.
    SET PATH=C:\jdk1.4\bin
    SET CLASSPATH=.;C:\jdk1.4\lib\tools.jar

    I don't see much of a difference between your path and mine. I tried your suggestion, but my computer still locks up. In fact my second computer also locks up with Appletviewer, I wouldn't be surpised if Appletviewer locks up my third computer. I'm going to try this program under Windows 98 instead of Windows ME. Thanks for your suggestion.

  • How to Show the Alerts inside the Form in JSP?

    Hello
    I am having parent form inside that thru one of the links,opening
    a small another JSP. Inside the small another JSP, i am validating
    the Screen and giving alerts. While Validating, the Alerts are coming
    outside the small another JSP and appearing in the Parent Big Page.
    I want the alert to appear in the small Another JSP. What to do?
    Thanks

    When you submit, the whole form is submitted. thats why you are getting alerts like that.
    you can use HTML frames to avoid these. but it is not possible to have frames inside a form. you have to have forms inside a frame. submit that particular frame's form so that only that part will be refreshed with messages/alerts.
    the otherway is paint the screen as it was earlier just change the inner jsp content. its seems you are getting only alerts cos the information is same.
    -sun

  • How to communicate between Flex and JSP and show the result in an Iframe

    Hi all
    I am trying to send some data from flex to one HTTPService and trying to show the same response jsp in an Iframe. But unfortunately i am unable to get the responce Jsp's url to set as a source for iframe.
    let me explain you clearly...I have a mxml where i am having a text box and a button in the left panel and in the right panel i am having an Iframe to display jsp. So once user enters some value in the text box and clicks button then HTTPservice's send method will be called with text box's content as an arguement. So i can fetch that value from request object in jsp and display the value in jsp. So the problem here is i want display that result jsp in my Iframe. I know that , we need that result jsp URL to display in Iframe . But as i am sending POST request to HTTPservice, i am not able to get the result jsp's URL in flex side.
    So i need help desperately from great minds.So anyone of you can give me some suggestions!!!!
    Regards

    Hi all can some one please give a solution ...Any suggestions would be greatly appreciated

  • Having problem in learning JDeveloper base on the tutorial

    Hi,
    I would say I'm new to J2EE and JDeveloper is the first IDE tool that I'm intend to use. I like the tutorial (http://www.oracle.com/technology/obe/obe11jdev/11/ejb/ejb.html) very much as it is easy to understand. I follow the tutorial steps by steps(Note: I create my own schema and tables instead of installing the schema as in the tutorial) and I found that my JDeveloper interfaces are different with the sample in the tutorial. The version that I downloaded is exacly JDeveloper 11g (Preview 2). Is the version different?
    When I trying to run HRFacadeClient I encounter errors.
    I wish that I can attach document as I have done screenshot of the interfaces. Pls advise how should I further explain my problem? I really need help in order for me to conitnue my learning.
    Wen Xi

    Hi,
    First, really thanks, now I can follow the tutorial with the exact sample interface.
    Before I paste my error, first I wish to say that instead of using thr HR Schema that as stated in the tutortial, I use my own schema (wenxi) with two new tables, there are Employee & Department.
    After that I just follow the tutorial steps by steps, I have no problem in compiling the classes. I encounter problem when run the HRFacadeClient. Below is my error message. For tracing, I did try to
    comment out the for loop corresponding to the queryEmployeeFindAll() method, FAILED. After that I tried to comment out the for loop corresponding to the hRFacade.queryEmployeesFindByName() method and so on. But all FAILED. Below is the message that display after I have commented out hRFacade.queryEmployeesFindByName() & queryEmployeeFindAll() methods.
    [EclipseLink/JPA Client] Adding Java options: -javaagent:D:\JDeveloper\Middleware\jdeveloper\modules\oracle.toplink_11.1.1\eclipselink.jar
    D:\JDeveloper\Middleware\jdk160_05\bin\javaw.exe -client -classpath C:\JDeveloper\mywork\HR_EJB_JPA_App\.adf;C:\JDeveloper\mywork\HR_EJB_JPA_App\EJBModel\classes;D:\JDeveloper\Middleware\jdeveloper\modules\oracle.toplink_11.1.1\toplink.jar;D:\JDeveloper\Middleware\jdeveloper\modules\oracle.toplink_11.1.1\antlr.jar;D:\JDeveloper\Middleware\modules\com.bea.core.antlr.runtime_2.7.7.jar;D:\JDeveloper\Middleware\modules\javax.persistence_1.0.0.0_1-0.jar;D:\JDeveloper\Middleware\jdeveloper\modules\oracle.toplink_11.1.1\eclipselink.jar;D:\JDeveloper\Middleware\jdeveloper\modules\oracle.xdk_11.1.1\xmlparserv2.jar;D:\JDeveloper\Middleware\jdeveloper\modules\oracle.xdk_11.1.1\xml.jar;D:\JDeveloper\Middleware\modules\javax.jsf_1.2.0.0.jar;D:\JDeveloper\Middleware\modules\javax.ejb_3.0.1.jar;D:\JDeveloper\Middleware\modules\javax.enterprise.deploy_1.2.jar;D:\JDeveloper\Middleware\modules\javax.interceptor_1.0.jar;D:\JDeveloper\Middleware\modules\javax.jms_1.1.1.jar;D:\JDeveloper\Middleware\modules\javax.jsp_1.1.0.0_2-1.jar;D:\JDeveloper\Middleware\modules\javax.jws_2.0.jar;D:\JDeveloper\Middleware\modules\javax.activation_1.1.0.0_1-1.jar;D:\JDeveloper\Middleware\modules\javax.mail_1.1.0.0_1-1.jar;D:\JDeveloper\Middleware\modules\javax.xml.soap_1.3.1.0.jar;D:\JDeveloper\Middleware\modules\javax.xml.rpc_1.2.1.jar;D:\JDeveloper\Middleware\modules\javax.xml.ws_2.1.1.jar;D:\JDeveloper\Middleware\modules\javax.management.j2ee_1.0.jar;D:\JDeveloper\Middleware\modules\javax.resource_1.5.1.jar;D:\JDeveloper\Middleware\modules\javax.servlet_1.0.0.0_2-5.jar;D:\JDeveloper\Middleware\modules\javax.transaction_1.0.0.0_1-1.jar;D:\JDeveloper\Middleware\modules\javax.xml.stream_1.1.1.0.jar;D:\JDeveloper\Middleware\modules\javax.security.jacc_1.0.0.0_1-1.jar;D:\JDeveloper\Middleware\modules\javax.xml.registry_1.0.0.0_1-0.jar;D:\JDeveloper\Middleware\wlserver_10.3\server\lib\weblogic.jar -javaagent:D:\JDeveloper\Middleware\jdeveloper\modules\oracle.toplink_11.1.1\eclipselink.jar oracle.HRFacadeClient
    javax.ejb.EJBException: EJB Exception: ; nested exception is:
         java.lang.IllegalArgumentException: NamedQuery of name: Department.findAll not found.
         at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.unwrapRemoteException(RemoteBusinessIntfProxy.java:105)
         at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:87)
         at $Proxy8.queryDepartmentFindAll(Unknown Source)
         at oracle.HRFacadeClient.main(HRFacadeClient.java:25)
    Caused by: java.lang.IllegalArgumentException: NamedQuery of name: Department.findAll not found.
         at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getDatabaseQuery(EJBQueryImpl.java:454)
         at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setAsSQLReadQuery(EJBQueryImpl.java:117)
         at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.java:503)
         at oracle.HRFacadeBean.queryDepartmentFindAll(HRFacadeBean.java:43)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
         at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:126)
         at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:114)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
         at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:15)
         at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
         at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:30)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
         at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
         at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:126)
         at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:114)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
         at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
         at $Proxy76.queryDepartmentFindAll(Unknown Source)
         at oracle.HRFacade_mg5i94_HRFacadeImpl.queryDepartmentFindAll(HRFacade_mg5i94_HRFacadeImpl.java:143)
         at oracle.HRFacade_mg5i94_HRFacadeImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
         at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
         at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Process exited with exit code 0.
    Please advise.
    Wen Xi

  • JSP, Servlet, and Java Classes location in Tomcat

    In tomcat, I want to know JSP files, Servlets, and Java classes
    should put in different locations:
    I put web.xml in the following:
    C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF
    I put all JSP files in the following:
    C:\jakarta-tomcat-4.1.30\webapps\proj1
    I put all servlet files in the following:
    C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF\classes
    I put all Java classes in the following with package proj1:
    C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF\classes\proj1
    When I execute JSP files, it has HTTP error 404, file not found.
    The content of web.xml is:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <display-name>proj1</display-name>
    <description>
         proj1
    </description>
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>
    </web-app>
    Please advise. thanks!!!

    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>
    </web-app>Where's the servlet definition that maps to "invoker"?

  • Using jsp to connect SavingAccount tutorial example

    Hello
    I have a question on the tutorial i do not know if this is the right place but here it is
    I tried to change the SavingAccount EJB (j2eettutorial exmple chapter 24)and add a Web client to it. I modified the JSP which was used in the converter exmple to use savingsAccount Ejbs.
    I have spent a week on this simple example, it compiles, and deployed without a problem but when i run it on the browser it says error 404 the page does not exist.
    the exmple is only one Bean with two interfaces and one jsp page called index.jsp I am going mad, started to panic there is nothing wrong still why it does not work.
    I packaged the bean and used /context root for jsp imported the bean in jsp give the resource ref inside the jsp ...
    I do not understand what is the mestray behind this. is it because i only use one simple jsp? than what else should use to connect to ejb? can anyone help me please

    the code for Ejb bean classe
    package bookings;
    import java.sql.*;
    import javax.sql.*;
    import java.util.*;
    import java.util.Date;
    import java.math.*;
    import javax.ejb.*;
    import javax.naming.*;
    public class BookBean implements EntityBean {
        private final static String dbName = "java:comp/env/jdbc/BooksDB";
        private String ISBN;
        private String title;
        private String author;
        private String borrowedBy;
        private String dateDue;
        private EntityContext context;
        private Connection con;
         public String getISBN() {
            return ISBN;
        public String getTitle() {
            return title;
        public String getAuthor() {
            return author;
        public String getBorrowedBy() {
            return borrowedBy;
    public String getDateDue() {
            return dateDue;
        public String ejbCreate(String ISBN, String title, String author,
            String borrowedBy, String dateDue) throws CreateException {
            try {
                insertRow(ISBN, title, author, borrowedBy, dateDue);
            } catch (Exception ex) {
                throw new EJBException("ejbCreate: " + ex.getMessage());
            this.ISBN = ISBN;
            this.title = title;
            this.author = author;
            this.borrowedBy = borrowedBy;   
            this.dateDue = dateDue;
            return ISBN;
        public String ejbFindByPrimaryKey(String primaryKey)
            throws FinderException {
            boolean result;
            try {
                result = selectByPrimaryKey(primaryKey);
            } catch (Exception ex) {
                throw new EJBException("ejbFindByPrimaryKey: " + ex.getMessage());
            if (result) {
                return primaryKey;
            } else {
                throw new ObjectNotFoundException("Row for      ISBN " + primaryKey +
                    " not found.");
        public Collection ejbFindByTitle(String title)
            throws FinderException {
            Collection result;
            try {
                result = selectByTitle(title);
            } catch (Exception ex) {
                throw new EJBException("ejbFindByTitle " + ex.getMessage());
            return result;
        public Collection ejbFindByAuthor(String author)
            throws FinderException {
            Collection result;
            try {
                result = selectByAuthor(author);
            } catch (Exception ex) {
                throw new EJBException("ejbFindByAuthor: " + ex.getMessage());
            return result;
        public void ejbRemove() {
            try {
                deleteRow(ISBN);
            } catch (Exception ex) {
                throw new EJBException("ejbRemove: " + ex.getMessage());
        public void setEntityContext(EntityContext context) {
            this.context = context;
        public void unsetEntityContext() {
        public void ejbActivate() {
            ISBN = (String) context.getPrimaryKey();
        public void ejbPassivate() {
            ISBN = null;
        public void ejbLoad() {
            try {
                loadRow();
            } catch (Exception ex) {
                throw new EJBException("ejbLoad: " + ex.getMessage());
        public void ejbStore() {
            try {
                storeRow();
            } catch (Exception ex) {
                throw new EJBException("ejbStore: " + ex.getMessage());
        public void ejbPostCreate(String ISBN, String title, String author,
            String borrowedBy,String dateDue) {
        /*********************** Database Routines *************************/
        private void makeConnection() {
            try {
                InitialContext ic = new InitialContext();
                DataSource ds = (DataSource) ic.lookup(dbName);
                con = ds.getConnection();
            } catch (Exception ex) {
                throw new EJBException("Unable to connect to database. " +
                    ex.getMessage());
        private void releaseConnection() {
            try {
                con.close();
            } catch (SQLException ex) {
                throw new EJBException("releaseConnection: " + ex.getMessage());
        private void insertRow(String ISBN, String title, String author,
            String borrowedBy, String dateDue) throws SQLException {
            makeConnection();
            String insertStatement =
                "insert into books values ( ? , ? , ? , ? )";
            PreparedStatement prepStmt = con.prepareStatement(insertStatement);
            prepStmt.setString(1, ISBN);
            prepStmt.setString(2, title);
            prepStmt.setString(3, author);
            prepStmt.setString(4, borrowedBy);
             prepStmt.setString(5, dateDue);
            prepStmt.executeUpdate();
            prepStmt.close();
            releaseConnection();
        private void deleteRow(String ISBN) throws SQLException {
            makeConnection();
            String deleteStatement = "delete from Books where ISBN = ? ";
            PreparedStatement prepStmt = con.prepareStatement(deleteStatement);
            prepStmt.setString(1, ISBN);
            prepStmt.executeUpdate();
            prepStmt.close();
            releaseConnection();
        private boolean selectByPrimaryKey(String primaryKey)
            throws SQLException {
            makeConnection();
            String selectStatement =
                "select ISBN " + "from Books where ISBN = ? ";
            PreparedStatement prepStmt = con.prepareStatement(selectStatement);
            prepStmt.setString(1, primaryKey);
            ResultSet rs = prepStmt.executeQuery();
            boolean result = rs.next();
            prepStmt.close();
            releaseConnection();
            return result;
        private Collection selectByTitle(String title)
            throws SQLException {
            makeConnection();
            String selectStatement =
                "select ISBN" + "from bo where title = ? ";
            PreparedStatement prepStmt = con.prepareStatement(selectStatement);
            prepStmt.setString(1, title);
            ResultSet rs = prepStmt.executeQuery();
            ArrayList a = new ArrayList();
            while (rs.next()) {
                String ISBN = rs.getString(1);
                a.add(ISBN);
            prepStmt.close();
            releaseConnection();
            return a;
        private Collection selectByAuthor(String author)
            throws SQLException {
            makeConnection();
            String selectStatement =
                "select ISBN from Books " +
                "where author = ?";
            PreparedStatement prepStmt = con.prepareStatement(selectStatement);
            prepStmt.setString(1, author);
            ResultSet rs = prepStmt.executeQuery();
            ArrayList a = new ArrayList();
            while (rs.next()) {
                String ISBN = rs.getString(1);
                a.add(ISBN);
            prepStmt.close();
            releaseConnection();
            return a;
        private void loadRow() throws SQLException {
            makeConnection();
            String selectStatement =
                "select title, author,borrowedBy, dateDue " +
                "from Books where ISBN = ? ";
            PreparedStatement prepStmt = con.prepareStatement(selectStatement);
            prepStmt.setString(1, this.ISBN);
            ResultSet rs = prepStmt.executeQuery();
            if (rs.next()) {
                this.title = rs.getString(1);
                this.author = rs.getString(2);
                this.borrowedBy=rs.getString(3);
                this.dateDue = rs.getString(4);
                prepStmt.close();
            } else {
                prepStmt.close();
                throw new NoSuchEntityException("Row for ISBN " + ISBN +
                    " not found in database.");
            releaseConnection();
        private void storeRow() throws SQLException {
            makeConnection();
            String updateStatement =
                "update Books set title =  ? ," +
                "author = ? , borrowedBy = ? " + " dateDue = ?, where ISBN = ?";
            PreparedStatement prepStmt = con.prepareStatement(updateStatement);
            prepStmt.setString(1, title);
            prepStmt.setString(2, author);
            prepStmt.setString(3, borrowedBy);       
            prepStmt.setString(4, dateDue);
            prepStmt.setString(5, ISBN);
            int rowCount = prepStmt.executeUpdate();
            prepStmt.close();
            if (rowCount == 0) {
                throw new EJBException("Storing row for ISBN " + ISBN + " failed.");
            releaseConnection();
    // end of BookBean the code for remot interface
    package bookings;
    import java.rmi.RemoteException;
    // Java extension packages
    import javax.ejb.*;
    public interface Book extends EJBObject {
        public void getISBN() throws RemoteException;
        public String getTitle() throws RemoteException;
        public String getAuthor() throws RemoteException;
        public String getBorrowedBy() throws RemoteException;
        public String getDateDue() throws RemoteException;
    }the codes for home // BookHome.java
    // BookHome is the home interface for entity EJB Book.
    package bookings;
    import java.util.Collection;
    import java.rmi.RemoteException;
    // Java extension packages
    import javax.ejb.*;
    public interface BookHome extends EJBHome {
        // create Book EJB using given book details
       public Book create( String ISBN, String title, String author,
            String borrowedBy, String dateDue)  throws RemoteException, CreateException;
       // find Book with given ISBN
       public Book findByPrimaryKey( String isbn )
          throws RemoteException, FinderException;
       // find all Books
       public Collection findAllBooks()
          throws RemoteException, FinderException;
       // find Books with given title
       public Collection findByTitle( String title )
          throws RemoteException, FinderException;
         // find Books with given author
        public Collection findByAuthor(String author)
            throws FinderException, RemoteException;
      // find Books with given author
        public Collection findBorrowedBy(String borrowedBy)
            throws FinderException, RemoteException;
      }the code for index.jsp to use the ejb which i get this error messgae when i run it
    HTTP 404 - File not found
    Internet Explorer i can tell you that i have deployed 8 times with changes
    <%@ page import="bookings.*, javax.ejb.*, javax.naming.*, javax.rmi.PortableRemoteObject, java.rmi.RemoteException" %>
    <%!
       private Book book = null;
       public void jspInit() {
          try {
             InitialContext ic = new InitialContext();
             Object objRef = ic.lookup("java:comp/env/ejb/TheBooking");
             BookHome home = (BookHome)PortableRemoteObject.narrow(objRef, BookHome.class);
             book = home.create();
          } catch (RemoteException ex) {
                System.out.println("Couldn't create book bean."+ ex.getMessage());
          } catch (CreateException ex) {
                System.out.println("Couldn't create book bean."+ ex.getMessage());
          } catch (NamingException ex) {
                System.out.println("Unable to lookup home: "+ "TheBook "+ ex.getMessage());
       public void jspDestroy() {   
             book = null;
    %>
    <html>
    <head>
        <title>Book</title>
    </head>
    <body bgcolor="white">
    <h1><b><center>Book</center></b></h1>
    <hr>
    <p>Enter an ISBN:</p>
    <form method="get">
    <input type="text" name="amount" size="25">
    <br>
    <p>
    <input type="submit" value="Submit">
    <input type="reset" value="Reset">
    </form>
    <%
        String isbn = request.getParameter("isbn");
    %>
       <p>
       <%= isbn %> the book isbn is  <%= book.getISBN() %> 
       <p>
       <%= title %> the book title <%= book.getTitle() %> 
    </body>
    </html>

  • How to sort the data in JSP using stylesheet sorting?

    Hi, i extracted data out in and display them <%=data%> in the jsp, but how to sort? do i have to provide a drop down list that gives different sorting options, and when user clicks on one option, say sort by title, the collection of results are sorted out on the same jsp page? so all in all, only one jsp page is needed or do i need to create xml files, etc?
    i have no idea how to integrate the xml sorting into the jsp page, even after seeing online help, cos there is no example of a jsp page with sorting to refer to. PLease help, thanks alot!

    im getting the data from beans, but one of the requirements was that i cant use the database to sort and display but i have to use xslt to do the sorting in the jsps, so i have no idea how to do so. possible to give an example? thanks

  • Using JSP scriplets in the JSF tags

    Hi,
    I haven't done that much JSP development using various tag libraries prior to looking at JSF, hence this very basic question:
    I am declaring and manipulating Java variables in my JSP. Is there a way to access those in my JSF tags? It seems that something like:
    <%
    String myString="MyLabel";
    %>
    <h:view>
    <h:outputText id="myID" value="<%=myString%>" />
    </h:view>
    blows up in the JSF processor.
    I am porting some stuff to JSF and hence do not use backing beans in all cases.
    Any suggestions/ideas/pointers are greatly appreciated.
    Thanks in advance,
    Vadim.

    JSF action element attributes take JSF EL expressions, not Java expressions. A JSF EL expression has access to objects in one of request, session or application scope only, not to scripting variables. One way to get your example to work is by putting the String in one of these scopes within the scriptlet, e.g.:
    <%
      String myString="MyLabel";
      request.setAttribute("myString", myString);
    %>
    <h:view>
      <h:outputText id="myID" value="#{myString}" />
    </h:view>But, if you're porting a JSP-based application to JSF, I strongly recommend that you move all scriptlet code into beans; otherwise it's kind of pointless to migrate to JSF. The strength of JSF is its separation of UI layout and application logic.
    Even though JSP happens to be one way to wire up a JSF view with JSF components, JSF has very little to do with JSP. You need to understand the basic JSF component model, event-driven development, and use JavaBeans to really gain any benefits. Don't be fooled into believing that JSF is "just a new JSP tag library" by the support for JSP as the default presentation layer; it's far more than that, and I personally believe that using JSP as the presentation layer makes using JSF a lot harder than it should be. In fact, most of the issues posted in this forum are issues with the JSP layer, not with the core JSF components or the infrastructure classes.
    Hans Bergsten (EG member)

  • Simple jsp example of using BI Bean in Myeclipse

    hi
    anyone can show me a simple jsp example of using BI Bean in Myeclipse
    or how to import BI Bean into Myeclipse
    I would so thankful for who can answer me.. please its urgent
    thanks

    Sorry, I was not very clear in my last message.
    I need all my webservices to share the same bean during one user session.
    Then, if a page calls 2 different web services, only 1 database connection is made instead of 2. And if the user opens other pages which call other webservices, they will use the connection kept into the session bean.
    Anyway, I tried to do like it is said in your website but I can not build my project. I have an error : java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/C:/.../build/web/WEB-INF/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. I do not understand because I have downloaded the jax-ws 2.1.1 api and no other libraries are imported in my project. :-(
    I wonder if it is not related to netbeans...

  • How to pass the data in jsp using bpel

    Hi,
    Please find the below requirement.
    i need to call jsp post method service using hidden variable i need to pass the input and authentication parameters.
    1. I am using SOA suite 11g and jdev11g
    2. I created a BPEL process and call java wrapper service in that service isent thorugh the post(but here i am trying to it should open al JSP page)
    3. For that JSP page i need to send xml as string and creadentials also as hidden variables.
    4. once i send the request it should open the target system UI page the user will do modifications in target system
    5. The rest of the process is taken care by the target system.
    Please suggest me any other alternatives.
    Note:- here the jsp action is method post . I tried to write a java code to send the request but i am not able to show the response in browser
    Regards,
    Sri.

    Hi vladodias,
    Thanks for the response.
    So i approached the concept calling ADF as a service interface through bpel. from ADF i will call JSP
    But in ADF i am not able to set context. Steps had followed to create Service Interface
    1. created allicaton as a FusionWebApplication(ADF)
    2. created model project and selected adfbusiness components, java
    3. created viewcontroller project and selected ADFFaces,ADFPageFLOW,HTML,JSF,java,xml and jsp servlets
    4. In model i created a applicationmodule and in that i write custommethod validate(String un,String pwd,String input)
    5. in validate method i am calling back bean
    6. In backing bean java class i am trying to access the validate method variables using context but i am not able to set any Faces context.
    Note: here i converted Application module class as a service interface in that i exposed custom Method validate(String un,String pwd,String input)
    Regards,
    Sri.

  • How to use Javascript array in the JSP

    hELLO Friends,
    I am creating an String array using the values
    in the list of a jsp page using Java script..
    How can I use this array in the same jsp
    file for processing...
    any help in this regard would be highly appreciated.
    thanks in Advance...
    ashish

    you cannot pass values from javascript to JSP without having to form-post to another JSP page.

  • Ive just learned that i can use loadjava to load jsp pages into the database.

    Ive just learned that i can use loadjava to load jsp pages into the database. How is that possible. How can someone go to my lets say, index.jsp page and actually see it if its inside the database? What authenticates it? Where would you set the parameters to tell http(apache) to look inside the db for the pages?
    Any ideas?

    Thanks for the reply. If I put the file on the database, does it have to be in a particular location? I've put it on the database server, launched sql*plus (as APPS) and ran the following:
    execute dbms_java.loadjava('-v', 'ZebraGetPrinterFromXML.class');
    PL/SQL procedure successfully completed.Then when I try to run a process that uses this I get this:
    ORA-29540: class ZebraGetPrinterFromXML does not exist

  • Designing the structure of jsp pages using xml

    how can i design the structure of the jsp using xml file?

    The structure of the JSP? I don't know what that means. Perhaps you can explain why you thought using XML for that would be a good idea, that might help us comprehend the question.

  • The jdbcTable.jsp example with Sybase database??

    Hi there,
              Does anyone got the jdbcTable.jsp example working with Sybase
              jConnect?
              Thank you
              

    David,
    Thanks for the suggestion. We'll schedule that on our list of new sample portlets.
    But as a sidenote, the Database access would really be no different from any standard JDBC calls to connect to and query the database.

Maybe you are looking for

  • How can I find out if there are any masters (not referenced) in my library?

    Hi! I've been using Aperture for a while (most masters are on different hard drives, but maybe some are in my library by mistake when I imported them), now want to consolidate all my photo-masters on a separate "photo" hard drive and leave in my Aper

  • Extract function not working with tag attributes

    Hi all, I have an xml document stored in the db as an xmlType. I am trying to use the extract function to retrieve values. The extract will work fine on tags without attributes. Any tags with attributes or tags beyond the tags with attributes will no

  • Custom worklist decorator class not working

    hi , i was trying out the worklist customization as described in http://download.oracle.com/docs/cd/E13154_01/bpm/docs65/workspace_customization/index.html. however it is not working. any ideas as to what might be wrong... my custom mworklist decorat

  • Pass a Collection of multi-column records from JAVA to Plsql

    Hi, I need to pass a Collection of multi-column records(say Employee Id, Employee Name and Employee Address) from a JAVA application to an Oracle package/stored procedure for data processing and updates. I initially thought of using a pl/sql table as

  • Ipod has real bad static

    I have just recently put a couple of new songs on my pod and it just started havin static. I noticed it at first when the backlight was on it wasnt staticy and when it off it had static and now it has static in it all the time on every song and video