0

hi,
i'm trying to run a servlet code, but i get "HTTP Status 404 - Servlet Update2 is not available" error.
i checked code, its perfect, web.xml is correct.
but i did not find any .class files in my web-inf/classes directory.
how could i get servlet .class files in web-inf/classes dir?

waiting 4 answer,
BeanBoy :)

3
Contributors
16
Replies
17
Views
7 Years
Discussion Span
Last Post by fardoonmuhafiz
0

i used eclipse IDE. i just saved them and run the files. do i need to compile?. i'll try once,...and thanks 4 the reply

0

I hope you created a proper web project through Eclipse. Using web project will take care of basic needs compile/run/deploy.

Edited by peter_budo: n/a

0

no peter, its not power web proj. everything worked fine for previous projs,.... but i donno whis this happed this time.

what do u think might be the prblem?
thanQ

0

Without seeing project structure and relevant coding it is difficult to make a statement. If you want attach your project in zip/rar to next reply and someone will have look at it, of course if it is not confidential.

0

i'm sorry i couldn't attach the proj, but thanks for the help :)

0

Otherwise u do one thing....compile ur servlets .java files and place the .class files manually in the WEB-INF/classes folder then it shld work...and one more thing...did u make ur servlet public?....

0

okay,..i wil do what u said,...and yes my servlet is public ...thanQ

0

do i need a Java Studio Creator to compile my servlets,.... i'll check it anyway

0

okay, compiled using net beans, copied the .class file in to web-inf/classes dir, restarted server ,..and when i run, i got same 404 class not found error.
thanQ

0

okay,... i hav compiled the servlet file in netbeans, copied it in to web-inf/classes folder in eclipse proj,...it still shows 404 class not found error :?:

thanQ:icon_cool:

0

2 possible issues:
1)You didn't point compiler to the location of servlet.jar file (which should not be this case if you used appropriate project)
2)Your files can no longer find each other as you may not keep folder structure as on compile

If you want to compile from command line you can use following example . For better understanding how to with deployment have look here

0

do i need a Java Studio Creator to compile my servlets,.... i'll check it anyway

You don't need a java Studio creator to compile your servlet...just copy paste your servlet in a text document,or edit plus....go to the command prompt and set the path to your j2sdk/bin and compile the program using javac command....it shld work....and just copy the .class file into classes folder....thanks....

0

2 possible issues:
1)You didn't point compiler to the location of servlet.jar file (which should not be this case if you used appropriate project)
2)Your files can no longer find each other as you may not keep folder structure as on compile

If you want to compile from command line you can use following example . For better understanding how to with deployment have look here

Mr.beanboy said he compiled his .java file(servlet) successfully....that means his compiler accessed the class files available in servlet.jar files necessary....

0

okay :) i wil see

tin the <servlet-mapping> tag u have <url-pattern> tag and this should match exactly with the <servlet-name> tag in <servlet> tag e.g.
in the web.xml file...

<web-app>
<servlet>
<servlet-name>dummy</servlet-name>
<servlet-class>SomeServlet</servlet-class>
</servlet>
<servlet-mapping>
 <servlet-name>dummy</servlet-name>
<url-pattern>/heloserv</url-pattern>
</servlet-mapping>
</web-app>

Here the servlet-name can be any name...but make sure it is same in both the <servlet> and <servlet-mapping> tags and the <servlet-class> should be the name of your servlet(the servlet you developed)...
and the url pattern can be anything...but if you have done hard deployment in the server...you should call the servlet in the following way....
http://localhost:portnumber/root/helosrv

if you did console deployment and your war file name is something like test.war then you shld call the servlet in the following way...
http://localhost:portnumber/test/helosrv...

Hope ur servlet works fine now....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.