Win a copy of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) this week in the OCPJP forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

NoClassDefFoundError with netbeans

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

i created a small jsp/servlet... application with netbeans 5

in the project section of netbeans
i have the name project:

WebAppExemple
|WebPages (somes jsp)
|Web Services (empty)
|Configuration files
|Server Ressource
|Source package
| default package
| GateWayServlet.java
| DaoFactory.java
|...

when my jsp try to access my servlet: GatewayServlet i get



any idea?
 
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
exception you get is :

java.lang.NoClassDefFoundError: /GatewayServlet (wrong name: GatewayServlet)

what you have in your project is

WebAppExemple
|WebPages (somes jsp)
|Web Services (empty)
|Configuration files
|Server Ressource
|Source package
| default package
| GateWayServlet.java
| DaoFactory.java

just check the Spell , java is case sensitive.
 
mark smith
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Masoud Kalali:
exception you get is :

java.lang.NoClassDefFoundError: /GatewayServlet (wrong name: GatewayServlet)

what you have in your project is

WebAppExemple
|WebPages (somes jsp)
|Web Services (empty)
|Configuration files
|Server Ressource
|Source package
| default package
| GateWayServlet.java
| DaoFactory.java

just check the Spell , java is case sensitive.




ok now i have

[pre]
WebAppExemple
|WebPages
---|insertMembre.jsp
...
|Web Services (empty)
|Configuration files
|Server Ressource
|Source package
| default package
---| GatewayServlet.java
---| DaoFactory.java
[/pre]

but i get the same error

in my jsp (insertMember i call the jsp like

[ September 07, 2006: Message edited by: mark smith ]
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This has nothing to do with Netbeans (except that overreliance on it caused you to lack understanding of what you're doing).
You should read a basic tutorial on how to create and configure web applications in Java, especially Servlets.
That should open your eyes to the small but deadly oversight (or rather 2 of them) you appear to have been guilty of here.

1) don't use the default package.
2) where's your web.xml entries for that servlet (do you even have a web.xml?).
 
mark smith
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my servlet and my java file are not in

moreservlet package...

in my jsp i have:

<form action="/moreservlet/GatewayServlet" name="frmMembre" method="post">

and i get the same result

web.xml

work fine now
[ September 09, 2006: Message edited by: mark smith ]
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic