aspose file tools*
The moose likes Spring and the fly likes BeanCreationException and NoClassDefFoundError : What am I missing in here? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "BeanCreationException and NoClassDefFoundError : What am I missing in here?" Watch "BeanCreationException and NoClassDefFoundError : What am I missing in here?" New topic
Author

BeanCreationException and NoClassDefFoundError : What am I missing in here?

Raj Shharma
Ranch Hand

Joined: Mar 22, 2009
Posts: 60
I have this FileUploadController which I am trying to run but am getting BeanCreationException and NoClassDefFoundError for FileUploadController.class. I have this class in classpath but still am getting this error, any suggestions, I have web.xml file, servlet-config.xml, exception and classpath information for this question here.

Also please refer to BeanCreationException

FileUploadController.java



Web.xml


spring-context.xml


exception



classpath


Any suggestions would be highly appreciated?


[Smart Questions]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

That classpath, is that for the environment that you are running/deploying too, or just the classpath for your IDE for editing your code.

That error is always that the class is not in the classpath.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Raj Shharma
Ranch Hand

Joined: Mar 22, 2009
Posts: 60
That classpath, is that for the environment that you are running/deploying too, or just the classpath for your IDE for editing your code.


Its for the environment that am running/deploying too and so I believe it should work.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

OK I noticed one error in your config stuff. In your web.xml you have

<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!-- Added for File Upload -->
<!-- <init-param> -->
<!-- <param-name>contextConfigLocation</param-name> -->
<!-- <param-value> -->
<!-- /WEB-INF/spring-servlet.xml -->
<!-- </param-value> -->
<!-- </init-param> -->
<!-- Added for FileUpload -->
<load-on-startup>1</load-on-startup>
</servlet>

With the init-param commented out, then the DispatcherServlet is going to look for a file called spring-servlet.xml as its configuration file, in the WEB-INF directory. But your config file name is spring-context.xml, so your config file isn't loading.

Mark
Craig Walls
author
Ranch Hand

Joined: Sep 19, 2003
Posts: 301
The "tell" on this is where it say "NoClassDefFoundError: Could not initialize class". This doesn't mean that the class doesn't exist...it means that when the classloader is loading the class it runs into trouble.

I can't tell for sure here...not enough info (despite the fact you posted plenty of code, I don't believe the real problem is in any of the stuff you posted). But I'd start looking at your controller and follow all of the types it depends on looking for static types or blocks. Something is going awry *when the class is loading*, which hints to me that it very well could be a problem in some static initializer. Just a guess though...


Spring in Action - Unleash POJO power in your applications!
Modular Java - Discover the secret weapon to modularity on the Java platform!
XDoclet in Action - Your complete guide to code generation with XDoclet.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: BeanCreationException and NoClassDefFoundError : What am I missing in here?
 
Similar Threads
Spring 3 not calling .html and servlet is not available
How to copy generated wsdl file to WAR file?
Null Pointer on sessionFactory.getCurrentSession
Maven Error - Unable to find repo
Spring and Hibernate problem