Employee example:... resource [employee/servlet/NewEmployee.jsp] not found
Hi,
i installed an erp system 6.0 on windows server 2008. then i installed the netweaver developer studio on my local computer. i tried the example from the book: java-programmierung mit dem sap web application server (dont know the english title)
well, i deployd the example and wanted to see the jsp with the url: http://<servername>:<port>/employee/view
this does not work, i get the following error:
The request cannot be processed.
Details:
com.sap.engine.services.servlets_jsp.server.exceptions.ServletNotFoundException: Requested resource [employee/servlet/NewEmployee.jsp] not found.
Then i tried the url: http://<server>:<port>/employee/NewEmployee.jsp, got following error:
Application error occurred during the request procession.
Details:
com.sap.engine.services.servlets_jsp.server.exceptions.WebIOException:
Error compiling [/NewEmployee.jsp] of alias [employee] of J2EE application [sap.com/EmployeeEar].
so i think theres something wrong with my jsp. but i dont see it.
here is my jsp:
<%@ page language="java" %>
<html>
<body style="font-family:Arial;" bgcolor="D2D8E1">
<%@ page import="javax.naming.*" %>
<%@ page import="javax.ejb.*" %>
<%@ page import="com.sap.demo.*" %>
<%@ page import="java.util.*" %>
<h2>
Register New Employee
</h2>
<form action="NewEmployee.jsp" method="POST" name="NewEmployee">
<table border=0 align=center>
<tr>
<td width="220">First name: <td>
<input type="text" name="firstname" value="" size="20">
<tr>
<td width="220">Last name: <td>
<input type="text" name="lastname" value="" size="20">
<tr>
<td width="220">Department: <td>
<select name="department">
<option value="DEVELOPMENT">Development</option>
<option value="TRAINING">Training</option>
<option value="MANAGEMENT">Management</option>
<option value="ARCHITECTURE">Architecture</option>
</select>
<tr>
<td><td><br><input type="submit" value="Create" name="create">
</table>
<br>
</form>
<%
String lName = request.getParameter("lastname");
String fName = request.getParameter("firstname");
String eDepartment = request.getParameter("department");
if(lName == null || fName == null || lName.length() == 0 || fName.length() == 0)
return;
try{
Context jndiContext = new InitialContext();
Object ref = jndiContext.lookup("java:comp/env/ejb/EmployeeService");
javax.rmi.PortableRemoteObject.narrow(ref, EmployeeServicesHome.class);
EmployeeServicesHome empHome = (EmployeeServicesHome) ref;
EmployeeServices empSession = empHome.create();
long empId = empSession.registerEmployee(fName, lName, eDepartment);
if(empId == 0)
out.println("<H3> Failed! </H3>");
else
out.println("<H3> Success! </H3>");
catch (Exception e) {
out.println("<H3>"e.toString()"</H3>");
e.printStrackTrace(System.out);
return;
%>
</body>
</html>
if you see the reason or if you have andy idea why it doesnt work, please help me
thank you
Is it exactly how you have written ?
out.println("
"e.toString()"
You can read it as:
out.println(""e.toString()"");
I do not think it is correct
replace it either with
out.println(""e.toString()"");
OR
out.println(e.toString());
Similar Messages
-
Hi Guys,
I have just uninstalled and reinstalled SAP Netweaver 7.01 portal. The uninstall was clean and the reinstall also went without any errors.
However, immediately after this, when I open http://<host>:<port> I get the following error:
404 Not Found
The requested resource /main.jsp is not available
Details: File main.jsp not found in application root of alias [/] of J2EE application [sap.com/com.sap.engine.docs.examples].
If, instead, I open portal (http://<host>:<port>/irj), it works fine.
Anybody has any idea why this has happened and how can I resolve this issue?
Thanks,
Shitij
Edited by: Shitij Bagga on May 5, 2010 9:36 AM
Edited by: Shitij Bagga on May 5, 2010 9:37 AMHi Anil,
I don't see how this note is relevant here. It is just the j2ee engine start page which is not opening. If I go straight to the systeminfo page or the portal login page, they are all working.
Any experience on this issue with that note u suggested? Please share.
Thanks,
Shitij -
Import javax.servlet.* package not found
hai i am pradeep i am using java 1.5 and tomcat 5.5 version when i just include import javax.servlet.* in simple hellow word program and compile it shows error
import javax.servlet.* package not found
i set my class path to as
E:\set path="D:\Program Files\Java\jdk1.5.0_04\bin" and compile this it pops a message please help me i am using winxp os
by
pradeep sreedharanyou are not setting the classpath but the path, and they should both be written in capitals, PATH and CLASSPATH.
The classpath contains directories and jar files that contain the classes that need to be "visible" to your applications. The servlet classes are part of the file servlet-api.jar, which you can find in your tomcat directory, more specifically the common/lib sub directory.
I would expect your classpath to look something like this:
.;d:\program files\tomcat\common\lib\servlet-api.jar
You may also want to add the directory in which you are storing your projects, I don't know how you are building your applications.
You seem to be very new to this, so I would suggest you give this a read:
http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html -
Proxy servlet returns "page not found"
I want all request ending with "/PPO" will be proxy to "http://www.yahoo.com".
Explanation:
Our application is deployed on:
C:\bea\user_projects\rci_domain\applications\rdas
"rdas" is an applications context, we access our application using:
http://localhost:7001/rdas/LoginDev.jsp
I want the following request should be proxied to another server.
http://localhost:7001/rdas/PPO (request for "PPO")
Should Proxy to: http://www.yahoo.com
I tried to simulate the same type of scenario. Following is a part from my web.xml file.
<servlet>
<servlet-name>ProxyServlet</servlet-name>
<servlet-class>weblogic.servlet.proxy.HttpProxyServlet
</servlet-class>
<init-param>
<param-name>redirectURL</param-name>
<param-value>http://www.yahoo.com</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>ProxyServlet</servlet-name>
<url-pattern>/PPO</url-pattern>
</servlet-mapping>
Problem:
It is taking me to yahoo.com, but with "Page Not Found" content. I don’t know why it is showing the yahoo.com page with "Page not found". For example you will see the same page what I am seeing using HTTPProxyServlet, if you try the following:
http://www.yahoo.com/rdas/PPO
or
http://www.yahoo.com/blabla
Note: I can not define "context-root" set to "/" parameter in weblogic.xml file, because our application is accessed using "/rdas". All request must have /rdas as well.
I don’t know what I am missing here. Your solution/suggestions are really important. Your earliest reply is really grateful.
Thanks
FarhanAs Peter says, it might be a bug. I did another test. Selected the URL from my IDD, opened the Hyperlink panel, clicked on Create New Hyperlink and this is what I get: http://www.projectorcentral.com/paint_perfect_screen_%24100.htm. So ID is changing "$" to "%24". But, when I click on Go To Destination, still takes me to the website! I'm on a PC with CS6 8.0.1 and using Google Chrome.
Did a second test just for fun: without selecting the URL in the ID, I went to Type/Hyperlinks & Cross-References/Convert URLs to Hyperlinks and ID creates two Hyperlinks: http://www.projectorcentral.com/paint_perfect_screen_ and a separate: 100.htm. So, ID splits the Hyperlink right at "$". So definitely ID doesn't like the "$". -
Classes on which ur servlet depends is not found in classpath
i am trying to deploy a servlet in exploded form in weblogic 7.0.Its is deployed correctly but when i call the servlet from a html file i.e. index.html it throws an error http:<Error> <HTTP> <101250>
stating that the classes on which my servlet class depends is not found in classpath.I have set classpath manually and also created a domain name "ApplicationDomain" and i have put my application "WebApp" in application's directory in the domain
it throw the folowiing error with exceptions
<May 28, 2003 12:09:54 PM IST> <Error> <HTTP> <101250> <[ServletContext(id=1642082,name=WebApp,context-path=)]: Servlet
class myclasses.Gservlet for servlet Gservlet could not be loaded because a class on which it depends was not found in t
he classpath D:\bea\user_projects\Applicationdomain\applications\WebApp;D:\bea\user_projects\Applicationdomain\applicati
ons\WebApp\WEB-INF\classes.
java.lang.NoClassDefFoundError: myclasses/Gservlet (wrong name: Gservlet)>
<May 28, 2003 12:09:54 PM IST> <Error> <HTTP> <101018> <[ServletContext(id=1642082,name=WebApp,context-path=)] Servlet f
ailed with ServletException
javax.servlet.ServletException: [ServletContext(id=1642082,name=WebApp,context-path=)]: Servlet class myclasses.Gservlet
for servlet Gservlet could not be loaded because a class on
Configuration file bc4j.xcfg not found in the classpath.
-
Example 'Customer Care Scenario' deployable archive not found
Hi,
I was trying to set up the example customer care scenario application reffered in the document shown below. https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d00901ec-dccc-2a10-2f85-c0dda4690459
But I coould not find the deployable archives CERAXEDM00_0.sca and CERACSC00_0 anywhere. Could you kindly let me know from where I can download this?
I downloaded the CE 7.1 trial version and was trying to check the features of CE.
Thank you,
Mansoor.Hi Mansoor,
From the link below you can download both documentation, deployables and sources of CSC and xEDM Sample Applications.
/docs/DOC-8033#section38
Best Regards,
Penka -
Hi all,
I have a war file to deploy under Sun ONE 7Update 4, when i deploy it i call a jsp page in it and it is displyed.
When from this page i call a servlet as :
http://localhost/test/servlet/db
I got an error 404 that the resource /test/servlet/db is not found, but in the web.xml the servlet is mapped like :
<servlet>
<servlet-name>db</servlet-name>
<servlet-class>org.test.db</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>db</servlet-name>
<url-pattern>/db</url-pattern>
</servlet-mapping>
Any suggestion ?
Cheers.
StefanoTry http://localhost/test/db
-
Catch included resource or file not found error
Hi,
is there a way to catch the error if an included jsp is not found. (BEA 8.1 SP1)
<Error> <HTTP> <BEA-101214> <Included resource or file "xxx.jsp" not found from
requested resource "yyy.jsp".>
Problem: If a jsp is not found, I want to include a default page.
Regards
Tobias Voigt
has anyone got the solution I am getting the same error.
mine is weblogic 6.1 in clustered env and when I am opening the browser and clicking on the link first time it is showing me no content in the pop up browser and I am getting the same error on the server as you people have got. help will be appreciated a lot as I am facing this in production env -
Hi everybody.
I am using struts1.2.9. Please solve my problem.
AbstractSubmissionAction class
saveErrors(request,errors);
if(errors.isEmpty()){
return mapping.findForward(SUCCESS);
return mapping.findForward("failure");
struts file
<action input="/abstractsubmission.jsp" name="abstractSubmissionForm" path="/abstractsubmission"
scope="request" type="struts.action.AbstractSubmissionAction" validate="true">
<forward name="success" path="/abstactloggedin.jsp"/>
<forward name="failure" path="/abstractsubmission.jsp"/>
</action>
After run, browser shows
HTTP Status 404 -
type Status report
message
description The requested resource () is not available.
server log
File "E:\sandip\programs\IDS_Server\build\web\abstractsubmission.jsp" not found
Message was edited by:
SandipGaikwadAccording to your suggestion, it throws java.lang.IllegalArgumentException: Path abstractsubmission.jsp does not start with a "/" character
struts-config.xml file
<struts-config>
<form-beans>
<form-bean name="abstractLoginForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="username" type="java.lang.String"/>
<form-property name="password" type="java.lang.String"/>
</form-bean>
<form-bean name="abstractUserRegistrationForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="title" type="java.lang.String"/>
<form-property name="firstname" type="java.lang.String"/>
<form-property name="lastname" type="java.lang.String"/>
<form-property name="designation" type="java.lang.String"/>
<form-property name="company" type="java.lang.String"/>
<form-property name="street" type="java.lang.String"/>
<form-property name="area" type="java.lang.String"/>
<form-property name="city" type="java.lang.String"/>
<form-property name="state" type="java.lang.String"/>
<form-property name="country" type="java.lang.String"/>
<form-property name="pin" type="java.lang.Long"/>
<form-property name="countryCode" type="java.lang.Integer"/>
<form-property name="cityCode" type="java.lang.Integer"/>
<form-property name="fax" type="java.lang.Long"/>
<form-property name="email" type="java.lang.String"/>
</form-bean>
<form-bean name="abstractSubmissionForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="title1" type="java.lang.String"/>
<form-property name="firstname1" type="java.lang.String"/>
<form-property name="lastname1" type="java.lang.String"/>
<form-property name="title2" type="java.lang.String"/>
<form-property name="firstname2" type="java.lang.String"/>
<form-property name="lastname2" type="java.lang.String"/>
<form-property name="abstracttitle" type="java.lang.String"/>
<form-property name="theFile" type="org.apache.struts.upload.FormFile"/>
</form-bean>
</form-beans>
<global-exceptions>
</global-exceptions>
<global-forwards>
</global-forwards>
<action-mappings>
<action
input="/abstractlogin.do"
name="abstractLoginForm"
path="/abstractlogin"
scope="session"
type="struts.action.AbstractLoginAction"
validate="true"
>
<forward name="success" path="/abstactloggedin.jsp"/>
<forward name="failure" path="/abstractlogin.jsp"/>
</action>
<action
input="/abstractuserregistration.jsp"
name="abstractUserRegistrationForm"
path="/abstractuserregistration"
scope="session"
type="struts.action.AbstractUserRegistrationAction"
validate="true"
>
<forward name="success" path="/abstractregistrationsuccess.jsp"/>
<forward name="failure" path="/abstractuserregistration.jsp"/>
</action>
<action input="/abstractsubmission.jsp" name="abstractSubmissionForm" path="/abstractsubmission"
scope="request" type="struts.action.AbstractSubmissionAction" validate="true">
<forward name="success" path="/abstactloggedin.jsp"/>
<forward name="failure" path="/abstractsubmission.jsp"/>
</action>
<action forward="/abstactsubmission.jsp" path="/AbstractSubmission"/>
<action
forward="/abstractlogin.jsp"
path="/AbstractLogin"
/>
<action
forward="/abstractuserregistration.jsp"
path="/AbstractUserRegistration"
/>
</action-mappings>
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
<message-resources parameter="com/myapp/struts/ApplicationResource"/>
<!-- ========================= Tiles plugin ===============================-->
<!--
This plugin initialize Tiles definition factory. This later can takes some
parameters explained here after. The plugin first read parameters from
web.xml, thenoverload them with parameters defined here. All parameters
are optional.
The plugin should be declared in each struts-config file.
- definitions-config: (optional)
Specify configuration file names. There can be several comma
separated file names (default: ?? )
- moduleAware: (optional - struts1.1)
Specify if the Tiles definition factory is module aware. If true
(default), there will be one factory for each Struts module.
If false, there will be one common factory for all module. In this
later case, it is still needed to declare one plugin per module.
The factory will be initialized with parameters found in the first
initialized plugin (generally the one associated with the default
module).
true : One factory per module. (default)
false : one single shared factory for all modules
- definitions-parser-validate: (optional)
Specify if xml parser should validate the Tiles configuration file.
true : validate. DTD should be specified in file header (default)
false : no validation
Paths found in Tiles definitions are relative to the main context.
-->
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
<set-property property="moduleAware" value="true" />
</plug-in>
<!-- ========================= Validator plugin ================================= -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>
<!-- ========================= Hibernate plugin ================================= -->
<plug-in className="struts.plugin.HibernatePlugin">
<set-property
property="path"
value="/hibernate.cfg.xml"/>
</plug-in>
</struts-config>
AbstractSubmissionAction
public class AbstractSubmissionAction extends Action {
private ActionMessages errors;
/* forward name="success" path="" */
private final static String SUCCESS = "success";
* This is the action called from the Struts framework.
* @param mapping The ActionMapping used to select this instance.
* @param form The optional ActionForm bean for this request.
* @param request The HTTP Request we are processing.
* @param response The HTTP Response we are processing.
* @throws java.lang.Exception
* @return
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
errors=new ActionMessages();
SessionFactory factory=null;
Session session=null;
String SQL_QUERY;
Query query;
DynaValidatorForm dForm=(DynaValidatorForm)form;
//get file name
FormFile myFile=(FormFile)dForm.get("theFile");
String fileName=myFile.getFileName();
int fileSize=myFile.getFileSize();
byte[] data=myFile.getFileData();
if(myFile.getContentType().equals("application/msword")){
System.out.println("Valid Micrsoft Word file");
try{
factory=(SessionFactory)servlet.getServletContext().getAttribute(HibernatePlugin.KEY_NAME);
session=factory.openSession();
Transaction transaction=session.beginTransaction();
//get the server upload directory real path
String filePath=getServlet().getServletContext().getRealPath("/");
//save file on the server
if(!fileName.equals("")){
System.out.println("Server path:= "+filePath);
//create file
File fileToCreate=new File(filePath,fileName);
//if file does not exist create the file
if(!fileToCreate.exists()){
FileOutputStream fileOutputStream=new FileOutputStream(fileToCreate);
fileOutputStream.write(myFile.getFileData());
fileOutputStream.flush();
fileOutputStream.close();
//get form information
String title1=(String)dForm.get("title1");
String firstname1=(String)dForm.get("firstname1");
String lastname1=(String)dForm.get("lastname1");
String title2=(String)dForm.get("title2");
String firstname2=(String)dForm.get("firstname2");
String lastname2=(String)dForm.get("lastname2");
String abstracttitle=(String)dForm.get("abstracttitle");
//get AbstractUserInfoPojo from request
Cookie[] cookies=request.getCookies();
long id=Long.parseLong(cookies[0].getValue());
AbstractUserInfoPojo abstractUserInfoPojo=(AbstractUserInfoPojo)session.get(AbstractUserInfoPojo.class,id);
AbstractDetailsPojo abstractDetailsPojo=new AbstractDetailsPojo();
abstractDetailsPojo.setId(id);
abstractDetailsPojo.setTitle1(title1);
abstractDetailsPojo.setFirstname1(firstname1);
abstractDetailsPojo.setLastname1(lastname1);
abstractDetailsPojo.setTitle2(title2);
abstractDetailsPojo.setFirstname2(firstname2);
abstractDetailsPojo.setLastname2(lastname2);
abstractDetailsPojo.setAbstracttitle(abstracttitle);
abstractDetailsPojo.setAbstractfilename(fileName);
abstractDetailsPojo.setAbstractUserInfoPojo(abstractUserInfoPojo);
abstractUserInfoPojo.setAbstractDetailsPojo(abstractDetailsPojo);
//save information
session.save(abstractDetailsPojo);
session.update(abstractUserInfoPojo);
//commit the changes
transaction.commit();
//pass abstractUserInfoPojo to request
request.setAttribute("abstractUserInfo",abstractUserInfoPojo);
}else{
System.out.println("File already exists");
}catch(IOException ioe){
System.out.println("==========IOException :-=============");
ioe.printStackTrace();
System.out.println("================================================");
}catch(SQLGrammarException sge){
System.out.println("==========SQL Grammer Exception :-=============");
System.out.println("1> SQL Query= "+sge.getSQL());
System.out.println("2> Error Code= "+sge.getErrorCode());
System.out.println("3> SQL State= "+sge.getSQLState());
SQLException sqe=sge.getSQLException();
System.out.println("4> Message= "+sqe.getMessage());
sge.printStackTrace();
System.out.println("================================================");
catch (HibernateException e) {
System.out.print("Hibernate Error");
e.printStackTrace();
} finally {
session.close();
}else{
System.out.println("Not a Valid Micrsoft Word file");
errors.add("Not a Word File",new ActionMessage("errors.abstractfilename"));
saveErrors(request,errors);
if(errors.isEmpty()){
return mapping.findForward(SUCCESS);
return mapping.findForward("failure");
} -
404 Not Found : Servlet not found on this server
I have been trying to run a simple servlet from a JSP page. For some reason I keep getting an error informing me that the servlet in question cannot be found on the server. I have incuded some code from my project in the hope that it may provide a clue to the problem. I would appreciate any help.
from the web.xml file
<servlet>
<servlet-name>MapTestServlet</servlet-name>
<servlet-class>Common.MapTestServlet</servlet-class>
</servlet>
from the JSP page
<FORM ACTION="\PATSCoreROC\classes\Common.MapTestServlet" METHOD="post">
<INPUT TYPE="SUBMIT" NAME="Test" VALUE="Test Servlet">
</FORM>
Clicking the Test Servlet button produces the following 404 error in the browser
404 Not Found
Resource /PATSCoreROC/classes/Common.MapTestServlet not found on this serverAfter a little work and some coffee I tried the following and it resolved my problem.
<FORM ACTION="servlet\Common.MapTestServlet" METHOD="post">
<INPUT TYPE="SUBMIT" NAME="Test" VALUE="Test Servlet">
</FORM>
I should have included 'servlet\' in the ACTION property. -
Column Not found error while trying to access databse through JSP+Java Bean
I am trying to acees MS Access 2003 db through JSP using Tomcat 5.0.28.The code for accessing the databse is incorporated in the bean.The jsp only calls the particular method of the bean .
Code for Java Bean:
package ActiveViewer;
import java.sql.*;
import java.util.*;
public class CompanyBean
Connection con;
ResultSet rs=null;
Statement st;
public CompanyBean(){}
public void connect()
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Here4");
con=DriverManager.getConnection("jdbc:odbc:activeviewer","","");
System.out.println("Here1");
catch (ClassNotFoundException e)
System.out.println("Could not locate driver.");
catch (SQLException e)
System.out.println("An SQL Exception has occured :: "+e);
e.printStackTrace();
catch (Exception e)
System.out.println("An unknown Exception has occured :: "+e);
e.printStackTrace();
public void disconnect()
try
if (con!=null)
con.close();
catch (SQLException e)
System.out.println("An SQL Exception has occured :: "+e);
e.printStackTrace();
public ResultSet select(String username)
if(con!=null)
try
st=con.createStatement();
rs=st.executeQuery("select * from company where username='" + username + "'");
catch (SQLException e)
System.out.println("An SQL Exception has occured :: "+e);
e.printStackTrace();
catch (Exception e)
System.out.println("An Exception has occured while retrieving :: "+e);
e.printStackTrace();
else
System.out.println("Connection to database was lost.");
return rs;
The code for JSP that uses the above bean is:
<%@ page language="java" import="java.sql.*,ActiveViewer.* " contentType="text/html"%>
<jsp:useBean id="conn" scope="session" class="ActiveViewer.CompanyBean" />
<html>
<body>
<% String username=request.getParameter("username");
String password=request.getParameter("password");
System.out.println("username:"+username);
System.out.println("password:"+password);
conn.connect();
ResultSet rs=conn.select(username);
System.out.println("Below select ");
while (rs.next())
String dbusername=rs.getString("username");
String dbpassword=rs.getString("password");
if(dbusername.equals(username) && dbpassword.equals (password))
{ %> out.println("OK");
<% }
else { %>Invalid Username and / or Password.
<br>Clickhere to go back to Login Page.
<% }
} %>
</body>
</html>
I get the following error:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Column not found
though the database is not int he same folder as the jsp, the DSN is set correctly to pint to the db location.The jsp does print in stdout file:
Here4 (from connect method above)
Here 1 (from connect method above)
Below Select (from jsp)
This means that the jsp does connect to db but it gives the above error.Also the field name also matches that in the database and data is present in the db too.
All other things like creating package for bean,incorporating the packakage are done.
Can someone please help me with their precious advice?U're getting this error because there is no field called 'password' in ur database, the field in ur database is named 'cpassword' and not 'password'. So change the statement rs.getString("password"); to rs.getString("cpassword");
-
Column Not found error while trying to access database through JSP+Java Bea
I am trying to access MS Access 2003 db through JSP using Tomcat 5.0.28.The code for accessing the database is incorporated in the bean.The JSP only calls the particular method of the bean .
Code for Java Bean:
package ActiveViewer;
import java.sql.*;
import java.util.*;
public class CompanyBean
Connection con;
ResultSet rs=null;
Statement st;
public CompanyBean(){}
public void connect()
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Here4");
con=DriverManager.getConnection("jdbc:odbc:activeviewer","","");
System.out.println("Here1");
catch (ClassNotFoundException e)
System.out.println("Could not locate driver.");
catch (SQLException e)
System.out.println("An SQL Exception has occured :: "+e);
e.printStackTrace();
catch (Exception e)
System.out.println("An unknown Exception has occured :: "+e);
e.printStackTrace();
public void disconnect()
try
if (con!=null)
con.close();
catch (SQLException e)
System.out.println("An SQL Exception has occured :: "+e);
e.printStackTrace();
public ResultSet select(String username)
if(con!=null)
try
st=con.createStatement();
rs=st.executeQuery("select * from company where username='" + username + "'");
catch (SQLException e)
System.out.println("An SQL Exception has occured :: "+e);
e.printStackTrace();
catch (Exception e)
System.out.println("An Exception has occured while retrieving :: "+e);
e.printStackTrace();
else
System.out.println("Connection to database was lost.");
return rs;
The code for JSP that uses the above bean is:
<%@ page language="java" import="java.sql.*,ActiveViewer.* " contentType="text/html"%>
<jsp:useBean id="conn" scope="session" class="ActiveViewer.CompanyBean" />
<html>
<body>
<% String username=request.getParameter("username");
String password=request.getParameter("password");
System.out.println("username:"+username);
System.out.println("password:"+password);
conn.connect();
ResultSet rs=conn.select(username);
System.out.println("Below select ");
while (rs.next())
String dbusername=rs.getString("username");
String dbpassword=rs.getString("password");
if(dbusername.equals(username) && dbpassword.equals (password))
{ %> out.println("OK");
<% }
else { %>Invalid Username and / or Password.
<br>Clickhere to go back to Login Page.
<% }
} %>
</body>
</html>
I get the following error:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Column not found
though the database is not int he same folder as the jsp, the DSN is set correctly to pint to the db location.The jsp does print in stdout file:
Here4 (from connect method above)
Here 1 (from connect method above)
Below Select (from jsp)
This means that the jsp does connect to db but it gives the above error.Also the field name also matches that in the database and data is present in the db too.
All other things like creating package for bean in WEB-INF/classes,incorporating the packakage are done.
Can someone please help me with their precious advice?Hi, I too have a problem with an SQL exception, the message is Column not found.
I'm using the sun jdbc odbc driver with access.
the first few lines of the stack trace are
sun.jdbc.odbc.JdbcOdbcResultSet.findColumn(JdbcOdbcResultSet.java:1852)
sun.jdbc.odbc.JdbcOdbcResultSet.getInt(JdbcOdbcResultSet.java:603)
net.homeip.sdaniels.MemberBean.ejbFindByUnamePwd(MemberBean.java:127)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
I am of course sure that the column does infact exist. I can insert into the column no problems. the sql looks like this:
SELECT * FROM Members WHERE uName ='Stewart' AND encPwd='�F2C�3����h�1Y�'
Can any one tell me if there is a common cause to this problem?
Thanks -
Portlets Issues:- Included resource or file not found
I am facing some problems in the loading of portlets with Weblogic 9.2.When I access the portal url all the portlets are displayed blank by giving the following error message on the server :
<Error> <HTTP> <BEA-101214> <Included resource or file "/mysamples/exampleView.jsp" not found from requested resource "/portal/ep/home.do".>
My application is using pluto portlet container,
When I change the jsp file and reload portlet displays but after restarting the server it is again gone ,
Can someone please provide some pointers on this , I will really appreciate the help .
Thanks a lot
-- Vandanahas anyone got the solution I am getting the same error.
mine is weblogic 6.1 in clustered env and when I am opening the browser and clicking on the link first time it is showing me no content in the pop up browser and I am getting the same error on the server as you people have got. help will be appreciated a lot as I am facing this in production env -
Hi,
I am trying to access my website (java server pages) with
jrun and it shows the following on the browser:
Oops! We couldn't find your document.
The file that you requested could not be found on this
server.
On the console, it says "error Requested resource login.jsp
not found." Can anyone please let me know what I'm missing?
Thanks,
Tina1. Try registering it to see if it might have some warranty left.
2. Complain to the seller.
3. Complain to Ebay.
4. Try the 5Rs on Ipod support http://www.apple.com/support/ipod/five_rs/
5. I hat to say this but a short sharp tap of the side of the ipod on a hard surface completely restored my un-restoreable 20Gig ipod!!
Cheers,
John -
Please help..servlet calling JSP
I have a servlet that for the time being (cut out all validation code...everything) is just trying to call a JSP. I keep getting The requested URL /servlet/hellos was not found on this server.---I'm running this at my local host, so it is not a path problem. the code is below.--
Note..when I use getServletContext().getRequestDispatcher("/servlet/log"); this works (calling another servlet) but when the below is executed I get the error.
package hellos;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class hellos extends HttpServlet {
public void doGet (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher("/ITS/itsLoginhtml.jsp");
dispatcher.forward(req, res);Ok here is what is going on. I don't want to use redirect I want to use the dispatcher. The code is below and it works with redirect, but not dispatcher???? It says the URL cannot be found on server?????Can anyone help me get the dispatcher to work??
package hellos;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class hellos extends HttpServlet {
public void doGet (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
res.sendRedirect("/ITS/itsLoginhtml.jsp");
//RequestDispatcher dispatcher =
//getServletConfig().getServletContext().getRequestDispatcher("/ITS/itsLoginhtml.jsp");
//dispatcher.forward(req, res);
Maybe you are looking for
-
My daughters ipod touch has been disabled because of a wrong passcode. After 2 days of trying to get into Itunes, it will not help without a passcode and is not recognizing it as a device even though the computer is recognizing the USB. I know I ha
-
Does the CP-7937G conference room phone support TLS using MICs?
I have TLS w/ MICs working for the 7961s, but not the 7937Gs. When I do a debug radius authentication on the switch, I don't see attempts from the 7937G. If anyone has experience with this or can provide some assistance, that would greatly be appre
-
Query Prompt Selector ... few problems in it
Hello Folks ! I am using Query Prompt Selector and I see the component has few limitations / bugs. Can you point out if any solution pleaseeee ! 1. The list of value drop down is too wide, any idea how to short the width ? (Changing width of componen
-
Hello all, I've got an update record form on one of my pages (it is a php / MySQL site). I followed the tutorial in dreamweaver 8, it works, but it does not work like I want it to work. I am hoping that when a user logs into the site, and they want t
-
Where is the chain and the white box
i am using cs5 and i am still learning as u will see when i add a new layer i dont get the little chain and the white box which prevents me from using the for example the fill in the edit menu what can i do i follow some tutorials and they have the l