• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

deploying prb ..

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys ,

finally after all the frustration..i was able to a simple servlet ..just to print a HelloWorld..
now i have a prb on second servlet .. here is the prg .java & .xml files




& here is the error which i go it when i ran it ..


type Exception report

message

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

exception

javax.servlet.ServletException: Error instantiating servlet class HelloUser
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:790)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:709)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:572)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
java.lang.Thread.run(Thread.java:534)


root cause

java.lang.IllegalAccessException: Class org.apache.catalina.core.StandardWrapper can not access a member of class HelloUser with modifiers ""
sun.reflect.Reflection.ensureMemberAccess(Reflection.java:57)
java.lang.Class.newInstance0(Class.java:302)
java.lang.Class.newInstance(Class.java:261)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:790)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:709)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:572)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
java.lang.Thread.run(Thread.java:534)


note The full stack trace of the root cause is available in the Tomcat logs.



& here's how i'm invoking it ..
http://localhost:8080/HelloServlet/servlet/HelloServlet?userName=Akshatha

i dont know why its not working ... & i have no clue what to do ..
can anyboy pls help me ..
thankx in advance
 
Bartender
Posts: 3904
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

It says that another servlet - HelloUser - which is used by your HelloServlet can not be accessed. Did you posted the correct source code ? Is there any reference from one servlet to another?

Also, check that you have unique mappings for each servlet. Maybe wrong servlet is invoked when you type 'http://localhost:8080/HelloServlet/servlet/HelloServlet?userName=Akshatha'.

regards,
MZ
 
Akshatha Nayak
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankx Mikalai Zaikin for replying..
i got the output .. i still dont know what was actually wrong..
everything is same ..
 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Firstly, you shouldn't be over-riding the service method (you ought to call the super-class service method if you are (not recomended) going to over-ride it)- override the doGet or doPost method instead.

As to your problem, as Mikalai mentioned, the error messages mention a HelloUser class, but you do not appear to have one shown. Did you have one on a previous occasion?
All I can think of is that an old version of this class is still deployed that did use a HelloUser class, so I'd suggest recompiling your current version and copy the .class file to the deployed app again, and re-copy your web.xml into the WEB-INF directory to confirm that you don't have any previous attempts confusing the matter.
Then stop/start the web container (tomcat?) and try again.
Hope this helps.
 
Akshatha Nayak
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankx Roger for replying .. i some how got the output for the HelloUser servlet ..( the one i posted b4) i dont know what was wrong .. i didnt change anything ..everything was same .. but now here is another servlet .. its just like hello world servlet .. but i'm not getting it.. its say error 500 .. pls check out the code .. folder in which i'm keeping WEB-INF is worldwide .. servlet name is TestServlet..
here is TestServlet.java


here is web.xml

here is the error page
type Exception report

message

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

exception

javax.servlet.ServletException: Error instantiating servlet class TestServlet
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:790)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:709)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:572)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
java.lang.Thread.run(Thread.java:534)


root cause

java.lang.IllegalAccessException: Class org.apache.catalina.core.StandardWrapper can not access a member of class TestServlet with modifiers ""
sun.reflect.Reflection.ensureMemberAccess(Reflection.java:57)
java.lang.Class.newInstance0(Class.java:302)
java.lang.Class.newInstance(Class.java:261)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:790)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:709)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:572)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
java.lang.Thread.run(Thread.java:534)


note The full stack trace of the root cause is available in the Tomcat logs.

i have no clue whatz going wrong here .. i'm new to all these stuffs ..& its pissing me off .. i'm frustrated too ..
 
Mikalai Zaikin
Bartender
Posts: 3904
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


make your class public and it should work !

regards,
MZ
 
Akshatha Nayak
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankx Mikalai Zaikin... it worked ..
hey can u pls tell me what r the things i shud keep in mind b4 i deploy a servlet .. coz my rate of deploying is one servlet for a day ..
i'm really horrible at this ..
or shud i read & finish the book b4 i do any programs ?
pls suggest me guide lines ..
Thankx for mailing me & helping me out with this
 
Mikalai Zaikin
Bartender
Posts: 3904
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Akshatha

I don't see any problems with your servlets, they are looking good !

The issue with 500 Error was caused by vialoting general Java programming rules, it is not Web (servlet) specific.

The Web container tries to create some servlet wrapper (create own runtime implementation) and failed because you created servlet in one package and Web container creates its wrapper in other package, and default class modifier restricts access from other package:


2.8.2 Class Modifiers

....

A class is declared public to make its type available to packages other than the one in which it is declared. A public class is accessible from other packages, using either its fully qualified name or a shorter name created by an import declaration (�2.7.2), whenever the host permits access to its package. If a class lacks the public modifier, access to the class declaration is limited to the package in which it is declared.



Have fun !

regards,
MZ
 
Akshatha Nayak
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankx alot Mikalai Zaikin ... i didnt know all that ..
hey which book r u following ? HFS or Hemanth Deshmukh ?
thankx once again
 
To do a great right, do a little wrong - shakepeare. twisted little ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic