473,796 Members | 2,585 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JSP and EJB exception

26 New Member
helo all

i am working with JSP and EJBs. i have written a simple code for verifying username and password of user by using session beans. my problem is that i am getting the following exception:

[EXCEPTION]

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.S ervletException : VerifyUser not bound
org.apache.jasp er.runtime.Page ContextImpl.doH andle PageException(P ageContextImpl. java:848)
org.apache.jasp er.runtime.Page ContextImpl.han dlePa geException(Pag eContextImpl.ja va:781)
org.apache.jsp. Verify_jsp._jsp Service(org.apa che.j sp.Verify_jsp:9 8)
org.apache.jasp er.runtime.Http JspBase.service (Http JspBase.java:97 )
javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet .java:810)
org.apache.jasp er.servlet.JspS ervletWrapper.s ervic e(JspServletWra pper.java:322)
org.apache.jasp er.servlet.JspS ervlet.serviceJ spFil e(JspServlet.ja va:314)
org.apache.jasp er.servlet.JspS ervlet.service( JspSe rvlet.java:264)
javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet .java:810)
org.jboss.web.t omcat.filters.R eplyHeaderFilte r.doF ilter(ReplyHead erFilter.java:8 1)

root cause

javax.naming.Na meNotFoundExcep tion: VerifyUser not bound
org.jnp.server. NamingServer.ge tBinding(Naming Serve r.java:491)
org.jnp.server. NamingServer.ge tBinding(Naming Serve r.java:499)
org.jnp.server. NamingServer.ge tObject(NamingS erver .java:505)
org.jnp.server. NamingServer.lo okup(NamingServ er.ja va:278)
org.jnp.interfa ces.NamingConte xt.lookup(Namin gCont ext.java:610)
org.jnp.interfa ces.NamingConte xt.lookup(Namin gCont ext.java:572)
javax.naming.In itialContext.lo okup(InitialCon text. java:347)
org.apache.jsp. Verify_jsp._jsp Service(org.apa che.j sp.Verify_jsp:6 7)
org.apache.jasp er.runtime.Http JspBase.service (Http JspBase.java:97 )
javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet .java:810)
org.apache.jasp er.servlet.JspS ervletWrapper.s ervic e(JspServletWra pper.java:322)
org.apache.jasp er.servlet.JspS ervlet.serviceJ spFil e(JspServlet.ja va:314)
org.apache.jasp er.servlet.JspS ervlet.service( JspSe rvlet.java:264)
javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet .java:810)
org.jboss.web.t omcat.filters.R eplyHeaderFilte r.doF ilter(ReplyHead erFilter.java:8 1)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
--------------------------------------------------------------------------------
Apache Tomcat/5.5.9

[/EXCEPTION]


im also presenting code for ur consideration

Expand|Select|Wrap|Line Numbers
  1.  
  2. VerifyUser.java
  3. ------------------------
  4.  
  5. package hina.mahmood;
  6. import javax.ejb.*;
  7. import java.rmi.*;
  8.  
  9. public interface VerifyUser extends javax.ejb.EJBObject
  10. {
  11. public Boolean Verify(String user, String pswd) throws RemoteException;
  12. }// end interface
  13. ---------------------------------------------------------------------------
  14.  
  15.  
  16. VerifyUserHome.java
  17. -------------------------------
  18.  
  19. package hina.mahmood;
  20. import javax.ejb.*;
  21. import java.rmi.*;
  22. import javax.ejb.EJBHome;
  23.  
  24. public interface VerifyUserHome extends javax.ejb.EJBHome
  25. {
  26. public VerifyUser create() throws RemoteException,CreateException;
  27. }// end interface
  28. --------------------------------------------------------------------------------
  29.  
  30.  
  31. VerifyUserBean.java
  32. -------------------------------
  33. package hina.mahmood;
  34. import javax.ejb.*;
  35. import java.rmi.*;
  36. import java.sql.*;
  37.  
  38. public class VerifyUserBean implements SessionBean
  39. {
  40. private SessionContext ctx;
  41. public Boolean Verify(String user,String pswd) throws RemoteException
  42. {
  43. int flag=0;
  44. Boolean bool=new Boolean("false");
  45. try{
  46. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  47. Connection con=DriverManager.getConnection("jdbc:odbc:honie");
  48. Statement stmt=con.createStatement();
  49. String query="Select username,password from hina";
  50. ResultSet rs=stmt.executeQuery(query);
  51.  
  52. while(rs.next())
  53. {
  54. if((rs.getString("username").equals(user))&&(rs.getString("password").equals(pswd)))
  55. {
  56. flag=1;
  57. break;
  58. }
  59. }// end while
  60. }// end try
  61.  
  62. catch(Exception e)
  63. {System.out.println(e);}
  64.  
  65. if(flag==0)
  66. {
  67. bool=new Boolean("false");
  68. return bool;
  69. }
  70.  
  71. else
  72. if(flag==1)
  73. {
  74. bool=new Boolean("true");
  75. return bool;
  76. }
  77.  
  78. return bool;
  79. }// end method
  80.  
  81. public void ejbcreate() throws RemoteException,CreateException
  82. {}// end method
  83.  
  84. public void setSessionContext(SessionContext ctx)
  85. {
  86. this.ctx=ctx;
  87. }
  88.  
  89. public void ejbPassivate()
  90. {}
  91.  
  92. public void ejbActivate()
  93. {}
  94.  
  95. public void ejbRemove()
  96. {}
  97. }// end class
  98. ----------------------------------------------------------------------------
  99.  
  100. [note]
  101. Verify.jsp is the page that uses the session bean
  102. [/note]
  103. -------------------------------------
  104.  
  105. <%@ page import="java.rmi.*,javax.naming.Context,javax.naming.Initi alContext,hina.mahmood.*"%>
  106. <%
  107.  
  108. String username=request.getParameter("user");
  109. String password=request.getParameter("pswd");
  110. InitialContext cxt=new InitialContext();
  111. Object obj=cxt.lookup("VerifyUser");
  112. VerifyUserHome userHome=(VerifyUserHome)javax.rmi.PortableRemoteO bject.narrow(obj,VerifyUserHome.class);
  113. VerifyUser vs=userHome.create();
  114. Boolean b=vs.Verify(username,password);
  115. boolean bool=b.booleanValue();
  116.  
  117. if(bool)
  118. response.sendRedirect("main.jsp");
  119.  
  120. else
  121. response.sendRedirect("error.jsp");
  122. %>
  123. -------------------------------------------
  124.  

can anyone plz tel me that what this exception is and how can i get rid of it???

thanks
Dec 29 '07 #1
0 1389

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2766
by: Nicolas Fleury | last post by:
Hi, I've made a small utility to re-raise an exception with the same stack as before with additional information in it. Since I want to keep the same exception type and that some types have very specific constructors (which take, for example, more than one parameter), the only safe way I have found to made it is by hacking the str representation: import sys
1
4231
by: Old Wolf | last post by:
1. What is the difference between #include <stdexcept> and #include <exception> ? 2. Is there a list somewhere of what each standard exception is used for? either to throw them, or throw user-defined exceptions derived from them? (for example I have been deriving mine from std::bad_alloc if there was a memory problem, or std::bad_exception if there was some other problem) 3. Is it a good idea to make all user-defined exceptions derive...
11
3278
by: Master of C++ | last post by:
Hi, I am writing a simulation package in C++, and so far I've written about 8000 lines of code and have about 30 classes. I haven't used C++ exceptions so far (for various reasons). The only two "resources" I use are memory and file I/O and whenever there is a memory allocation failure or file I/O failure I just simply call a custom assert-type function to check, print a error message and abort. This seems to be OK for now (for the...
4
15839
by: maricel | last post by:
I have the following base table structure - DDL: CREATE TABLE "ADMINISTRATOR"."T1" ( "C1" INTEGER NOT NULL ) IN "TEST_TS" ; ALTER TABLE "ADMINISTRATOR"."T1" ADD PRIMARY KEY
44
4231
by: craig | last post by:
I am wondering if there are some best practices for determining a strategy for using try/catch blocks within an application. My current thoughts are: 1. The code the initiates any high-level user tasks should always be included in a try/catch block that actually handles any exceptions that occur (log the exception, display a message box, etc.). 2. Low-level operations that are used to carry out the high level tasks
40
13536
by: Kevin Yu | last post by:
is it a bad programming design to throw exception in the try block then catch it??
6
1765
by: Vadivel Kumar | last post by:
I've a problem in handling a custom exception The following is my custom exception class: public class AppException : public Exception { public AppException (string message, Exception innerException) { } public override string Message
3
2511
by: JohnDeHope3 | last post by:
First let me say that I understand that Asp.Net wraps my exception in an HttpUnhandledException. I have found a lot of discussion about that on the web, which was informative, but not helpful. Let me explain how my question is different. Second, let me say that I have two questions. One is an ASP.Net related question. The other is a general System.Exception question. They are related but also individual. Okay here is my problem...
7
5147
by: Sek | last post by:
Hi Folks! I was pondering over a code and noticed that exception handlers were present in the private, protected as well as public methods. And, ofcourse, public methods were calling priv/prot methods internally. My thought was, the exception is being rethrown and propagated by the non-public methods to the public methods, causing performance overhead (stack winding etc). I do agree that, the purpose of throwing the exception by...
2
6994
by: Darko Miletic | last post by:
Recently I wrote a dll in c++ and to simplify the distribution I decided to link with multithreaded static library (/MT or /MTd option). In debug everything works fine but in release I get this: parseMetadata.obj : error LNK2001: unresolved external symbol "public: __thiscall std::exception::exception(void)" (??0exception@std@@QAE@XZ) 2>libcpmt.lib(string.obj) : error LNK2001: unresolved external symbol "public: __thiscall...
0
10452
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.