tags:

views:

87

answers:

1

I do have the home html file, when I give the context root http://localhost:8080/ccc the html file automatically loaded in browser. In the html file I have five links, each contains the , link in this format, <a href="servlet_alias_name">Title</a> ,

when I click on the any one of the link, it says servlet_name not found...is it not possible to navigate from html to servlet via "a href" tag?

I'm using Sun Java App Server8.0, I have included the libraries too while deploying..

And It shows the following exception,

javax.servlet.ServletException: Error instantiating servlet class pagesvsnodes
    org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:189)
    com.sun.enterprise.web.connector.grizzly.ProcessorTask.doProcess(ProcessorTask.java:604)
    com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:475)
    com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:371)
    com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:264)
    com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:281)
    com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:83)
root cause

java.lang.NoClassDefFoundError: org/jfree/data/general/PieDataset
    java.lang.Class.getDeclaredConstructors0(Native Method)
    java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
    java.lang.Class.getConstructor0(Class.java:2640)
    java.lang.Class.newInstance0(Class.java:321)
    java.lang.Class.newInstance(Class.java:303)
+1  A: 

If the servlet_alias_name is defined as a url-mapping in the deployment descriptor (/WEB-INF/web.xml) for your web application you should be able to access the servlet in this way. My guess is you haven't defined a URL mapping and are trying to use the servlet-name element directly, which won't work.

For example, the following snippet would map the servlet class com.mycompany.SuperServlet to the logical name myServlet, then map the URL http://localhost:8080/ccc/servlet-alias-name to the logical name myServlet too. That would make requests to that URL invoke that servlet class.

<servlet>
  <servlet-name>myServlet</servlet-name>
  <servlet-class>com.mycompany.myservlets.SuperServlet</servlet-class>
</servlet>

<servlet-mapping>
  <servlet-name>myServlet</servlet-name>
  <url-pattern>/servlet_alias_name</url-pattern>
</servlet-mapping>

Update - OK scratch all that.

Your problem is that your webapp can't find the org.jfree.data.general.PieDataset class at runtime, although it was there when the code was compiled, check the javadoc for NoClassDefFoundError.

Have you included the libs in the deployed webapp?

  • as a jar in /WEB-INF/lib
  • as classes in /WEB-INF/classes

Or are the libs supposed to be deployed and available globally on the appserver?

Do you have the same versions of the libs in your build environment and in your runtime env?

To debug this error when I've seen it on Tomcat, I go to the simple case (deploy jar with webapp) and try to get that to work. I've never found any particularly useful tooling for debugging this situation to be honest - anyone know of anything that helps?

Brabster
I'm using Sun Java Application Server 8.0 PE. It automatically creates and updates those mapping details while Deploying.
Senthil
Sorry, that wasn't clear from the original question text. Updated my answer based on the additional detail you provided, hope it's of more help.
Brabster
Thanks for your idea..I got result
Senthil
Happy I could help :)
Brabster