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 :)

What did you use for compiling Java files? IDE or command line?
And what did you do in order to compile them?

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

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

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

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.

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

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?....

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

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

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

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:

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

okay :) i wil see

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....

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....

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....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.