spring+ibatis+jetty+mysql 启动时出现异常

spring+ibatis+jetty+mysql 启动时出现异常,不是每次都会有这个问题,启动失败的时候,是可以连网的,大神们知道这是什么问题吗。
启动失败时,用mysql是可以连接上的服务器。

2015-10-29 17:33:54.008:INFO:oejs.Server:jetty-8.1.9.v20130131
2015-10-29 17:33:54.102:INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one.
2015-10-29 17:33:54.441:INFO:/:No Spring WebApplicationInitializer types detected on classpath
2015-10-29 17:33:54.572:INFO:/:Set web app root system property: 'aijiazu.root' = [D:\cxjy\cxjy\code\aijiazu-server\src\main\webapp]
2015-10-29 17:33:54.623:INFO:/:Initializing log4j from [classpath:log4j.properties]
2015-10-29 17:33:54.632:INFO:/:Initializing Spring root WebApplicationContext
2015-10-29 17:35:07,342 [main] ERROR org.springframework.web.context.ContextLoader: 319 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in class path resource [conf/spring-db.xml]: Invocation of init method failed; nested exception is com.ibatis.common.exception.NestedRuntimeException: Error occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.net.ConnectException: Connection timed out: connect
Caused by: java.net.ConnectException: Connection timed out: connect
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.net.ConnectException: Connection timed out: connect
Caused by: java.net.ConnectException: Connection timed out: connect
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:610)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:775)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:767)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:710)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:293)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:172)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.Server.doStart(Server.java:280)
at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:520)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:365)
at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:523)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.net.ConnectException: Connection timed out: connect
Caused by: java.net.ConnectException: Connection timed out: connect
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.net.ConnectException: Connection timed out: connect
Caused by: java.net.ConnectException: Connection timed out: connect
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:81)
at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:62)
at org.springframework.orm.ibatis.SqlMapClientFactoryBean.buildSqlMapClient(SqlMapClientFactoryBean.java:329)
at org.springframework.orm.ibatis.SqlMapClientFactoryBean.afterPropertiesSet(SqlMapClientFactoryBean.java:280)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
... 54 more
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.net.ConnectException: Connection timed out: connect
Caused by: java.net.ConnectException: Connection timed out: connect
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53)
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:78)
... 59 more
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:378)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:473)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:598)

4个回答

sqlmapclient的配置文件有问题,首先,你可能没有配置事务管理,如果你项目中用到了事务,则需要配置一个。
其次,你的数据库配置文件有问题,导致无法创建SqlMapClient类的实例。

检查数据库配置是否正确,另外检查是否正常连接到数据库,连接超时了。

听说随便回答就有分?楼上说得对

数据库是可以连接成功的,这是我的配置文件,配置有问题吗?

<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd">

<!-- DataSource定义 -->
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
    <property name="driverClassName">
        <value>${jdbc_driverClassName}</value>
    </property>
    <property name="url">
        <value>${jdbc_url}</value>
    </property>
    <property name="username">
        <value>${jdbc_username}</value>
    </property>
    <property name="password">
        <value>${jdbc_password}</value>
    </property>
    <!-- 连接属性 -->
    <property name="connectionProperties">
        <value>clientEncoding=UTF-8</value>
    </property>
    <!-- 初始化连接大小 -->
    <property name="initialSize">
        <value>5</value>
    </property>
    <!-- 连接池最大使用连接数 -->
    <property name="maxTotal">
        <value>50</value>
    </property>
    <property name="maxWaitMillis">
        <value>500</value>
    </property>
    <property name="maxIdle">
        <value>5</value>
    </property>
</bean>

<!-- TransactionManager定义 -->
<bean id="transactionManager"
    class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource" />
</bean>

<bean id="transactionTemplate"
    class="org.springframework.transaction.support.TransactionTemplate">
    <property name="transactionManager" ref="transactionManager" />
</bean>

<!-- iBatis SQL map定义 -->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="configLocation" value="classpath:conf/sqlmap-config.xml"/>
</bean>

<!-- JdbcTemplate正是为了减少繁琐的代码而设计出来的。它是对 JDBC 的一种封装 -->
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    <property name="dataSource">
        <ref local="dataSource" />
    </property>
