Announcement Announcement Module
Collapse
No announcement yet.
Tiles and Bean configuration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tiles and Bean configuration

    i start to set a layout for my beans... no i fall for new problem,...
    *Dependency Injection

    previously i set a page property, said to use which controller, and in the end told the bean configuration to use which Class for which url, and inject my dependency....

    but now, it start to read tile definition file to find the jsp page... and i think it dont even read my controller...

    but now i start to use tilling and now server generate errors...

    here's my config :
    *tiles.xml
    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE tiles-definitions PUBLIC
            "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
            "http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
    <tiles-definitions>
        <definition name="base.definition"
                    template="/jsp/template/layout_manager.jsp">
            <put-attribute name="header" value="/jsp/header.jsp" />
            <put-attribute name="menu" value="/jsp/menu.jsp" />
            <put-attribute name="body" value="" />
            <put-attribute name="footer" value="/jsp/footer.jsp" />
        </definition>
    
        <definition name="student_proceeds_report" extends="base.definition">
            <put-attribute name="body" value="/jsp/student_proceeds_report.jsp" />
        </definition>
    
    </tiles-definitions>
    *springmvc-servlet.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    
            <import resource="hibernateContext.xml"/>
    
        <bean name="/student_proceeds_report.html" class="com.bedkaco.web.StudentProceedsReport">
            <property name="majorFactory">
                <bean class="com.bedkaco.portlets.major.factories.MajorFactory">
                    <property name="majorDao" ref="majorDao"/>
                </bean>
            </property>
            <property name="groupFactory">
                <bean class="com.bedkaco.portlets.group.factories.GroupFactory">
                    <property name="groupDao" ref="groupDao"/>
                </bean>
            </property>
            <property name="userAccountFactory">
                <bean class="com.bedkaco.portlets.user_account.factories.UserAccountFactory">
                    <property name="userAccountDao" ref="userAccountDao"/>
                </bean>
            </property>
        </bean>
    
        <!-- Resource Bundling -->
        <bean id="messageSource"
              class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
            <property name="basename" value="classpath:messages" />
            <property name="defaultEncoding" value="UTF-8"/>
        </bean>
    
        <bean id="localeChangeInterceptor"
              class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
            <property name="paramName" value="lang" />
        </bean>
    
        <bean id="localeResolver"
              class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
            <property name="defaultLocale" value="fa"/>
        </bean>
    
        <bean id="handlerMapping"
              class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
            <property name="interceptors">
                <ref bean="localeChangeInterceptor" />
            </property>
        </bean>
    
        <!-- Configure view resolver -->
        <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
            <property name="viewClass">
                <value>
                    org.springframework.web.servlet.view.tiles2.TilesView
                </value>
            </property>
        </bean>
    
        <bean id="tilesConfigurer"
              class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
            <property name="definitions">
                <list>
                    <value>/WEB-INF/tiles.xml</value>
                </list>
            </property>
        </bean>
    
    </beans>
    #Error:
    Code:
    HTTP Status 500 -
    
    type Exception report
    
    message
    
    description The server encountered an internal error () that prevented it from fulfilling this request.
    
    exception
    
    javax.servlet.ServletException: Servlet.init() for servlet springmvc threw exception
    	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
    	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    	java.lang.Thread.run(Thread.java:722)
    
    root cause
    
    java.lang.NoClassDefFoundError: org/springframework/beans/PropertyAccessorFactory
    	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:114)
    	javax.servlet.GenericServlet.init(GenericServlet.java:212)
    	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
    	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    	java.lang.Thread.run(Thread.java:722)

  • #2
    Have you actually READ the stacktrace?

    Code:
    java.lang.NoClassDefFoundError: org/springframework/beans/PropertyAccessorFactory
    Include the spring-beans.jar...

    Judging from the stacktrace you are hunting around for jar files yourself, don't... Use Maven, Ant+Ivy or Gradle to manage your dependencies, trying to manage your own nowadays isn't feasible anymore.

    Comment


    • #3
      yea, the mater was i used old jar, once i import more , there was duplicated class, and if i used only one, each of them miss their own classes... but fixed. by 2.6

      Comment

      Working...
      X