Spring asm Dependency

The asm Dependency in Spring applications.


 

Ads

Tutorials   
Spring 3.2 MVC insert and retrieve blob from the database The hidden tag The errors tag net.roseindia.dao net.roseindia.service net.roseindia.model net.roseindia.controller Spring 3.2 MVC Hibernate Example Spring 3.2 MVC, Upload File in a specific folder Spring 3.2 MVC Form Handling The textarea tag The options tag The option tag The select tag The radiobuttons tag The radiobutton tag The checkboxes tag mvc:default-servlet-handler Static Resources Configuration View Controllers Configuration View resolvers Spring 3.2 MVC Hello World Example Content Negotiation Configuration Interceptors Configuration using Java or XML Customizing the MVC Java config or XML Namespace MVC Java Config or the MVC XML Namespace Servlet container initialization through code Support for ETag The checkbox tag Autogenerated logical view name through RequestToViewNameTranslator Modification in conventional ModelAndView ControllerClassNameHandlerMapping class for handling convention mapping The password tag The input tag The form tag Form Tag library configuration Customizing the Default Error Page @ExceptionHandler & @ResponseStatus annotation Multipart support for file upload in Spring MVC Themes and Theme resolvers in Spring MVC Locales in Spring MVC ContentNegotiatingViewResolver Redirecting and forwarding to views Chaining of Multiple view resolvers View Resolving through ViewResolver interface Requests Intercepting through a HandlerInterceptor Defining handler methods using @RequestMapping annotation Spring 3.2 Asynchronous Request Processing @RequestMapping annotation for mapping requests @Controller annotation for defining new controller
Ads

Spring 3 ASM - Spring asm Dependency

     

In earlier version of Spring (Spring version 2.5) the asm library was included. But the current version of Spring 3 does not contains the asm library. So, you have to download and add the asm library to your project.

In this section you will find the instruction to download and add the asm library into your project.

What is ASM?

The ASM is very small framework that is used to analyze and manipulate Java byte codes. It is used in Spring 3 framework to dynamically modify the Java bytecode and generate the new bye code in runtime. The ASM framework is easy to use and fast. Its performance is good. You can read more about the asm framework at http://asm.ow2.org/. The latest version of asm library can be downloaded from http://asm.ow2.org/download/index.html. If you getting any error in your Spring framework then you can get the latest version of asm library from the asm official website.

If you don't include the asm dependency in your Spring 3 project you might get the following error:

Jan 2, 2010 2:49:26 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh

INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicatio[email protected]:
startup date [Sat Jan 02 14:49:26 IST 2010]; root of context hierarchy

Exception in thread "main" java.lang.IllegalStateException: Cannot load configuration class: net.roseindia.Spring3HelloWorldConfig

at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfiguration
Classes(
ConfigurationClassPostProcessor.java:274)

at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBean
Factory(
ConfigurationClassPostProcessor.java:147)

at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPost
Processors(
AbstractApplicationContext.java:624)

at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactory
PostProcessors(
AbstractApplicationContext.java:614)

at org.springframework.context.support.AbstractApplication
Context.refresh(
AbstractApplicationContext.java:398)

at org.springframework.context.annotation.Annotation
ConfigApplicationContext.<init>(
AnnotationConfigApplicationContext.java:65)

at net.roseindia.Spring3HelloWorldConfigTest.main(Spring3HelloWorldConfigTest.java:9)

Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/Type

at net.sf.cglib.core.TypeUtils.parseType(TypeUtils.java:180)

at net.sf.cglib.core.KeyFactory.<clinit>(KeyFactory.java:66)

at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)

at org.springframework.context.annotation.ConfigurationClass
Enhancer.newEnhancer(
ConfigurationClassEnhancer.java:101)

at org.springframework.context.annotation.Configuration
ClassEnhancer.enhance(
ConfigurationClassEnhancer.java:89)

at org.springframework.context.annotation.Configuration
ClassPostProcessor.enhanceConfigurationClasses(
ConfigurationClassPostProcessor.java:266)

... 6 more

Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.Type

at java.net.URLClassLoader$1.run(Unknown Source)

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

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClassInternal(Unknown Source)

... 12 more

If you are using the maven to for development of your project then following entry can be added to pom.xml


<dependency>
  <groupId>asm</groupId>
  <artifactId>asm-commons</artifactId>
  <version>2.2.3</version>
</dependency>
<dependency>
   <groupId>asm</groupId>
   <artifactId>asm</artifactId>
   <version>2.2.3</version>
</dependency>

The above dependency entry will add include asm library into your project.

Advertisements

Ads
Share on Google+Share on Google+

Spring asm Dependency

Posted on: January 2, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: Spring asm Dependency  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
mukesh
May 2, 2011
Useful

Hi, Good really useful information on Spring asm Dependency. Thanks

Ads

 

Ads