cancel
Showing results for 
Search instead for 
Did you mean: 

Servlet Error

Former Member
0 Kudos

Hello all,

I m trying to start my servlet in the web browser after deploying in J2EE Engine in NWDS.

and i get the following error

404 not found

A servlet with class [ContentServer] is not found!

Details: java.lang.ClassNotFoundException: ContentServer

Found in negative cache

-


Loader Info -


ClassLoader name: [sap.com/com.sap.engine.docs.examples]

Parent loader name: [Frame ClassLoader]

References:

common:service:http;service:servlet_jsp

service:ejb

common:service:iiop;service:naming;service:p4;service:ts

service:jmsconnector

library:jsse

library:servlet

common:library:IAIKSecurity;library:activation;library:mail;library:tcsecssl

library:ejb20

library:j2eeca

library:jms

library:opensql

common:library:com.sap.security.api.sda;library:com.sap.security.core.sda;library:security.class;library:webservices_lib;service:com.sap.security.core.ume.service;service:connector;service:dbpool;service:keystore;service:security;service:userstore

interface:resourcecontext_api

interface:webservices

interface:ejbserialization

common:service:adminadapter;service:basicadmin;service:configuration;service:deploy

library:sapxmltoolkit

Resources:

D:\usr\sap\J2D\JC03\j2ee\cluster\server0\apps\sap.com\com.sap.engine.docs.examples\servlet_jsp\_default\work

Loading model: {parent,references,local}

Can somebody tell me wht should i do for this

Thanks

Regards

Yogi.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Yogi,

Can you please write how you invoke your servlet in the web browser and what is the context-root of your application?

From the stack trace I can see that the servlet is searched in the class loader of the default application. I suppose that you have requested something like http://<host>:<port>/servlet/ContentServer. The correct URL should be http://<host>:<port>/<application context>/servlet/ContentServer

Kind Regards

Vyara

Answers (7)

Answers (7)

Former Member
0 Kudos

Hello Vyara,

Yes i have the SAPALink class file under WEB-INF/classes

and i also changed the url pattern the error lives.

Thanks

Yogi

Former Member
0 Kudos

Hello Vyara,

As u told me to check if WEB-INF/classes have the required class files for the servlet.

I imported a class file extension .class [in my example it is ContentServer.class]into the above directory so that the servlet can be read.My servlet name is also ContentServer.

so the class file is under

WEB-INF/classes/ContentServer.class

my web.xml has these specifications.i think there is an error in <servlet-class> node.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<display-name>WEB APP</display-name>

<description>WEB APP description</description>

<servlet>

<servlet-name>ContentServer</servlet-name>

<servlet-class>ContentServer</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>ContentServer</servlet-name>

<url-pattern>http://localhost:8100/ContentServer/servlet/ContentServer</url-pattern>

</servlet-mapping>

</web-app>

Thanks

yogi

Former Member
0 Kudos

Hello Yogi,

You wrote that the missing class is SAPAlink. Is it also in WEB-INF/classes?

As for the web.xml I would say that the url pattern is not correct. The mapping is used to invoke the servlet without specifying its whole name, i.e. instead of requesting http://localhost:8100/ContentServer/servlet/ContentServer you may request just http://localhost:8100/ContentServer/<url-pattern>.

Kind regards

Vyara

Former Member
0 Kudos

Hi Vyara,

Can u tell me where the servlet reads from have .java or .class file!

Regrds

Yogi

Former Member
0 Kudos

Hello Yogi,

I don't understand your question. JVM does load java files. It loads classes. So the application classloader cannot load the class file (not the java file).

Best Regards

Vyara

Former Member
0 Kudos

Hello Vyara,

I had no directory as such called "classes" under WEB-INF

But now i created a directory "classes" but i gives the same error.

Thanks

Yogi.

Former Member
0 Kudos

Hello Yogi,

Where exactly do you create this directory? It should be in the war file that is deployed on the Engine.

You can try to add the already compiled classes (without java files) in bin directory of your project in Developer Studio. If you have java files in source directory of the project, they definitely go to WEB-INF/classes directory when the war file is build.

If you have a jar file containing the classes you can add it in the java build path -> libraries of your project and the jar file will be included in WEB-INF/lib directory and you should not have this NoClassDefFoundError.

Kind Regards

Vyara

Former Member
0 Kudos

Hello Vyara,

Actually I have .jar file ContentServer.jar( ContentServer.class is included in it)I extracted this into my Web Module Project.Later it automatically created a Servlet by name "ContentServer" So i added this servlet into my web.xml file.

But I also need this SAPAlink Class file for further processes.So I added this also to my Web Module Project

under the folder "source" in Web project module, i have both ContentServer.class and SAPAlink.class in that folder

Vyara i dont have any folder by name "classes" under WEB-INF.

Do you want me to create a folder "classes" under WEB-INF and add the two class files.

_I hope understood me..

Thanks again.

Yogi

Former Member
0 Kudos

Hello Yogi,

Can you please open the generated war file for your web module and check if you have those two classes in WEB-INF/classes directory?

Best Regards

Vyara

Former Member
0 Kudos

Hello Vyara,

The error should me a class file SAPAlink no found

Can you tell me where exactly should i place this class file in NWDS(I have created 2 projects Web Module Project and Enterprise Application project with .ear file)

so that the servlet can read.

Thanks

Yogi

Former Member
0 Kudos

Hello Yogi,

Is this SAPAlink class part of the web project or it is packed in a separate jar file?

All classes in WEB-INF/classes and all jar files in WEB-INF/lib will be loaded with your application classloader.

If a jar file is deployed as library its classes will be loaded by the application if there is reference from the application to the library.

Best Regards

Vyara

Former Member
0 Kudos

Hello Vyara,

Yes you are exactly right i thought about it as soon as i posted the message i had forgotten the application context.Thank You.

But now it shows a different error.

It is as below..Do you have any idea about this..Thanks

Application error occurs during processing the request.

Details: java.lang.NoClassDefFoundError

at S.FDXL(FDXL)

at S.I(FDXL)

at ContentServer.I(FDXL)

at ContentServer.init(FDXL)

at com.sap.engine.services.servlets_jsp.server.runtime.context.WebComponents.getServlet(WebComponents.java:326)

at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:121)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:391)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:265)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Former Member
0 Kudos

Hello Yogi,

Most probably you use external libraries, which are not deployed with the application and there is no reference to them (if they are deployed as libraries).

Unfortunately it is custom coding and I cannot tell which class is missing. Check your coding.

Best Regards

Vyara