Not able to run servlets in Weblogic Server 5.1

Discussions

Web tier: servlets, JSP, Web frameworks: Not able to run servlets in Weblogic Server 5.1

  1. Hi... When I run my servlet thru weblogic server it shows me following error: Error loading servlets: examples.servlets.SessionCounter

    Java.lang.NoClassDefFoundError : examples/servlets/SessionCounter (wrong name : SessionCounter)

    I have posted SessionCounter.class file in C:\weblogic\myserver\servletclasses\examples\servlets\ folder and also registerd with weblogic.httpd.register.ServletCount in weblogic.properties file
    I have chked path is properly set weblogic.httpd.servlet.classpath=D:/weblogic/myserver/servletclasses but still it is not working while other servlets in the same folder are working properly .

    Please help me to solve this error

    Thanks in advance

    Regards
    Chintan

    Threaded Messages (10)

  2. PRE_CLASSPATH[ Go to top ]

    You could have 'PRE_CLASSPATH' - check startWLS.cmd. I am using 7.4 and also you could keep classes (regular used ones) under 'bea\weblogic700\server\ext'.

    Sorry I am talking about 7.x, not really sure about 5.1

    Another thought is that if SessionCounter is compiled in a package; make sure that you keep same package structure under - servletclasses\examples\servlets\ folder.

    i.e - servletclasses\examples\servlets\examples\servlets\SessionCounter


    -arun
  3. correction..[ Go to top ]

    sorry not

    servletclasses\examples\servlets\examples\servlets\SessionCounter

    - servletclasses\examples\servlets\examples\servlets\example\xx\SessionCounter
  4. correction..[ Go to top ]

    sorry notservletclasses\examples\servlets\examples\servlets\SessionCounter- servletclasses\examples\servlets\examples\servlets\example\xx\SessionCounter
    Hi Arun,

    I have not used any Package. I have simply post the file in servletclasses/examples/servlets/SessionCounter.class so wht should i set more

    ??

    Chintan
  5. try[ Go to top ]

    put SessionCounter.class immediate under Servletclasses directory, if you have any package.
  6. try[ Go to top ]

    put SessionCounter.class immediate under Servletclasses directory, if you have any package.
    if i put SessionCounter under ServletClasses directory then wht setting should i make in welogic.properties file
  7. try[ Go to top ]

    These are the 2 arugments you should be looking in weblogic.properties
    weblogic.httpd.servlet.classpath=<path>; [defaulted to /weblogic/myserver/servletclasses]
    weblogic.httpd.servlet.reloadCheckSecs=some refresh time integer

    You can add multiple directories, you own, to the servlet classpath, separated by semi-colons ";".

    Or

    you can also try to register your new sevlet class using console. hope you know how to do that. if not
    then go to console HTTP option .. then Servlets ManagedObject and take command tag... give servlet name as 'virtual name'.

    if this doesnt work then give me u r weblogic.propeties file.

    ok
  8. try[ Go to top ]

    will try and let u know
  9. try[ Go to top ]

    not able to post whole weblogic.properties file so if u dont mind can u gie me ur email id so that i can send u..

    Second i have tried thru console but not succeed

    I hvae given following parameter
    I kept my file DBconnection.class in D;\weblogic\myserver\myservletclasses

    Virtual name : connection
    servlet name : wht shuld i give only DBConnection or something else

    Please suggest me
  10. Hi....

    I have posted part of weblogic.properties.
    Here my servelt is DBConnection.class file and posted in D;\weblogic\myserver\myservletclasses as well in D;\weblogic\myserver\myservletclasses\examples\servlets folder now tell me wht should i write here



     # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    # USER-WRITTEN AND DEMO SERVLET REGISTRATIONS
    # --------------------------------------------------------
    # Set ACLs for these as desired
    # --------------------------------------------------------
    weblogic.httpd.register.phone=examples.servlets.PhoneServlet
    # Set initArgs phonelist value to the fully-qualified
    # file specification of the phonelist file
    weblogic.httpd.initArgs.phone=\
            phonelist=D:/weblogic/examples/servlets/phonelist
    weblogic.httpd.register.snoop=examples.servlets.SnoopServlet
    #DBConnection is User Written Servlet
    weblogic.httpd.register.connection=examples.servlets.DBConnection
    weblogic.httpd.register.cookies=examples.servlets.CookieCounter
    weblogic.httpd.register.error=examples.servlets.ErrorServlet
    weblogic.httpd.register.applet=examples.servlets.AppletServlet
    weblogic.httpd.register.helloWorld=examples.servlets.HelloWorldServlet
    weblogic.httpd.register.helloKona=examples.servlets.HelloKonaServlet
    weblogic.httpd.register.page=examples.servlets.PageEvent
    weblogic.httpd.initArgs.page=\
            imageurl=D:/weblogic/examples/images/trans.gif
    weblogic.httpd.register.session=examples.servlets.SessionServlet
    weblogic.httpd.register.simple=examples.servlets.SimpleServlet
    weblogic.httpd.register.simpleFormServlet=examples.servlets.SimpleFormServlet
    weblogic.httpd.register.survey=examples.servlets.SurveyServlet
    weblogic.httpd.initArgs.survey=\
            resultsDir=D:/weblogic/myserver
  11. I am little confused here. You said before your servlet class doesnt have any package 'DBConnection.class' (i assue this is u r servlet - bit strange name). But when you register you have regsitered like this - 'weblogic.httpd.register.connection=examples.servlets.DBConnection'. So create the directory structure or compile using javac -d and place classes under appropriate directory/package.

    Its a simple job, i dont know why you have so much trouble.

    Also, have a look in here.
    http://edocs.bea.com/elink/elinkjam/v411/jamug/dploy.htm#1022055