Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-01-2007, 07:09 AM
Member
 
Join Date: Jul 2007
Posts: 51
mary is on a distinguished road
Exception Report:annot allocate servlet instance for path
I have written a html page to invoke a servlet named logtest1

and i have created that logtest1.java file in the following path.
c:/apache tomcat/webapps/root/web-inf/classes/logtest1.java

in the html file, i gave the path as
Code:
<form name=log method=post action= "/servlet/logtest1">
But, when I click on submit button, I get one servlet exception as
Code:
A Servlet Exception Has Occurred Exception Report: javax.servlet.ServletException: Cannot allocate servlet instance for path /servlet/logtest1 java.lang.IllegalAccessException: logtest1"
why?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-05-2007, 05:54 AM
Senior Member
 
Join Date: Jun 2007
Posts: 164
Heather is on a distinguished road
can you paste more code?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-07-2007, 04:44 PM
Member
 
Join Date: Jul 2007
Posts: 51
mary is on a distinguished road
The HTML code as follows:
Code:
<html> <head> <title>Login Screen</title> </head> <body bgcolor="pink"> <h1 align=center>Login Screen</h1> <hr size=2 width=100%> <br><br><br><br><br><br><br><br><br> <form name="log" method="post" action="/servlet/logtest1"> <table borer=1 align=center> <tr> <td>Userid:</td> <td><input type=text name=userid ></td> </tr> <tr> <td>Password:</td> <td><input type=password name=psw></td> </tr> <tr><td><input type=submit name='login'width=05 value='Login'></td></tr> </table> </body> </html>
The servlet code as follows:
Code:
import java.lang.*; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.http.HttpSession; import java.util.*; import java.util.Properties; import java.io.*; import java.text.*; class logtest1 extends HttpServlet { PrintWriter out=null; public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { response.setContentType("text/html"); out = response.getWriter(); String fileName = new String(); String aDataString = new String(); String user=request.getParameter("userid"); fileName = "MyFileName.dat"; //aDataString = "I want to write this string to a file."; FileWriter fw = new FileWriter(fileName); BufferedWriter bw = new BufferedWriter(fw); PrintWriter outFile = new PrintWriter(bw); outFile.println(aDataString); System.out.println("File has been created successfully"); outFile.close(); } //System.out.println("out of dopost method"); }
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 08-09-2007, 11:10 AM
Member
 
Join Date: Aug 2007
Posts: 2
sunnyvijaya is on a distinguished road
give the path in web.xml of the
<servlet>
<servlet-name>logtest1 </servlet-name>
<serlvet-class>logtest1 <serlvet-class>
</servlet>

and <servletmapping> also
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 11-05-2007, 07:14 PM
Member
 
Join Date: Nov 2007
Posts: 2
goodguy052 is on a distinguished road
First of all, in the path you have shown c:/apache tomcat/webapps/root/web-inf/classes/logtest1.java the file name should be logtest1.class, not logtest1.java
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble with factory method - unhandled exception type Exception desmond5 New To Java 1 03-08-2008 08:41 PM
New Instance for SWT srinivasa_v SWT / JFace 1 08-08-2007 03:02 AM
javax.servlet.ServletException: Wrapper cannot find servlet class util.t2 osval Advanced Java 1 08-07-2007 05:47 PM
A Servlet Exception Has Occurred gabriel Database 1 08-07-2007 04:28 AM
Instance variable Jack New To Java 2 07-04-2007 06:00 AM


All times are GMT +3. The time now is 07:04 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org