Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
EJB Tutorial - Alice's world
Options
-
31-08-2008 8:42pmIm trying to deploy the alice's world application from the ejb tutorial.
The tutorial is from the site
http://www.conceptgo.com/gsejb/C01.html
I've tried using netbeans but it has been really really slow and am finding it very frustrating and useless.
I think my web.xml is wrong anyway.
There is a class called createRSTables.java in the alice world project which has a public static void main method in it so it can't be a servlet and don't know how you're supposed to include that.
I don't have prior experience with deploying ejb's so need some help.
Anyway my web.xml is<?xml version="1.0" encoding="UTF-8"?> <web-app> <display-name> Alice </display-name> <display-description> home page for EJB Tutorial </display-description> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>
The error I get when I try to access the Alice project on the server is.HTTP Status 500 - type Exception report message descriptionThe server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP PWC6199: Generated servlet error: string:///index_jsp.java:6: '.' expected PWC6199: Generated servlet error: string:///index_jsp.java:6: ';' expected
Please help cheers.0
Comments
-
This is probably a stupid question but are there errors in the file "index_jsp.java"?0
-
Looks like its not compiling the jsp correctly. No syntax errors? Can you post the index.jsp up?0
-
Yep I'm getting this now on the localhost/Alice page.
org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP
PWC6199: Generated servlet error:
string:///index_jsp.java:6: '.' expected
PWC6199: Generated servlet error:
string:///index_jsp.java:6: ';' expected
This is the full stack trace from the server logs.
PWC1406: Servlet.service() for servlet jsp threw exception org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP PWC6199: Generated servlet error: string:///index_jsp.java:6: '.' expected PWC6199: Generated servlet error: string:///index_jsp.java:6: ';' expected at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:107) at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:280) at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:350) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:411) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:344) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364) at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265) at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:10 -
ok here it goes
index.jsp<%-- Alice's World Home Page --%> <%@ page import="CreateRSTables" %> <%! public void jspInit() { } // end jspInit public void jspDestroy() { } // end jspDestroy %> <% String sButton = request.getParameter( "sb" ); if( null == sButton ) { sButton = ""; } else { sButton = sButton.trim(); } if( sButton.equals( "Go" ) ) { // create/reset RS database tables CreateRSTables.main( null ); } %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Welcome to Alice's World!</title> </head> <body bgcolor="white" text="blue"> <center><h2><font color="red">Welcome to Alice's World!</font></h2></center> <table border="0" cellpadding="0" cellspacing="0" width="100%" > <tr> <!-- Left Columns --> <td valign="top"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img src="images/Alice.jpg" width="120" height="253" alt="Alice"> </td> </tr> </table> </td> <!-- End Left Columns --> <!-- Center Columns --> <td align="left" valign="top"> <table border="0" cellpadding="0" cellspacing="0" > <tr> <td> <br><br> <h4><b><a href="/MetricCvtApp/">Alice's Metric Converter</a></b></h4> </td> </tr> <tr> <td> <h4><b><a href="/Survey1App/">Alice's Surveys - Take 1</a></b></h4> </td> </tr> <tr> <td> <h4><b><a href="/Survey2App/">Alice's Surveys - Take 2</a></b></h4> </td> </tr> <tr> <td> <h4><b><a href="/Survey3App/">Alice's Surveys - Take 3</a></b></h4> </td> </tr> <tr> <td> <h4><b><a href="/SurveyResultsApp/">Alice's Survey Results</a></b></h4> </td> </tr> <tr> <td> <br> </td> </tr> <tr> <td> <br> </td> </tr> <tr> <td> <form method="post" > <b>Reset the Database</b> <input name="sb" type="submit" value=" Go "> </form> </td> </tr> </table> </td> <!-- End Center Columns --> <!-- end 100% Table --> </tr> </table> </body> </html>
and here's createRSTables.java// class to create/reset the Rock Survey tables import java.sql.*; import javax.sql.*; import javax.naming.*; public class CreateRSTables { static String SurveyData = "( 12, 9, 23, 14, 23, " + " 17, 10, 27, 45, 29, " + " 11, 4221, 37, 52, 14, " + " 2758, 'ROCK', 15, 40 )"; static String[] SurveyNamesData = { "('ROCK', 'Allman', 22 )", "('ROCK', 'Cooper', 5 )", "('ROCK', 'Garcia', 13 )", "('ROCK', 'Guthrie', 10 )", "('ROCK', 'Hendrix', 42 )", "('ROCK', 'Hynde', 37 )" }; public static void main(String[] args) { Connection con = null; DataSource ds = null; InitialContext ic = null; int iRowCount = 0; Statement stmt = null; String sJNDIdbName = "java:comp/env/jdbc/gsejbDB"; try { ic = new InitialContext(); ds = (DataSource)ic.lookup( sJNDIdbName ); con = ds.getConnection(); stmt = con.createStatement(); } catch( NamingException ne ) { System.out.println( "Unable to lookup DataSource: " + sJNDIdbName + ". " + ne.getMessage() ); return; } catch ( Exception e ) { System.err.println( "problems connecting to " + sJNDIdbName + ":" ); System.err.println( e.getMessage() ); if( null != con ) { try { con.close(); } catch( Exception e2 ) {} } return; } // end catch // to allow the program to be run more than once, // attempt to remove the tables from the database try { stmt.executeUpdate( "DROP TABLE \"SurveyBeanTable\"" ); System.out.println( "Table \"SurveyBeanTable\" was removed."); } catch ( Exception e ) { /* don't care */ } try { stmt.executeUpdate( "DROP TABLE SurveyNames" ); System.out.println( "Table SurveyNames was removed."); } catch ( Exception e ) { /* don't care */ } // execute SQL commands // to create table and insert data try { stmt.executeUpdate( "CREATE TABLE " + "\"SurveyBeanTable\" (" + "\"exCountry\" INTEGER NOT NULL, " + "\"igneous\" INTEGER NOT NULL, " + "\"inCountry\" INTEGER NOT NULL, " + "\"island\" INTEGER NOT NULL, " + "\"mF\" INTEGER NOT NULL, " + "\"mM\" INTEGER NOT NULL, " + "\"metamorphic\" INTEGER NOT NULL, " + "\"meteorite\" INTEGER NOT NULL, " + "\"nUSF\" INTEGER NOT NULL, " + "\"nUSM\" INTEGER NOT NULL, " + "\"oS\" INTEGER NOT NULL, " + "\"pounds\" DOUBLE PRECISION NOT NULL, " + "\"sF\" INTEGER NOT NULL, " + "\"sM\" INTEGER NOT NULL, " + "\"sedimentary\" INTEGER NOT NULL, " + "\"total\" INTEGER NOT NULL, " + "\"type\" VARCHAR(255), " + "\"uSF\" INTEGER NOT NULL, " + "\"uSM\" INTEGER NOT NULL, " + "CONSTRAINT \"pk_SurveyBeanTabl\" " + "PRIMARY KEY (\"type\") )" ); System.out.println( "Table \"SurveyBeanTable\" was created."); iRowCount = stmt.executeUpdate( "INSERT INTO \"SurveyBeanTable\" VALUES " + SurveyData ); System.out.println( iRowCount + " Row inserted into \"SurveyBeanTable\"."); stmt.executeUpdate( "CREATE TABLE SurveyNames (" + "Type VARCHAR (4) NOT NULL, " + "LastName VARCHAR (20) NOT NULL, " + "Total INTEGER NOT NULL, " + "PRIMARY KEY( Type, LastName )" + ")" ); System.out.println( "Table SurveyNames was created."); iRowCount = 0; for (int i = 0; i < SurveyNamesData.length; i++) { iRowCount += stmt.executeUpdate( "INSERT INTO SurveyNames VALUES " + SurveyNamesData[i] ); } System.out.println( iRowCount + " Rows inserted into SurveyNames."); } catch ( Exception e ) { System.err.println( "problem with SQL sent to " + sJNDIdbName + ":" ); System.err.println( e.getMessage() ); } finally { try { stmt.close(); } catch( Exception e ) {} try { con.close(); } catch( Exception e ) {} } // end finally clause } // end main } // end class CreateRSTables
0
Advertisement