tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keith Ng" <woonb...@yahoo.com>
Subject RE: WAR file created in Tomcat cant run in J2EE RI
Date Mon, 18 Feb 2002 17:16:21 GMT
BTW, it works in TOMCAT as of 3.2.3 ....

-----Original Message-----
From: Keith Ng [mailto:woonbock@yahoo.com]
Sent: Tuesday, February 19, 2002 1:13 AM
To: Tomcat Users List
Subject: WAR file created in Tomcat cant run in J2EE RI


Hi guys

I have finally succeeded in making my WAR file and transferring over to J2EE
RI(by depolying) to run. However. i still get a minor glitch while trying to
run in J2EE's Server


ERROR
============================================================================
================================================

org.apache.jasper.JasperException: Unable to compile class for
JSPnullC:\j2sdkee1.3\repository\kangkong1\web\TESTEST\jsp\_0002fjsp_0002fxyz
LoginForm_jsp.java:4: Class or interface declaration expected.
import javax.servlet.*;
^
nullC:\j2sdkee1.3\repository\kangkong1\web\TESTEST\jsp\_0002fjsp_0002fxyzLog
inForm_jsp.java:10: Superclass org.apache.jsp.HttpJspBase of class
org.apache.jsp._0002fjsp_0002fxyzLoginForm_jsp not found.
public class _0002fjsp_0002fxyzLoginForm_jsp extends HttpJspBase {
                                                     ^
2 errors

	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:284)
	at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:528)
	at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java:176)
	at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:188)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:458)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterCh
ain.java:197)
	at
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain
.java:176)
	at java.security.AccessController.doPrivileged(Native Method)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:172)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	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.ja
va:215)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
	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:2314)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:368)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
	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
:163)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	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:
995)
	at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1088
)
	at java.lang.Thread.run(Thread.java:484)


============================================================================
===============================================







JSP file
============================================================================
==============================================

<%@ page import = "java.util.Calendar;" %>

<!-- LOGIN FORM(absolute positioning) -->

<jsp:useBean id="memberBean" class="user.UserBean" scope="session"/>

<!--To set the id to retrieve from the database,use setProperty in
InqBean-->

<P style="LEFT: 14px; POSITION: absolute; TOP: 200px">
 <% if (!memberBean.isUserValid()){ %>
<FORM name = loginForm method = "post" onSubmit = "return checkText2()"
action="../jsp/login.jsp">

<TABLE style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid;
BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid">


  <TR><TD><span style = "font-family:Arial;font-size:8pt">Login : &nbsp;
  <INPUT name=memberId size=8 maxlength = "12" style="BORDER-BOTTOM: 1px
solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px
solid">
  </span></TD></TR>

  <TR><TD><span style = "font-family:Arial;font-size:8pt">Password :
   <INPUT type="password" name=password size=5 maxlength = "10"
style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px
solid; BORDER-TOP: 1px solid">
   </span></TD></TR>



  <TR>
  <TD align="left" ><INPUT style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px
solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; FONT-SIZE: 9pt"
type=submit value=Login>
  </TD>
  </TR>

 </TABLE>
</FORM>
<%
}
else{
	Calendar cal = Calendar.getInstance();
%>

<TABLE style="BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid;
BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid" width = "120">


  <TR><TD><span style = "font-family:Arial;font-size:8pt">Login as :<br>
  <b><jsp:getProperty name="memberBean" property="memberId" /></b><br>
   Login time : <br><b>
   <%=cal.getTime()%></b>
  </span></TD></TR>

</TABLE>
<%
}
%>

</P>


============================================================================
==============================================









JAVABEAN file
============================================================================
=============================================
package user;

import java.sql.*;
//import javax.servlet.*;
import javax.servlet.http.*;
import database.ConnectionBean;

public class UserBean implements HttpSessionBindingListener{


	  private String memberId = "";
	  private String memberPwd = "";
	  private String name = "";
	  private String card_no = "";

		private String logoff="";
		private boolean userValid = false;
		private ResultSet userRs;

		private boolean admin=false;

  	public UserBean(){}

   public boolean isAdmin(){
   	return admin;
   }
   public void setMemberId(String mid){
    memberId = mid.trim();
   }
   public String getMemberId(){
   	return memberId;
   }

   public void setPassword(String pwd){
 	  memberPwd = pwd;
   }
   public String getPassword(){
 	  return memberPwd;
   }

   public boolean isUserValid(){
   	return userValid;
   }

   public String generateSQL(){

 	  String sql = "SELECT * FROM s99661456_Members where member_id
='"+memberId+"'" +
 	             " and password = '" +memberPwd+ "'";

 	 return sql;
  }

   public float getBalance(ConnectionBean c)
   	{

    float balance = 0;
   	ConnectionBean con = new ConnectionBean();

   	try{

  	 userRs = con.executeQuery(generateSQL());
  	 if (userRs.next()){
  	 	balance = userRs.getFloat("balance");
  	 }
  	 else{
  	 	balance = 0;//occurs when user does not exist!;
  	 }
   	}
   	catch(Exception e){
   		System.out.println("Error in conenction in balance"+e.getMessage());
   	  balance = 0;
   	}
   	con.close();
  	return balance;
   }





  //public String getLoginStatus(HttpServletRequest req){
   public String getLoginStatus(ConnectionBean c){

  	ConnectionBean con = new ConnectionBean();
  	String htmlStatus = "";
  	//ConnectionBean con = (ConnectionBean) req.getAttribute("connBean");
  	try{
  	 userRs = con.executeQuery(generateSQL());
  	 if (userRs.next()){
  	 	userValid = true;
  	 	memberId = userRs.getString("member_id").trim();
  	 	name = userRs.getString("name").trim();

  	 	if (memberId.equals("admin")){admin=true;}

  	 	if (name==null){
  	 		name = memberId;
  	 	}
  	  htmlStatus += "You have been successfully logined into <b>XYZ</b>
Online!<br>";
  	  htmlStatus += "Welcome back, <b>"+name+"</b> ! Do check out our latest
catalog.";
  	 }
  	 else{
  	 	userValid = false;
  	 	htmlStatus += "Invalid user ID or password. Please try again";
  	 }


  	}
  	catch(Exception e){
  	 System.out.println("Exception in User Session RS,caught anyway!");
  	 userValid = false;
  	 htmlStatus += "Error : " + e.getMessage() +"<br>";
  	 htmlStatus += "Member cannot login! Possibly database error.Try again!";
  	}
    con.close();
  	return htmlStatus;
  }

  public void valueBound(HttpSessionBindingEvent event){
   System.out.println("Session UserBean :In value bound method");
  }


  public void valueUnbound(HttpSessionBindingEvent event){
   System.out.println("Session UserBean :value Unbound method");
  }

  protected void finalize(){}

}


============================================================================
==============================================



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message