NoClassDefFoundError-- please help me
really i am appreciating your feedback soon
Why is it happening ?
i got exception in my application
Exception is
javax.servlet.ServletException: Error allocating a servlet instance
Root Cause
java.lang.NoClassDefFoundError: LoginAction (wrong name: CallMonitor/LoginAction)
# 1
Without much to go on here, I would say to double check that all the classes needed are actually being deployed. They might be available in your debug environment, but when you deploy, some classes are missing. For instance, I am using IntelliJ, and my project has a set of jars and class in debug. But when I check what is actually being deployed to a Tomcat instance for debug, some things are missing.
# 2
> java.lang.NoClassDefFoundError: LoginAction (wrong
> name: CallMonitor/LoginAction)
Check out whether you have LoginAction.class in your execution path
# 3
Thanks i cleared the exception .
Now i got a null pointer exception in my code...
This is my servlet ...
boolean check = false;
ServletContext context = null;
String username1 = request.getParameter("username");
String password1 = request.getParameter("password");
Object contextGet = context.getAttribute("connection");
Check c = new Check(username1,password1);
check = c.existCheck(contextGet);
Object contextGet = context.getAttribute("connection");
Here connection i set as attribute in Listener class
# 4
You have not initialized ServletContext and it is null
ServletContext context = null;
You need to initialize in init() method like
context = config.getServletContext();
Also declare it as a instance variable.