</bean>

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
spring+ibatis+jetty+mysql 启动时出现异常
spring+ibatis+jetty+mysql 启动时出现异常,不是每次都会有这个问题,启动失败的时候,是可以连网的,大神们知道这是什么问题吗。 启动失败时,用mysql是可以连接上的服务器。 2015-10-29 17:33:54.008:INFO:oejs.Server:jetty-8.1.9.v20130131 2015-10-29 17:33:54.102:INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one. 2015-10-29 17:33:54.441:INFO:/:No Spring WebApplicationInitializer types detected on classpath 2015-10-29 17:33:54.572:INFO:/:Set web app root system property: 'aijiazu.root' = [D:\cxjy\cxjy\code\aijiazu-server\src\main\webapp] 2015-10-29 17:33:54.623:INFO:/:Initializing log4j from [classpath:log4j.properties] 2015-10-29 17:33:54.632:INFO:/:Initializing Spring root WebApplicationContext 2015-10-29 17:35:07,342 [main] ERROR org.springframework.web.context.ContextLoader: 319 - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in class path resource [conf/spring-db.xml]: Invocation of init method failed; nested exception is com.ibatis.common.exception.NestedRuntimeException: Error occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.net.ConnectException: Connection timed out: connect Caused by: java.net.ConnectException: Connection timed out: connect Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.net.ConnectException: Connection timed out: connect Caused by: java.net.ConnectException: Connection timed out: connect at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:610) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:775) at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424) at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:767) at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249) at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250) at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:710) at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492) at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:293) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229) at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:172) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) at org.eclipse.jetty.server.Server.doStart(Server.java:280) at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:520) at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:365) at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:523) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) Caused by: com.ibatis.common.exception.NestedRuntimeException: Error occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.net.ConnectException: Connection timed out: connect Caused by: java.net.ConnectException: Connection timed out: connect Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.net.ConnectException: Connection timed out: connect Caused by: java.net.ConnectException: Connection timed out: connect at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:81) at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:62) at org.springframework.orm.ibatis.SqlMapClientFactoryBean.buildSqlMapClient(SqlMapClientFactoryBean.java:329) at org.springframework.orm.ibatis.SqlMapClientFactoryBean.afterPropertiesSet(SqlMapClientFactoryBean.java:280) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479) ... 54 more Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.net.ConnectException: Connection timed out: connect Caused by: java.net.ConnectException: Connection timed out: connect at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53) at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:78) ... 59 more Caused by: java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at java.net.Socket.connect(Socket.java:528) at sun.net.NetworkClient.doConnect(NetworkClient.java:180) at sun.net.www.http.HttpClient.openServer(HttpClient.java:378) at sun.net.www.http.HttpClient.openServer(HttpClient.java:473) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:598)
ruby on rails服务器与springMVC spring ibatis服务器间怎么通信
有两个web服务器: 1.ruby on rails搭建的 2.springMVC spring ibatis搭建的 怎么实现: 请求ruby服务器,然后通过ruby 重定向到java服务器,再然后java服务器将处理完的数据重新发给ruby服务器,最后由ruby将数据响应给浏览器。 望大牛给个详细的方案,谢谢!
spring+ibatis tomcat启动出现get/set方法有关问题
我在spring+ibatis整合是出现了一下问题,希望能得到各个大神的指导 我的spring出错位置配置如下: <bean id="sqlMapClientReader" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocation" value="classpath*:SqlMapConfig.xml"/> <property name="configLocations" value="classpath*:sql/*_sql.xml"/> <property name="dataSource" ref="myDataSourceSlave" /> </bean> 在启动tomcat时报错信息如下: ERROR DispatcherServlet:466 - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClientReader' defined in ServletContext resource [/WEB-INF/spring_readAndWrite_split/spring_dataSource_jdbc.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'configLocations' of bean class [org.springframework.orm.ibatis.SqlMapClientFactoryBean]: Bean property 'configLocations' is not writable or has an invalid setter method. Did you mean 'configLocation'? at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1427) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:589) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138) at javax.servlet.GenericServlet.init(GenericServlet.java:158) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5253) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5543) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1839) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:618) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:565) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1427) at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1265) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1360) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:788) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:303) at sun.rmi.transport.Transport$1.run(Transport.java:159) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:155) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'configLocations' of bean class [org.springframework.orm.ibatis.SqlMapClientFactoryBean]: Bean property 'configLocations' is not writable or has an invalid setter method. Did you mean 'configLocation'? at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1044) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:904) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:57) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1424) ... 62 more 我比较疑惑的是这个属性configLocation是spring框架中org.springframework.orm.ibatis.SqlMapClientFactoryBean这个类的属性,而且这个类中我看也提供了set/get方法,可是为什么会报上边的问题呢 还希望大神们能不吝赐教啊
ibatis执行sql出现异常,logback不输出日志
ibatis执行sql出现异常,logback不输出日志,不出现异常是可以打印出ibatis执行的sql语句的
Spring ibatis事务配置不成功
各位兄弟姐妹帮我看看吧,这个配置事务怎么也不行。 访问地址是:http://localhost:8080/gen/logon.do?method=1 工程直接可以导进eclipse里 spring MVC + ibatis
spring ibatis weblogic 出错
信息: JDBC 3.0 Savepoint class is available AbandonedObjectPool is used (org.apache.commons.dbcp.AbandonedObjectPool@183fc68) LogAbandoned: true RemoveAbandoned: true RemoveAbandonedTimeout: 180 2008-7-26 21:22:48 org.apache.struts.action.RequestProcessor processException 警告: Unhandled Exception thrown: class com.ibatis.sqlmap.client.SqlMapException <2008-7-26 下午09时22分48秒 CST> <Error> <HTTP> <BEA-101017> <[weblogic.servlet.internal.WebAppServletContext@f353e5 - appName: '_appsdir_ibatis_dir', name: 'ibatis', context-path: ''] Root cause of ServletException. com.ibatis.sqlmap.client.SqlMapException: There is no statement named creatUser in this SqlMap. at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:288) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:424) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:81) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:58) at com.ibatis.dao.UserDAOImpl.save(UserDAOImpl.java:14) Truncated. see log file for complete stacktrace
struts+spring +ibatis实现上传功能的代码
求struts+spring +ibatis实现上传功能的代码
asp.net 项目启动ibatis 就报错
![图片说明](https://img-ask.csdn.net/upload/202002/10/1581330564_121432.png) ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581398125_391150.png)![图片说明](https://img-ask.csdn.net/upload/202002/11/1581398132_823631.png) xml sql我都检查没问题,各位大佬这是什么原因引起的
关于struts2 spring ibatis 结合问题
这2天 在学习IBATIS 准备写一个 struts hibernate ibatis 的例子出来 但是一直就没成功 我说一下我的配置步骤,请大家帮我指点一下我哪里错了 1.首先我在WEB.XML文件里 加入 STRUTS2的主控制器 <!-- struts2 主控制器 --> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> 2.然后添加SPRING支持 <!-- 设置Spring框架配置文件路径 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:applicationContext*.xml </param-value> </context-param> <!-- 整合Spring框架 --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> 3.在classpath 下创建 applicationContext.xml 文件 文件内容如下 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>com.mysql.jdbc.Driver</value> </property> <property name="url"> <value>jdbc:mysql://localhost:3306/test</value> </property> <property name="username"> <value>root</value> </property> <property name="password"> <value>root</value> </property> </bean> <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocation"> <value>classpath:SqlMapConfig.xml</value> </property> <property name="dataSource"> <ref local="dataSource" /> </property> </bean> <!-- 配置事务特性 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="find*" propagation="REQUIRED" read-only="true" /> <tx:method name="*" propagation="REQUIRED" /> </tx:attributes> </tx:advice> <!-- 配置那些类的方法进行事务管理 --> <aop:config> <aop:pointcut id="allManagerMethod" expression="execution(* org.fire.inoutstock.service.*.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod" /> </aop:config> </beans> 然后在classpath下创建 sqlmapclient.xml文件 文件内容 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd"> <sqlMapConfig> <sqlMap resource="sqlMap.T_User.xml" /> </sqlMapConfig> 我就这样搭建的, 然后跑的时候出错 错误信息如下 2009-6-30 12:36:33 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in file [D:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\test2\WEB-INF\classes\applicationContext-common.xml]: Invocation of init method failed; nested exception is com.ibatis.common.exception.NestedRuntimeException: Error occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: java.io.IOException: Could not find resource sqlMap.T_User.xml at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1336) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:924) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:887) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: com.ibatis.common.exception.NestedRuntimeException: Error occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: java.io.IOException: Could not find resource sqlMap.T_User.xml at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:81) at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:62) at org.springframework.orm.ibatis.SqlMapClientFactoryBean.buildSqlMapClient(SqlMapClientFactoryBean.java:329) at org.springframework.orm.ibatis.SqlMapClientFactoryBean.afterPropertiesSet(SqlMapClientFactoryBean.java:280) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1367) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1333) ... 39 more Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: java.io.IOException: Could not find resource sqlMap.T_User.xml at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53) at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:78) ... 44 more Caused by: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource sqlMap.T_User.xml Caused by: java.io.IOException: Could not find resource sqlMap.T_User.xml at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:114) at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:75) at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:93) at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:63) at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51) ... 45 more Caused by: java.io.IOException: Could not find resource sqlMap.T_User.xml at com.ibatis.common.resources.Resources.getResourceAsStream(Resources.java:101) at com.ibatis.common.resources.Resources.getResourceAsStream(Resources.java:86) at com.ibatis.common.resources.Resources.getResourceAsReader(Resources.java:150) at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$11.process(SqlMapConfigParser.java:336) at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:112) ... 49 more 2009-6-30 12:36:33 org.apache.catalina.core.StandardContext start 严重: Error listenerStart 2009-6-30 12:36:33 org.apache.catalina.core.StandardContext start 严重: Context [/test2] startup failed due to previous errors 2009-6-30 12:36:33 org.apache.catalina.core.ApplicationContext log 就这样我没成功 我导入的包有 ibatis-common-2.jar ibatis-sqlmap-2.jar ibatis-dao-2.jar 其他的包都和是STRUTS 和SPRING 还有其他的包了 请教大家帮我看看那里有问题 最好能总结一下 struts2 spring ibatis 搭建的步骤和相关的 JAR包 [b]问题补充:[/b] 还有一个问题。。。 就是ibatis 不能用spring 的aop来管理事物吗? 如果能的话要怎样来写?? <!-- 配置事务特性 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="find*" propagation="REQUIRED" read-only="true" /> <tx:method name="*" propagation="REQUIRED" /> </tx:attributes> </tx:advice> 提示创建txAdvice错误 错误信息 Error creating bean with name 'txAdvice': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined 谢谢PURAS 刚才的回答。。
mysql使用ssl协议,如何使用ibatis连接数据库?
使用Spring + ibatis 如何连接 ssl 协议mysql 配置, JDBC链接配置requireSSL=true之后,找不到证书。
spring+iBatis的xml解析问题
使用Spring+iBatis开发,测试是发生如下异常,百思不得其解啊!求高人指点 `Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [sql-map-config.xml]; nested exception is com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 1; 文件提前结束。` 以下是我的代码 **applicationContext.xml:** <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <!-- lob字段配置 --> <bean id="nativeJdbcExtractor" lazy-init="true" class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor" /> <!-- class="org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor" /> --> <bean id="lobHandler" lazy-init="true" class="org.springframework.jdbc.support.lob.OracleLobHandler"> <property name="nativeJdbcExtractor"> <ref bean="nativeJdbcExtractor" /> </property> </bean> <!-- 加载系统数据源配置文件 --> <!-- <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"> <value>org.logicalcobwebs.proxool.ProxoolDriver </value> </property> <property name="url"> <value>proxool.cloud</value> </property> </bean> --> <!-- ******************************************************************** --> <!--WEB-INF/classes/ --> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="jdbc.properties" /> <property name="fileEncoding" value="UTF-8" /> </bean> <bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource"> <!-- <property name="driver"> <value>com.mysql.jdbc.Driver</value> </property> <property name="driverUrl"> <value>jdbc:mysql://localhost/mytest?characterEncoding=utf-8</value> </property> --> <property name="driver"> <value>${jdbc.driver}</value> </property> <property name="driverUrl"> <value>${jdbc.url}</value> </property> <property name="user"> <value>${jdbc.username}</value> </property> <property name="password"> <value>${jdbc.password}</value> </property> <!-- <property name="user"> <value>root</value> </property> <property name="password"> <value>root</value> </property> --> <property name="alias"> <value>wstudy</value> </property> <property name="houseKeepingSleepTime"> <value>60000</value> </property> <property name="prototypeCount"> <value>5</value> </property> <property name="simultaneousBuildThrottle"> <value>20</value> </property> <property name="maximumActiveTime"> <value>60000</value> </property> <property name="houseKeepingTestSql"> <value>select CURRENT_DATE</value> </property> <property name="maximumConnectionCount"> <value>10</value> </property> <property name="minimumConnectionCount"> <value>1</value> </property> <property name="trace"> <value>true</value> </property> <property name="verbose"> <value>true</value> </property> </bean> <!-- *************************************************************************** --> <!-- 事务管理 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource"> <ref bean="dataSource"/> </property> </bean> <!-- 事务通知 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="find*" propagation="REQUIRED" timeout="60" rollback-for="Exception"/> <tx:method name="add*" propagation="REQUIRED" timeout="60" rollback-for="Exception"/> <tx:method name="delete*" propagation="REQUIRED" timeout="60" rollback-for="Exception"/> <tx:method name="modify*" propagation="REQUIRED" timeout="60" rollback-for="Exception"/> <tx:method name="save*" propagation="REQUIRED" timeout="60" rollback-for="Exception"/> <tx:method name="insert*" propagation="REQUIRED" timeout="60" rollback-for="Exception"/> <tx:method name="update*" propagation="REQUIRED" timeout="60" rollback-for="Exception"/> <tx:method name="*" read-only="true" timeout="60"/> </tx:attributes> </tx:advice> <!-- WEB-INF/classes/ --> <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocations" value="sql-map-config.xml" /> <property name="dataSource" ref="dataSource" /> </bean> <bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate"> <property name="sqlMapClient"> <ref bean="sqlMapClient" /> </property> </bean> <bean id="baseDao" class="com.wstudy.core.dao.BaseDaoImpl"> <property name="sqlMapClientTemplate"> <ref bean="sqlMapClientTemplate" /> </property> </bean> <!--将上面的模版类织入到我们的DAO对象中 --> <bean id="studentDao" class="test.ibatis.StudentDao"> <property name="sqlMapClientTemplate"> <ref bean="sqlMapClientTemplate" /> </property> </bean> <bean id="stDao" class="com.wstudy.dao.impl.StudentDaoImpl" parent="baseDao" scope="prototype"> </bean> <!-- <bean id="dbtest" class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSource"> <ref local="dataSource" /> </property> </bean> --> <!-- 小柴的beans开始 --> <!-- 导入其他配置模块 --> <import resource="com/wstudy/questions/service/Question.xml" /> <!-- 导入其他配置模块 --> <import resource="com/wstudy/service/teacher/teacher.xml" /> </beans> **sql-map-config.xml:** <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "http://www.ibatis.com/dtd/sql-map-config-2.dtd"> <sqlMapConfig> <settings cacheModelsEnabled="true" enhancementEnabled="true" lazyLoadingEnabled="true" errorTracingEnabled="true" maxRequests="50" maxSessions="10" maxTransactions="5" useStatementNamespaces="true" /> <!-- <sqlMap resource="com/wstudy/test/AdminUserEntity.xml" /> --> <sqlMap resource="com/wstudy/entity/teacher/TeacherEntity.xml" /> <sqlMap resource="com/wstudy/entity/teacher/EvaluationEntity.xml" /> <sqlMap resource="com/wstudy/entity/teacher/TeacherStarEntity.xml" /> <sqlMap resource="com/wstudy/entity/teacher/QueAnsEntity.xml" /> <sqlMap resource="com/wstudy/entity/teacher/EvaTeacherEntity.xml" /> <sqlMap resource="com/wstudy/core/entity/StudentEntity.xml" /> <sqlMap resource="test/ibatis/Student.xml" /> <sqlMap resource="com/wstudy/questions/entity/ComQuesAnsEntity.xml" /> <sqlMap resource="com/wstudy/questions/entity/ComQuesEntity.xml" /> <sqlMap resource="com/wstudy/questions/entity/TypicalQuesEntity.xml" /> </sqlMapConfig>
spring+ibatis分布式事务异常!!
spring + ibatis框架,使用jotm分布式事务控制,在运行过程中偶尔会出现异常,请高手指点。 spring配置文件: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> <!--指定Spring配置中用到的属性文件 --> <bean id="propertyConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>WEB-INF/config/db/jdbc.properties</value> <value>WEB-INF/config/db/webservice.properties</value> <!-- <value>WEB-INF/config/db/cache.properties</value> --> <!-- 类路径的写法 <value>classpath:com/dhc/epos/demo/conf/jdbc-demo.properties</value> --> </list> </property> <property name="fileEncoding" value="UTF-8" /> </bean> <!-- 分布式事务的配置方式 begin --> <bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean"> <property name="defaultTimeout" value="500000"/> </bean> <bean id="jtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="userTransaction" ref="jotm" /> </bean> <bean id="dataSource" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource" destroy-method="close"> <property name="dataSource"> <bean class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown"> <property name="transactionManager" ref="jotm" /> <property name="driverName" value="${jdbc11.driverName}" /> <property name="url" value="${jdbc11.url}" /> <property name="user" value="${jdbc11.user}" /> <property name="password" value="${jdbc11.password}" /> </bean> </property> <property name="user" value="${jdbc11.user}" /> <property name="password" value="${jdbc11.password}" /> </bean> <bean id="dataSourceBi" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource" destroy-method="close"> <property name="dataSource"> <bean class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown"> <property name="transactionManager" ref="jotm" /> <property name="driverName" value="${jdbc6.driverName}" /> <property name="url" value="${jdbc6.url}" /> <property name="user" value="${jdbc6.user}" /> <property name="password" value="${jdbc6.password}" /> </bean> </property> <property name="user" value="${jdbc6.user}" /> <property name="password" value="${jdbc6.password}" /> </bean> <bean id="dataSourceWms" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource" destroy-method="close"> <property name="dataSource"> <bean class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown"> <property name="transactionManager" ref="jotm" /> <property name="driverName" value="${jdbc6.driverName}" /> <property name="url" value="${jdbc6.url}" /> <property name="user" value="${jdbc6.user}" /> <property name="password" value="${jdbc6.password}" /> </bean> </property> <property name="user" value="${jdbc6.user}" /> <property name="password" value="${jdbc6.password}" /> </bean> <bean id="dataSourceCrm" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource" destroy-method="close"> <property name="dataSource"> <bean class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown"> <property name="transactionManager" ref="jotm" /> <property name="driverName" value="${jdbc6.driverName}" /> <property name="url" value="${jdbc6.url}" /> <property name="user" value="${jdbc6.user}" /> <property name="password" value="${jdbc6.password}" /> </bean> </property> <property name="user" value="${jdbc6.user}" /> <property name="password" value="${jdbc6.password}" /> </bean> <!-- 分布式事务的配置方式 end --> <tx:advice id="txAdvice" transaction-manager="jtaTransactionManager"> <tx:attributes> <tx:method name="get*" read-only="true" /> <tx:method name="find*" read-only="true" /> <tx:method name="exclusive__*" propagation="REQUIRES_NEW" rollback-for="Exception"/> <tx:method name="*" propagation="REQUIRED" rollback-for="Exception" /> </tx:attributes> </tx:advice> <aop:config> <aop:advisor pointcut="execution(* *..as*..*(..))" advice-ref="txAdvice"/> </aop:config> <!-- 与数据库类型无关的序号生成器 end --> <import resource="classpath:com/dhc/sms/*/conf/applicationContext*.xml" /> <import resource="classpath:com/dhc/sms/ifm/*/conf/applicationContext*.xml" /> </beans> 异常信息: exception in ReceiveVipLevelDaoImpl.doInsertVipLevelList; nested exception is org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; --- The error occurred in /com/dhc/sms/webservice/crm/points/dao/ibatis/maps/ifm_vip_level_temp_et.xml. --- The error occurred while executing mapped statement. --- Check the IfmVipLevelTem.insert. --- Check the statement or the result map. --- Cause: java.sql.SQLException: StandardXAConnectionHandle:prepareStatement should not be used outside an EJBServer; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in /com/dhc/sms/webservice/crm/points/dao/ibatis/maps/ifm_vip_level_temp_et.xml. --- The error occurred while executing mapped statement. --- Check the IfmVipLevelTem.insert. --- Check the statement or the result map. --- Cause: java.sql.SQLException: StandardXAConnectionHandle:prepareStatement should not be used outside an EJBServer
ibatis连接mysql时读取配置文件出错如何解决?
错误日志如下: 2010-1-6 22:02:03 com.ibatis.common.logging.jdk14.Jdk14LoggingImpl error 严重: SimpleDataSource: Error while loading properties. Cause: java.lang.ClassNotFoundException: jdbc.driverClass java.lang.ClassNotFoundException: jdbc.driverClass 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) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.ibatis.common.resources.Resources.classForName(Resources.java:265) at com.ibatis.common.resources.Resources.instantiate(Resources.java:281) at com.ibatis.common.jdbc.SimpleDataSource.initialize(SimpleDataSource.java:199) at com.ibatis.common.jdbc.SimpleDataSource.<init>(SimpleDataSource.java:116) at com.ibatis.sqlmap.engine.datasource.SimpleDataSourceFactory.initialize(SimpleDataSourceFactory.java:31) at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$9.process(SqlMapConfigParser.java:347) at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:121) at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:105) at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102) at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102) at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:72) at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51) at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:86) at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63) at com.itcast.IStudentDAOImpl.<clinit>(IStudentDAOImpl.java:17) java.lang.ExceptionInInitializerError Caused by: java.lang.RuntimeException: Error occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/transactionManager/dataSource/end()'. Cause: com.ibatis.sqlmap.client.SqlMapException: Error initializing DataSource. Could not instantiate DataSourceFactory. Cause: java.lang.RuntimeException: SimpleDataSource: Error while loading properties. Cause: java.lang.ClassNotFoundException: jdbc.driverClass at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:89) at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63) at com.itcast.IStudentDAOImpl.<clinit>(IStudentDAOImpl.java:17) Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/transactionManager/dataSource/end()'. Cause: com.ibatis.sqlmap.client.SqlMapException: Error initializing DataSource. Could not instantiate DataSourceFactory. Cause: java.lang.RuntimeException: SimpleDataSource: Error while loading properties. Cause: java.lang.ClassNotFoundException: jdbc.driverClass at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53) at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:86) ... 2 more Caused by: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/transactionManager/dataSource/end()'. Cause: com.ibatis.sqlmap.client.SqlMapException: Error initializing DataSource. Could not instantiate DataSourceFactory. Cause: java.lang.RuntimeException: SimpleDataSource: Error while loading properties. Cause: java.lang.ClassNotFoundException: jdbc.driverClass at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:123) at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:105) at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102) at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102) at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:72) at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51) ... 3 more Caused by: com.ibatis.sqlmap.client.SqlMapException: Error initializing DataSource. Could not instantiate DataSourceFactory. Cause: java.lang.RuntimeException: SimpleDataSource: Error while loading properties. Cause: java.lang.ClassNotFoundException: jdbc.driverClass at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$9.process(SqlMapConfigParser.java:354) at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:121) ... 8 more Caused by: java.lang.RuntimeException: SimpleDataSource: Error while loading properties. Cause: java.lang.ClassNotFoundException: jdbc.driverClass at com.ibatis.common.jdbc.SimpleDataSource.initialize(SimpleDataSource.java:210) at com.ibatis.common.jdbc.SimpleDataSource.<init>(SimpleDataSource.java:116) at com.ibatis.sqlmap.engine.datasource.SimpleDataSourceFactory.initialize(SimpleDataSourceFactory.java:31) at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$9.process(SqlMapConfigParser.java:347) ... 9 more Caused by: java.lang.ClassNotFoundException: jdbc.driverClass 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) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.ibatis.common.resources.Resources.classForName(Resources.java:265) at com.ibatis.common.resources.Resources.instantiate(Resources.java:281) at com.ibatis.common.jdbc.SimpleDataSource.initialize(SimpleDataSource.java:199) ... 12 more Exception in thread "main" ---------------------------------------------------------------------------------------- SqlMapConfig.xml文件内容如下: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd"> <sqlMapConfig> <properties resource="com/itcast/SqlMap.properties" /> <transactionManager type="JDBC"> <dataSource type="SIMPLE"> <property name="JDBC.Driver" value="${jdbc.driverClass}" /> <property name="JDBC.ConnectionURL" value="${jdbc.url}" /> <property name="JDBC.Username" value="${jdbc.user}" /> <property name="JDBC.Password" value="${jdbc.password}" /> </dataSource> </transactionManager> <sqlMap resource="com/itcast/Student.xml"/> </sqlMapConfig> ---------------------------------------------------------------------------------------- SqlMap.properties文件内容如下: driver=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/test username=root password=123456 ------------------------------------------------------ 如果不使用SqlMap.properties文件,而将driver、url、username、password的值直接写入SqlMapConfig.xml文件中,则程序可以正常通过。 请大家帮忙解决如何读取这个SqlMap.properties配置文件问题。
IBATIS像mysql中批量新增问题
这是ibatis sqlmap中的 sql <insert id="updateCredit" parameterClass="com.spci.po.MemberMerchant"> <![CDATA[ insert INTO t_member_credit (ID,MEMBER_ID,TRADE_ID,BALANCE) VALUES (#id#,#memberId#,#tradeId#,#balance#) ON DUPLICATE KEY UPDATE BALANCE=#balance# ]]> </insert> 这是DAO种的执行代码 public void bathInsertObject(final String sql, final List list) { try { //this.getSqlMapClient().startTransaction(); this.getSqlMapClient().startBatch(); for (int i = 0; i < list.size(); i++) { this.insertObject(sql, list.get(i)); } //this.getSqlMapClient().commitTransaction(); //this.getSqlMapClient().endTransaction(); this.getSqlMapClient().executeBatch(); } catch (SQLException e) { logger.error("批量添加错误"+sql,e); } } 目的:为了实现mysql中存在数据就批量新增 不存在就批量更新,上面的sql已经在数据库中执行sql验证可用 结果:通过Ibatis调用后 只新增了一条数据,而不是多条 PS:在执行普通的批量新增时 上面的代码是可用的 请问哪里出错了?如何解决
spring管理ibatis的事务管理后 会关闭自动关闭session么?
iBATIS spring 怎么管理ibatis的session,spring管理ibatis的事务管理后 会关闭自动关闭session么?在spring源码中怎么查看
集成Ibatis与SPRING时,出现NoClassDefFoundError
java.lang.NoClassDefFoundError: Lccb/cddev/framework/persist/ibatis/IBatisPersistenceImpl 引用路径多了个L出来 即便是在配置里删了,启动服务还是会这个报错。
idea启动控制台报错Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl,求助
改了一处xml,启动后一直报Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl,后来把代码还原了还是报同样的错误,求助
struts+spring+ibatis如何让项目同时连接MySQL和Oracle?
项目要同时使用到Oracle和MySQL,说是在applicationContext.xml中配置两个dataSource就行了,但是具体应该怎么啊?
ibatis查出mysql数据库表中某字段为null的数据???怎么写动态sql
例如 select * from test where name is null ![图片说明](https://img-ask.csdn.net/upload/201601/07/1452149980_325021.png) 这条sql 中 IS NULL 报错,不知道ibatis里该怎么写???
struts2+spring+ibatis整合需要哪些jar包
struts2+spring+ibatis整合需要哪些jar包
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私有的数
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
此博客仅为我业余记录文章所用,发布到此,仅供网友阅读参考,如有侵权,请通知我,我会删掉。 补充 有不少读者留言说本文章没有用,因为天气预报直接打开手机就可以收到了,为何要多此一举发送到邮箱呢!!!那我在这里只能说:因为你没用,所以你没用!!! 这里主要介绍的是思路,不是天气预报!不是天气预报!!不是天气预报!!!天气预报只是用于举例。请各位不要再刚了!!! 下面是我会用到的两个场景: 每日下
面试官问我:什么是消息队列?什么场景需要他?用了会出现什么问题?
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸,打败了无数
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观
MyBatis研习录(01)——MyBatis概述与入门
C语言自学完备手册(33篇) Android多分辨率适配框架 JavaWeb核心技术系列教程 HTML5前端开发实战系列教程 MySQL数据库实操教程(35篇图文版) 推翻自己和过往——自定义View系列教程(10篇) 走出思维困境,踏上精进之路——Android开发进阶精华录 讲给Android程序员看的前端系列教程(40集免费视频教程+源码) 版权声明 本文原创作者:谷哥的小弟 作者博客
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip install selenium -i https://pypi.tuna.tsinghua.edu.cn/simple/ 
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
你知道的越多,你不知道的越多 点赞再看,养成习惯 本文 GitHub https://github.com/JavaFamily 已收录,有一线大厂面试点思维导图,也整理了很多我的文档,欢迎Star和完善,大家面试可以参照考点复习,希望我们一起有点东西。 前前言 为啥今天有个前前言呢? 因为你们的丙丙啊,昨天有牌面了哟,直接被微信官方推荐,知乎推荐,也就仅仅是还行吧(心里乐开花)
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca
Python爬虫精简步骤1 获取数据
爬虫的工作分为四步: 1.获取数据。爬虫程序会根据我们提供的网址,向服务器发起请求,然后返回数据。 2.解析数据。爬虫程序会把服务器返回的数据解析成我们能读懂的格式。 3.提取数据。爬虫程序再从中提取出我们需要的数据。 4.储存数据。爬虫程序把这些有用的数据保存起来,便于你日后的使用和分析。 这一篇的内容就是:获取数据。 首先,我们将会利用一个强大的库——requests来获取数据。 在电脑上安装
Python绘图,圣诞树,花,爱心 | Turtle篇
1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle() circle.shape('circle') circle.color('red') circle.speed('fastest') circle.up() square = turtle.Turtle()
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东
破14亿,Python分析我国存在哪些人口危机!
2020年1月17日,国家统计局发布了2019年国民经济报告,报告中指出我国人口突破14亿。 猪哥的朋友圈被14亿人口刷屏,但是很多人并没有看到我国复杂的人口问题:老龄化、男女比例失衡、生育率下降、人口红利下降等。 今天我们就来分析一下我们国家的人口数据吧! 更多有趣分析教程,扫描下方二维码关注vx公号「裸睡的猪」 即可查看! 一、背景 1.人口突破14亿 2020年1月17日,国家统计局发布
web前端javascript+jquery知识点总结
Javascript javascript 在前端网页中占有非常重要的地位,可以用于验证表单,制作特效等功能,它是一种描述语言,也是一种基于对象(Object)和事件驱动并具有安全性的脚本语言 ,语法同java类似,是一种解释性语言,边执行边解释。 JavaScript的组成: ECMAScipt 用于描述: 语法,变量和数据类型,运算符,逻辑控制语句,关键字保留字,对象。 浏览器对象模型(Br
Python实战:抓肺炎疫情实时数据,画2019-nCoV疫情地图
文章目录1. 前言2. 数据下载3. 数据处理4. 数据可视化 1. 前言 今天,群里白垩老师问如何用python画武汉肺炎疫情地图。白垩老师是研究海洋生态与地球生物的学者,国家重点实验室成员,于不惑之年学习python,实为我等学习楷模。先前我并没有关注武汉肺炎的具体数据,也没有画过类似的数据分布图。于是就拿了两个小时,专门研究了一下,遂成此文。 2月6日追记:本文发布后,腾讯的数据源多次变更u
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ......
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!
渗透测试-灰鸽子远控木马
木马概述 灰鸽子( Huigezi),原本该软件适用于公司和家庭管理,其功能十分强大,不但能监视摄像头、键盘记录、监控桌面、文件操作等。还提供了黑客专用功能,如:伪装系统图标、随意更换启动项名称和表述、随意更换端口、运行后自删除、毫无提示安装等,并采用反弹链接这种缺陷设计,使得使用者拥有最高权限,一经破解即无法控制。最终导致被黑客恶意使用。原作者的灰鸽子被定义为是一款集多种控制方式于一体的木马程序
Python:爬取疫情每日数据
前言 有部分同学留言说为什么412,这是因为我代码里全国的cookies需要你自己打开浏览器更新好后替换,而且这个cookies大概只能持续20秒左右! 另外全国卫健委的数据格式一直在变,也有可能会导致爬取失败! 我现在已根据2月14日最新通报稿的格式修正了! 目前每天各大平台,如腾讯、今日头条都会更新疫情每日数据,他们的数据源都是一样的,主要都是通过各地的卫健委官网通报。 为什么已经有大量平台做
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。   再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。   下文是原回答,希望能对你能有所启发。   如果我说,这个世界上人真的分三六九等,
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计
Python新型冠状病毒疫情数据自动爬取+统计+发送报告+数据屏幕(三)发送篇
今天介绍的项目是使用 Itchat 发送统计报告 项目功能设计: 定时爬取疫情数据存入Mysql 进行数据分析制作疫情报告 使用itchat给亲人朋友发送分析报告(本文) 基于Django做数据屏幕 使用Tableau做数据分析 来看看最终效果 目前已经完成,预计2月12日前更新 使用 itchat 发送数据统计报告 itchat 是一个基于 web微信的一个框架,但微信官方并不允
作为程序员的我,大学四年一直自学,全靠这些实用工具和学习网站!
我本人因为高中沉迷于爱情,导致学业荒废,后来高考,毫无疑问进入了一所普普通通的大学,实在惭愧...... 我又是那么好强,现在学历不行,没办法改变的事情了,所以,进入大学开始,我就下定决心,一定要让自己掌握更多的技能,尤其选择了计算机这个行业,一定要多学习技术。 在进入大学学习不久后,我就认清了一个现实:我这个大学的整体教学质量和学习风气,真的一言难尽,懂的人自然知道怎么回事? 怎么办?我该如何更好的提升
粒子群算法求解物流配送路线问题(python)
粒子群算法求解物流配送路线问题(python) 1.查找论文文献 找一篇物流配送路径优化+粒子群算法求解的论文 参考文献:基于混沌粒子群算法的物流配送路径优化 2.了解粒子群算法的原理 讲解通俗易懂,有数学实例的博文:https://blog.csdn.net/daaikuaichuan/article/details/81382794 3.确定编码方式和解码策略 3.1编码方式 物流配送路线的
教你如何编写第一个简单的爬虫
很多人知道爬虫,也很想利用爬虫去爬取自己想要的数据,那么爬虫到底怎么用呢?今天就教大家编写一个简单的爬虫。 下面以爬取笔者的个人博客网站为例获取第一篇文章的标题名称,教大家学会一个简单的爬虫。 第一步:获取页面 #!/usr/bin/python # coding: utf-8 import requests #引入包requests link = "http://www.santostang.
前端JS初级面试题二 (。•ˇ‸ˇ•。)老铁们!快来瞧瞧自己都会了么
1. 传统事件绑定和符合W3C标准的事件绑定有什么区别? 传统事件绑定 &lt;div onclick=""&gt;123&lt;/div&gt; div1.onclick = function(){}; &lt;button onmouseover=""&gt;&lt;/button&gt; 注意: 如果给同一个元素绑定了两次或多次相同类型的事件,那么后面的绑定会覆盖前面的绑定 (不支持DOM事...
相关热词 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数 c#日期精确到分钟 c#自定义异常必须继承 c#查表并返回值 c# 动态 表达式树 c# 监控方法耗时 c# listbox c#chart显示滚动条
立即提问