Results 1 to 2 of 2

Thread: Bean creation error

  1. #1
    Join Date
    Oct 2010
    Posts
    1

    Default Bean creation error

    Hi,

    I am using spring MVC and for some reason my DefaultAnnotationHandlerMapping is not been loaded.

    Here is the stack trace:
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.De faultAnnotationHandlerMapping#0' defined in ServletContext resource [/WEB-INF/Dispatcher-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.CannotLoadBeanCl assException: Error loading class [com.ubs.hrit.esearch.shoppingcart.excel.DownloadEm ployeeList] for bean with name 'downloadEmployeeList' defined in null: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: Bad version number in .class file
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:478)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 64)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:217)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:261 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:429)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:729)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:381)
    at org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:3 54)
    at org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:292 )
    at org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:262)
    at org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:126)
    at javax.servlet.GenericServlet.init(GenericServlet.j ava:211)
    at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1105)

    My mapping file contains following implementation


    <bean class="org.springframework.web.servlet.mvc.annotat ion.DefaultAnnotationHandlerMapping"/>

    <bean class="org.springframework.web.servlet.mvc.annotat ion.AnnotationMethodHandlerAdapter"/>

    <bean class="org.springframework.web.servlet.mvc.SimpleC ontrollerHandlerAdapter"/>

    <context:component-scan base-package="com.ubs.hrit.esearch.shoppingcart"/>

    <bean id="viewResolverXslt" class="org.springframework.web.servlet.view.Resour ceBundleViewResolver">
    <property name="basename" value="views" />
    <property name="order" value="0" />
    </bean>

    <bean id="viewResolverJSP" class="org.springframework.web.servlet.view.Intern alResourceViewResolver">
    <property name="viewClass" value="org.springframework.web.servlet.view.JstlVi ew" />
    </bean>

    <bean id="passthroughController" class="com.ubs.hrit.esearch.utility.PassThroughCon troller">
    <property name="rootPath"><value>/WEB-INF/jsp</value></property>
    </bean>

    <bean id="testPageController" class="com.ubs.hrit.esearch.utility.TestPageContro ller">
    <property name="rootPath"><value>/WEB-INF/jsp</value></property>
    <property name="connector"><ref bean="solrConnector"/></property>
    </bean>

    <bean id="schema" class="com.ubs.hrit.esearch.schema.Schema">
    <property name="configurationFile"><value>schemaFields.prope rties</value></property>
    </bean>

    <bean id="referenceData" class="java.util.HashMap" />

    <bean id="urlMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="mappings">
    <props>
    <prop key="/searchresult.htm">passthroughController</prop>
    <prop key="/info.htm">passthroughController</prop>
    <prop key="/test.xml">passthroughController</prop>
    <prop key="/panel_render.xml">passthroughController</prop>
    <prop key="/index.htm">searchForm</prop>
    <prop key="/faq.htm">passthroughController</prop>
    <prop key="/usersguide.htm">passthroughController</prop>
    <prop key="/hri_info.htm">passthroughController</prop>
    <prop key="/hri_info.htm">passthroughController</prop>
    <prop key="/test.htm">testPageController</prop>
    <prop key="/employeesuccess.htm">passthroughController</prop>
    <!-- prop key="/employeeaction.htm">employeeShoppingCartForm</prop>
    <prop key="/emloyeelistview.htm">employeeShoppingCartList</prop -->
    </props>
    </property>
    </bean>

    <bean id="employeeShoppingCartList" class="com.ubs.hrit.esearch.shoppingcart.ViewSaved Employees"/>

    <bean id="solrConnector" class="com.ubs.hrit.esearch.connector.solr.SolrCon nector">
    <property name="hostAndPort"><value>localhost:8080</value></property>
    <property name="appRoot"><value>solr-grw</value></property>
    <property name="schema"><ref bean="schema"/></property>
    </bean>

    <bean id="searchForm" class="com.ubs.hrit.esearch.searchform.SearchForm" >
    <property name="sessionForm"><value>true</value></property>
    <property name="commandName"><value>searchEmployee</value></property>
    <property name="commandClass"><value>com.ubs.hrit.esearch.se archform.SearchCriteria</value></property>
    <property name="formView"><value>/WEB-INF/jsp/index2.jsp</value></property>
    <property name="successView"><value>searchresult.htm</value></property>
    <property name="connector"><ref bean="solrConnector"/></property>
    </bean>

  2. #2

    Default

    It seems you are compiling your code in previous version of JDK and running in future version of JDK. You have two options:
    1) Either you use same version of JDK to run the code.
    2) Or while compiling change compliance of your project to be the same.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •