小编djo*_*shi的帖子

找不到类[org.apache.commons.dbcp.BasicDataSource]

我试图启动我的Spring MVC hibernate应用程序时遇到此异常.

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.commons.dbcp.BasicDataSource] for bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/spring/appServlet/mysql_persistence_info.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1235)
Run Code Online (Sandbox Code Playgroud)

我的/WEB-INF/spring/appServlet/mysql_persistence_info.xml是

  <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">

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url" value="jdbc:mysql://localhost/MyrDB"/>
    <property name="username" value="user"/>
    <property name="password" value="user"/>
    <!-- connection pooling details -->
    <property name="initialSize" value="1"/>
    <property name="maxActive" value="5"/>
    </bean>
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="hibernateProperties">
    <props>
    <prop …
Run Code Online (Sandbox Code Playgroud)

hibernate spring-mvc sts-springsourcetoolsuite

14
推荐指数
1
解决办法
3万
查看次数

与<form:form commandName ="xy"的Spring注释关系

我是Spring annotation和MVC的新手.我的第一页是home.jsp,现在它没有在Tomcat服务器中出现我在控制台的末尾显示错误.我试图创建一个非常简单的注释应用程序.这是控制器.

import javax.validation.Valid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller

    //@RequestMapping()
    public class UserLoginController {

    public UserLoginController(){

    }
        //@RequestMapping(value="/get" , method = RequestMethod.GET)
    //@ModelAttribute("user")
        public String get(final ModelMap model) {

            User userForm = new User();
      model.addAttribute("userLogin", userForm);
       return "form";
        }

        @RequestMapping(value="/home.jsp", method = RequestMethod.POST)
        public String post(Model model) {

           String test=" inside here";

            return "success";
        }
    }
Run Code Online (Sandbox Code Playgroud)

这是JSP

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib …
Run Code Online (Sandbox Code Playgroud)

spring-mvc

5
推荐指数
1
解决办法
5万
查看次数

iTextSharp PDF和Firefox出现损坏的内容错误:不适用于Firefox 10.xx

我有一个动态的PDF表单,该表单已填充并展平。此PDF可以工作,并且可以在任何版本的IE上正确显示。使用Firefox时,出现以下错误:

损坏的内容错误

由于检测到数据传输错误,因此无法显示您要查看的页面。

由于检测到数据传输错误,因此无法显示您要查看的页面。请与网站所有者联系,以告知他们该问题。

任何人都可以在不破坏我的功能性IE PDF代码的情况下帮助我解决为什么出现此错误以及需要解决的问题。

.net pdf firefox itextsharp

2
推荐指数
1
解决办法
2212
查看次数