且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

java.lang.NoClassDefFoundError:javax / servlet / ServletContextListener错误

更新时间:2022-10-14 23:12:52

当我试图编译一个项目没有servlet的依赖,如果你使用maven,把javax.servlet放到pom.xml中。

 < dependency> 
< groupId> javax.servlet< / groupId>
< artifactId> servlet-api< / artifactId>
< version> 3.0.1< / version>
< scope>提供< / scope>
< /依赖关系>

如果知道版本目标并且范围是,您可以将版本更改为另一个版本因为很可能你会使用tomcat或者其他类型的服务器,这些服务器已经包含了实现。如果你不使用maven,那么你可以下载这个。 jar并添加到您的projet的lib文件夹中。

Hi my dynamic web application in struts1 spring and hibernate integration is developed on 64 bit machine..Its running fine on 64 bit machine but giving jar issues on 32 bit machine its giving following error

    SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener
    at java.lang.ClassLoader.findBootstrapClass(Native Method)

and

    SEVERE: Error configuring application listener of class org.springframework.web.util.Log4jConfigListener
java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener
    at java.lang.ClassLoader.findBootstrapClass(Native Method)

should i change all jars for 32 bit machine?

I had some similar problem in when i tried to compile one project without the servlet dependancy, if you use maven put the javax.servlet in the pom.xml

<dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>3.0.1</version>
        <scope>provided</scope>
</dependency>

You can change the version to another if you know the version target and the scope is provided because is probably that you will use tomcat or another type of server, that contain already the implementation

Or if you not use maven, you can download the .jar and add to the lib folder of your projet