• 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

Facing the problem when loading the servlet but not when compiling.

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Am facing a strange Problem when working with the servlets, Please help me. ( When trying to execute the example from "CORE SERVLETS AND JAVA SERVER PAGES, Chapter 7)
I am having a servlet, "ShadowedText.java", which will invoke a method from "MessageImage.java". These two files are in the same directory.
"MessageImage.java", is importing a class "Acme.JPM.Enoceds.GifEncoder". I have imported the whole pacakge of "Acme" from the net and copied to my system.
From one of the methods of "MessageImage.java", i am calling a method of the class "GifEncoder.java"
When compiling the source files, every thing is going fine and all the class files are available.
But when loading the servlet through IE, am getting the below error -- At "MessageImage.java" when calling the method from the class "GifEncoder.java".
Error:
=============================================
Sun Sep 07 11:26:22 GMT 2003:<E> <ServletContext-General> Servlet failed with Exception
java.lang.NoClassDefFoundError: Acme/JPM/Encoders/GifEncoder
at coreservlets.MessageImage.sendAsGIF(MessageImage.java:69)
at coreservlets.ShadowedText.doGet(ShadowedText.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:120)
at weblogic.servlet.ServletServlet.service(ServletServlet.java:46)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:120)
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:941)
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:905)
at weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java:
at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:391)
at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:273)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
========================================================
My doubt is, Why am i getting the error, when loading the servlet but not when compiling the source files.
Link to the source files ("ShadowedText.java", "MessageImage.java")
http://archive.coreservlets.com/Chapter7.html
Link to -- "Acme.JPM.Enoceds.GifEncoder"
http://www.acme.com/java/software/Acme.JPM.Encoders.GifEncoder.html
By the way, I am using Bee Weblogic Server Version 5.1.0.
[ September 07, 2003: Message edited by: narasimha rao bandlamudi ]
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are getting the error from the servlet because the latest Tomcat ignores the system CLASSPATH. Read the Class Loader How-To section of the Tomcat documentation installed by tomcat as web pages - look at /tomcat-docs/index.html - the how-to link is on the left side.
Bill
 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi William,
I am not using Tomcat webserver. I am using Bee Weblogic server version 5.1.0

Regards,
Narasimha.
[ September 07, 2003: Message edited by: narasimha rao bandlamudi ]
 
Ranch Hand
Posts: 5399
1
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
check the classpath setting of your server.
 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ravish,
Before starting the server from the command window, i have appended to the classpath "d:\java\acme". And in the "MessageImage.java" file i am having the import statement, "import Acme.JPM.Encoders.GifEncoder;" . So server can found the "GifEncoder.java" file, at "d:\java\acme\Acme\JPM\Encoders\GifEncoder".
But still i am getting the same error.
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't u make a jar file of the entire Acme package and put it in the lib directory of the app server(in ur case BEA Weblogic).
Then directly use the package in ur application
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, instead of adding the path to '..acme..', try including the ACME jar (if its thirdparty api, its normally a jar, is it not?) into your classpath
 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have made the entire Acme package as a jar file and put the jar file in the lib directory of the server and added the path of the jar file to my classpath, still i am getting the same error.
In IE window below error is throwing,
-----------------------------------
Error 500--Internal Server Error
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.5.1 500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.
-------------------------------------------------
[ September 08, 2003: Message edited by: narasimha rao bandlamudi ]
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some dumb questions
1.How did you jar it? Did you mean that directory hierarchy when the file was jared?
2. Did you put the jar file in the SERVER CLASSPATH.
 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Pradeep,
I have jarred using the command "jar cf Acme.jar *". After that i unjarred every thing is fine, when i look at that one.
Sorry i didn't get the meaning of the SERVER CLASSPATH. Is it the the classpath?. If it is the CLASSPATH, i have added the jar file into the classpath and java files are compiling using the jar file and classfiles are generated properly.
Please clarify my doubt, Why am i not getting the error when compiling?
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.weblogic.com/docs51/admindocs/classpath.html#cpwls
 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Finally it is working by updating the classpath variable value(weblogic.httpd.servlet.classpath=<<path of the jar file or path of the directory where the class files are located>> ) in weblogic.properties file.
Thnaks a ton to all.
[ September 09, 2003: Message edited by: narasimha rao bandlamudi ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic