2

I am using Spring MVC in my building block.

I am getting java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet error when I check in blackboard logs and UI is displaying following error message -

The specified resource was not found, or you do not have permission to access it.

My web.xml config is -

   <servlet>
    <servlet-name>main</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
      <init-param>
        <param-name>debug</param-name>
        <param-value>true</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
      <servlet-name>main</servlet-name>
      <url-pattern>/</url-pattern>
    </servlet-mapping>
   </spring>

My view resolver config is -

   <bean>
    <bean id="primaryViewResolver"
     class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/" />
    <property name="suffix" value=".jsp" />
   </bean>

My permission config in web.xml is -

   <permission type="java.lang.reflect.ReflectPermission" name="suppressAccessChecks" /> 
   <permission type="java.lang.RuntimePermission" name="accessDeclaredMembers" />
   <permission type="java.lang.RuntimePermission" name="createClassLoader" />
   <permission type="java.lang.RuntimePermission" name="setContextClassLoader" />
   <permission type="java.io.FilePermission" name="${java.home}/lib/*" actions="read" />   
Andrei Stefan
  • 51,654
  • 6
  • 98
  • 89

2 Answers2

0

You could include spring-beans and spring-context jars in your library. Also, the necessary jars might be already in your classpath but possibly they are not deployed on tomcat.

gpu3d
  • 1,164
  • 1
  • 10
  • 21
0

Be sure you are putting your JSP at the top level of your Building Block. Most often this error is caused by the dispatcher not being able to fine the jsp to render. If it is not at the top-level, just change your prefix property to point to the appropriate directory ().

Check https://github.com/blackboard/spring-b2-example for a very basic example to start with.