HDC調試需求開發(15萬預算),能者速來!>>>
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
配置:
可是
項目是有的 tomcat部署的項目 lib下面也是有的 有點不能理解 求教 來源:開源中國
發布時間:2016-09-19 20:02:00
HDC調試需求開發(15萬預算),能者速來!>>> 一般在運行壓力較大的時候,會有鏈接被耗盡的現象,網上一查發現它的實現機制引起的,不知道哪個版本是否修復了
來源:開源中國
發布時間:2016-07-20 09:17:00
HDC調試需求開發(15萬預算),能者速來!>>> Spring中 通過 在applicationContext.xml文件中 引入db.properties.xml外部屬性文件來鏈接數據庫 < context :property-placeholder location ="classpath:db.properties" />
db.properties.xml文件內容如下: user = root password = 123456 driverClass = com.mysql.cj.jdbc.Driver jdbcUrl = jdbc:mysql://shop?autoReconnect=true&useSSL=false
配置bean時,用"${user}", "${password}" ,"${driverClass}"來獲取屬性值,
但是在運行時,發現c3p0不能鏈接數據庫,debug發現在獲取user屬性值時出錯,而其他的屬性值是正確的
< property name ="user" value ="${user}" /> 只有這里獲取的值是錯誤的 < property name ="password" value ="${password}" /> < property name ="driverClass" value ="${driverClass}" /> < property name ="jdbcUrl" value ="${jdbcUrl}" />
如果不使用外部屬性文件配置,直接寫成
< property name ="user" value ="root" /> 時,c3p0是可以鏈接到mysql上的
有人遇到過同樣的問題嗎?
來源:開源中國
發布時間:2016-07-15 23:58:00
HDC調試需求開發(15萬預算),能者速來!>>>
C3P0中ComboPooledDataSource的getConnection是線程安全的嗎
以下這段代碼的synchronized是不是沒有必要?
// 獲取連接,里面的dataSource是ComboPooledDataSource的實例 public synchronized Connection getConnection(){ try { return dataSource.getConnection(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
來源:開源中國
發布時間:2016-06-28 10:34:05
HDC調試需求開發(15萬預算),能者速來!>>> 2011-5-11 16:28:15 com.mchange.v2.resourcepool.BasicResourcePool removeResource INFO: A checked-out resource is overdue, and will be destroyed: com.mchange.v2.c3p0.impl.NewPooledConnection@153f5e2 2011-5-11 16:28:15 com.mchange.v2.resourcepool.BasicResourcePool removeResource INFO: Logging the stack trace by which the overdue resource was checked-out. java.lang.Exception: DEBUG ONLY: Overdue resource check-out stack trace. at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:543) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:681) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:608) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128) ------------------------------------- 以下配置文件 c3p0.minPoolSize=3 c3p0.maxPoolSize=50 c3p0.testConnectionOnCheckout=true #c3p0.testConnectionOnCheckin=true #c3p0.checkoutTimeout=2000 #c3p0.idleConnectionTestPeriod=5 c3p0.maxConnectionAge=10 #c3p0.maxIdleTime=2 #c3p0.maxIdleTimeExcessConnections=1 #c3p0.propertyCycle=1 #c3p0.numHelperThreads=10 c3p0.unreturnedConnectionTimeout=15 c3p0.debugUnreturnedConnectionStackTraces=true c3p0.maxStatements=50 c3p0.maxStatementsPerConnection=5
我檢查過,好像沒有連接沒被關掉...
來源:開源中國
發布時間:2011-05-11 16:35:00
HDC調試需求開發(15萬預算),能者速來!>>>
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/xx?serverTimezone=utc&characterEncoding=utf8&useUnicode=true&useSSL=false
spring.datasource.username=xxx
spring.datasource.password=xxx
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.initialSize=5
spring.datasource.minIdle=5
spring.datasource.maxActive=20
spring.datasource.maxWait=60000
spring.datasource.filters=stat,wall
spring.datasource.timeBetweenEvictionRunsMillis=60000
spring.datasource.minEvictableIdleTimeMillis=300000
spring.datasource.validationQuery=select 'x'
spring.datasource.testWhileIdle=true
spring.datasource.testOnBorrow=false
spring.datasource.testOnReturn=false
spring.datasource.poolPreparedStatements=true
spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
spring.druidLoginName=admin
spring.druidPassword=admin
@Bean
public SqlSessionFactoryBean sqlSessionFactory(DruidDataSource datasource){
SqlSessionFactoryBean bean=new SqlSessionFactoryBean();
datasource.setInitialSize(initialSize);
datasource.setMinIdle(minIdle);
datasource.setMaxActive(maxActive);
datasource.setMaxWait(maxWait);
datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
datasource.setValidationQuery(validationQuery);
datasource.setTestWhileIdle(testWhileIdle);
datasource.setTestOnBorrow(testOnBorrow);
datasource.setTestOnReturn(testOnReturn);
datasource.setPoolPreparedStatements(poolPreparedStatements);
datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
try {
datasource.setFilters(filters);
} catch (SQLException e) {
e.printStackTrace();
}
datasource.setConnectionProperties(connectionProperties);
bean.setDataSource(datasource);
return bean;
}
@Bean
public SqlSessionTemplate sqlSession(SqlSessionFactoryBean sqlSessionFactory){
SqlSessionTemplate bean=null;
try {
bean = new SqlSessionTemplate(sqlSessionFactory.getObject());
} catch (Exception e) {
e.printStackTrace();
}
return bean;
}
報錯如下:
[2019-03-16 17:14:38] ERROR org.springframework.boot.SpringApplication - Application run failed
java.util.ConcurrentModificationException: null
at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:719)
at java.util.LinkedHashMap$LinkedKeyIterator.next(LinkedHashMap.java:742)
at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:810)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
at net.hb.xuelebaoapp.config.MainApplication.main(MainApplication.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
[2019-03-16 17:14:38] INFO org.apache.catalina.loader.WebappClassLoaderBase - Illegal access: this web application instance has been stopped already. Could not load [com.mysql.jdbc.MySQLConnection]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [com.mysql.jdbc.MySQLConnection]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1363)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1351)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:820)
at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.findClassIgnoringNotFound(TomcatEmbeddedWebappClassLoader.java:121)
at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.doLoadClass(TomcatEmbeddedWebappClassLoader.java:86)
at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.loadClass(TomcatEmbeddedWebappClassLoader.java:68)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1173)
at com.alibaba.druid.util.Utils.loadClass(Utils.java:220)
at com.alibaba.druid.pool.vendor.MySqlValidConnectionChecker.(MySqlValidConnectionChecker.java:50)
at com.alibaba.druid.pool.DruidDataSource.initValidConnectionChecker(DruidDataSource.java:1231)
at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:885)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1300)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1296)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:109)
at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:157)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78)
at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:82)
at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:68)
at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:338)
at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:84)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:108)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy96.query(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:136)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
at com.sun.proxy.$Proxy93.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:222)
at net.hb.xuelebaoapp.system.dao.impl.FredaDaoImpl.queryForList(FredaDaoImpl.java:105)
at net.hb.xuelebaoapp.manager.sys.service.impl.ParamServiceImpl.list(ParamServiceImpl.java:41)
at net.hb.xuelebaoapp.system.listener.SystemInitListener$launchSPMonitor.run(SystemInitListener.java:82)
at java.lang.Thread.run(Thread.java:748)
[2019-03-16 17:14:39] INFO com.alibaba.druid.pool.DruidDataSource - {dataSource-1} inited
[2019-03-16 17:14:39] INFO com.alibaba.druid.pool.DruidDataSource - {dataSource-1} closed
通過換mysql驅動包和druid驅動包版本,試了都不行
來源:開源中國
發布時間:2019-03-16 17:18:00
HDC調試需求開發(15萬預算),能者速來!>>>
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.dao.mapper.user.UserInfoMapper.checkEmail
來源:開源中國
發布時間:2018-11-28 17:28:00
HDC調試需求開發(15萬預算),能者速來!>>>
maven包含spring boot子模塊的一個項目, 項目本身是可以運行, 并且功能都可以實現 , 現在要對項目進行打包處理, 在install到dao模塊的時候,
Running com.xiao.DaoAeriesTest的時候卻拋出了
com.ibatis.sqlmap.client.SqlMapException: There is no statement named MemberRightsMapper.select in this SqlMap.
如果直接跑test的話是可以跑得通的,使用的是spring-orm-3.0.5,下面是sqlMapClient的配置
conf/SqlMapConfig.xml classpath*:com/xiao/**/*SQL.xml
另外我的SQL.xml文件是在pojo模塊中的,因為放入dao模塊中的話,本地啟動就會拋出
There is no statement named XXX in this SqlMap.這個異常,install也是一樣的.
現在把test模塊去掉之后可以打包成功,
但是在使用java -jar XXX.jar啟動spring boot打成的包后 ,調用的dao層的方法,控制臺又會直接拋出這個異常
org.springframework.data.redis.RedisSystemException: Unknown jedis exception; nested exception is com.ibatis.sqlmap.client.SqlMapException: There is no statement named ACTIVITY.selectAvailableActivities in this SqlMap.
at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:58)
at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:37)
at org.springframework.data.redis.connection.jedis.JedisConverters.toDataAccessException(JedisConverters.java:117)
at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.translateExceptionIfPossible(JedisConnectionFactory.java:156)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:153)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
at com.miyun.biz.activity.dao.ibatis.ActivityDAOImpl$$EnhancerBySpringCGLIB$$5b37250d.selectAvailableActivities(
)
at com.miyun.biz.activity.manager.impl.ActivityManagerImpl.selectAvailableJoinActivities(ActivityManagerImpl.java:168)
at com.miyun.biz.activity.manager.impl.ActivityManagerImpl.join(ActivityManagerImpl.java:331)
at com.jinju.demojms.Receive.joinActivity(Receive.java:194)
at com.jinju.demojms.Receive.joinInvsetActivity(Receive.java:67)
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.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:181)
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:114)
at org.springframework.amqp.rabbit.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:51)
at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:182)
at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:120)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1414)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1337)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1324)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1303)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:817)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:801)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$700(SimpleMessageListenerContainer.java:77)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1042)
at java.lang.Thread.run(Unknown Source)
Caused by: com.ibatis.sqlmap.client.SqlMapException: There is no statement named ACTIVITY.selectAvailableActivities in this SqlMap.
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:231)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:558)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:295)
at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:1)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:200)
at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:293)
at com.miyun.biz.activity.dao.ibatis.ActivityDAOImpl.selectAvailableActivities(ActivityDAOImpl.java:67)
at com.miyun.biz.activity.dao.ibatis.ActivityDAOImpl$$FastClassBySpringCGLIB$$f4e9b4c6.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
... 25 more
懷疑和install dao模塊時拋出的異常是一個原理, 兩天了 都沒解決 來源:開源中國
發布時間:2018-08-01 11:09:00
HDC調試需求開發(15萬預算),能者速來!>>>
這個sql有個語法錯誤 ,大佬幫忙看看 看了一下午沒看出來
來源:開源中國
發布時間:2018-06-29 19:08:00
HDC調試需求開發(15萬預算),能者速來!>>>
我們知道,通過如下配置可以啟用下劃線與駝峰式命名規則的映射(如first_name => firstName)
這個配置在執行查詢的操作的時候很好用,可以將數據庫中下劃線命名的字段直接對應到JavaBean中的駝峰命名的參數里。
但是執行insert操作的時候問題來了,我傳入的是JavaBean對象,這個時候無法將駝峰命名的參數自動轉成帶下劃線的( 大概是因為不知道往哪兒加下劃線 )。
比如,我預期是寫成這樣: INSERT INTO user_info ( user_id, user_name ) VALUES ( #{user_id}, #{user_name}, )
但是,這樣會報錯There is no getter for property named 'user_id' in 'class com.dx.User',因為我JavaBean中的參數名分別是userId和userName,所以我必須寫成下面這樣: INSERT INTO user_info ( user_id, user_name ) VALUES ( #{userId}, #{userName}, )
但是下面這種字段名不一致寫法會讓我很難受,這里該怎么操作才能實現我的預期寫法呢?
來源:開源中國
發布時間:2018-04-17 16:06:00
HDC調試需求開發(15萬預算),能者速來!>>>
就是在UserBasicInfo這個實體類里面加了個擴展屬性,跟表不想關的,結果ibatis就報這個操蛋的問題,咋整都沒用。然后又試了下,換了個另外的實體類加一個屬性,還是報這樣的錯誤,不過ClassNotFoundException報的又是另外那個實體類,我就納悶了個去了。ibatis配置文件和別的什么的都沒改動,就是改個實體類多加個屬性,跟ibatis也不想關吧,為啥會報這樣的問題,哪位哥哥姐姐知道?
來源:開源中國
發布時間:2017-04-14 18:24:00
HDC調試需求開發(15萬預算),能者速來!>>> 公司著手搭建一套有關金融業務的產品框架,現在流行的 S pring, struts2 , webwork 、 jsf 、 Tapestry 、 easyjweb、 H ibernate, ibatis , jpa、 J sp, jsp tag , jquery , extjs , yui , prototype等等技術框架用哪些比較好?并給點理由,在此先謝謝各位了。
來源:開源中國
發布時間:2011-12-08 18:58:00
HDC調試需求開發(15萬預算),能者速來!>>>
Junit測試成功,注入成功。
但是啟動應用后,注入的實體報空指針異常。
請問這種問題是什么原因呢,謝謝。
三個配置類分別如下
一、WebInit 類 import com.lotus.api.RootConfig; import com.lotus.api.WebConfig; import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; import org.springframework.web.util.Log4jConfigListener; import javax.servlet.Filter; import javax.servlet.ServletContext; import javax.servlet.ServletRegistration; public class WebInit extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Class>[] getRootConfigClasses() { return new Class[]{RootConfig.class}; } @Override protected Class>[] getServletConfigClasses() { return new Class[]{WebConfig.class}; } @Override protected String[] getServletMappings() { return new String[]{"/"}; } @Override protected Filter[] getServletFilters() { //字符集攔截器 CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter(); characterEncodingFilter.setEncoding("UTF-8"); characterEncodingFilter.setForceEncoding(true); return new Filter[]{characterEncodingFilter}; } @Override protected void registerContextLoaderListener(ServletContext servletContext) { servletContext.setInitParameter("log4jConfigLocation" , "classpath:log4j.properties"); servletContext.addListener(Log4jConfigListener.class); } @Override protected void customizeRegistration(ServletRegistration.Dynamic registration) { registration.setInitParameter("throwExceptionIfNoHandlerFound", "true"); } }
二、WebConfig package com.lotus.api; import com.lotus.api.interceptor.SecretInterceptor; import com.lotus.service.ServiceNativeConfig; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @Configuration @EnableWebMvc @ComponentScan("com.lotus.api.web") public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new SecretInterceptor()).addPathPatterns("/**"); } }
三、RootConfig package com.lotus.api; import com.lotus.service.ServiceNativeConfig; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.FilterType; import org.springframework.context.annotation.Import; import org.springframework.web.servlet.config.annotation.EnableWebMvc; @Configuration @ComponentScan(basePackages = {"com.lotus.api"}, excludeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION, value = EnableWebMvc.class)}) @Import(ServiceNativeConfig.class) public class RootConfig { }
使用Junit測試的代碼如下: import com.lotus.api.RootConfig; import com.lotus.service.attachment.AttachmentService; import com.lotus.service.content.ContentService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {RootConfig.class}) public class WebTest { @Autowired private AttachmentService attachmentService; @Autowired private ContentService contentService; @Test public void test(){ attachmentService.add(); System.out.println("SECCESS"); System.out.println(contentService); }
來源:開源中國
發布時間:2017-10-14 21:57:00
HDC調試需求開發(15萬預算),能者速來!>>>
用junit4進行單元測試一直報錯,我快瘋啦,跪求指導~~~~
2017-06-07-16-37-29 [INFO] [main] [XmlBeanDefinitionReader_316] - Loading XML bean definitions from class path resource [applicationContext.xml]
2017-06-07-16-37-29 [INFO] [main] [XmlBeanDefinitionReader_316] - Loading XML bean definitions from class path resource [spring-mvc.xml]
2017-06-07-16-37-29 [INFO] [main] [XmlBeanDefinitionReader_316] - Loading XML bean definitions from class path resource [spring-database.xml]
2017-06-07-16-37-29 [INFO] [main] [XmlBeanDefinitionReader_316] - Loading XML bean definitions from class path resource [spring-aop.xml]
2017-06-07-16-37-29 [INFO] [main] [XmlBeanDefinitionReader_316] - Loading XML bean definitions from class path resource [spring-redis.xml]
2017-06-07-16-37-29 [INFO] [main] [GenericApplicationContext_524] - Refreshing org.springframework.context.support.GenericApplicationContext@1bd0dd4: startup date [Wed Jun 07 16:37:29 CST 2017]; root of context hierarchy
2017-06-07-16-37-30 [INFO] [main] [PropertyPlaceholderConfigurer_172] - Loading properties file from class path resource [config.properties]
2017-06-07-16-37-30 [INFO] [main] [DruidDataSource_652] - {dataSource-1} inited
2017-06-07-16-37-35 [INFO] [main] [DefaultListableBeanFactory_452] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@e61a35: defining beans [org.springframework.context.annotation.internalAsyncAnnotationProcessor,org.springframework.context.annotation.internalScheduledAnnotationProcessor,mewTaskAPI,cashJob,timedTaskJob,FCashLogServiceImpl,FUserServiceImpl,FUserTaskServiceImpl,FUserTaskStepsServiceImpl,JZCatService,taskServiceImpl,timedTaskServiceImpl,apiController,frontController,kindEditorController,timedTaskController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,propertyConfigurer,org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0,org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0,org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,mvcContentNegotiationManager,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0,org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0,org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0,multipartResolver,freemarkerConfig,fmXmlEscape,freemakerViewResolver,dataSource,druid-stat-interceptor,druid-stat-pointcut,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,sqlSessionFactory,sqlSession,org.mybatis.spring.mapper.MapperScannerConfigurer#0,transactionManager,serviceOperation,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#1,txAdvice,poolConfig,connectionFactory,redisTemplate,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor,BShopMapper,FAccountMapper,FCashLogMapper,FUserImgsMapper,FUserMapper,FUserTaskMapper,FUserTaskStepsMapper,taskMapper,taskStepsMapper,timedTaskMapper]; root of factory hierarchy
2017-06-07-16-37-35 [INFO] [main] [DruidDataSource_1316] - {dataSource-1} closed
2017-06-07-16-37-35 [ERROR] [main] [TestContextManager_314] - Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@ad483] to prepare test instance [cn.com.l9e.zwk.zwkInterface.TestTimed@10613aa]
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99)
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:122)
at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:108)
at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:75)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:312)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:209)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:286)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:288)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:229)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:86)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:172)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'timedTaskJob': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: cn.com.l9e.zwk.service.TimedTaskService cn.com.l9e.zwk.job.TimedTaskJob.timedTaskService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'timedTaskServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.com.l9e.zwk.dao.TimedTaskMapper cn.com.l9e.zwk.service.impl.TimedTaskServiceImpl.timedTaskMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [cn.com.l9e.zwk.dao.TimedTaskMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'BShopMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\BShopMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FAccountMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\FAccountMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FCashLogMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\FCashLogMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FUserImgsMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\FUserImgsMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FUserMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\FUserMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FUserTaskMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\FUserTaskMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FUserTaskStepsMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\FUserTaskStepsMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taskMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\TaskMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taskStepsMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\TaskStepsMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'timedTaskMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\TimedTaskMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'BShopMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\BShopMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FAccountMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\FAccountMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FCashLogMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\FCashLogMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FUserImgsMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\FUserImgsMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FUserMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\FUserMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FUserTaskMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\FUserTaskMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FUserTaskStepsMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\FUserTaskStepsMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taskMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\TaskMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taskStepsMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\TaskStepsMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'timedTaskMapper' defined in file [E:\java_workspace\zwk\target\classes\cn\com\l9e\zwk\dao\TimedTaskMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-database.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'java.util.String'. Cause: java.lang.ClassNotFoundException: Cannot find class: java.util.String
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:291)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1139)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:644)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:493)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:121)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:100)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:250)
at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContextInternal(CacheAwareContextLoaderDelegate.java:64)
at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:91)
... 25 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: cn.com.l9e.zwk.service.TimedTaskService cn.com.l9e.zwk.job.TimedTaskJob.timedTaskService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'timedTaskServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.com.l9e.zwk.dao.TimedTaskMapper cn.com.l9e.zwk.service.impl.TimedTaskServiceImpl.timedTaskMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [cn.com.l9e.zwk.dao.TimedTaskMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
... 41 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'timedTaskServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.com.l9e.zwk.dao.TimedTaskMapper cn.com.l9e.zwk.service.impl.TimedTaskServiceImpl.timedTaskMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [cn.com.l9e.zwk.dao.TimedTaskMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:291)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1139)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:931)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:874)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:789)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489)
... 43 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.com.l9e.zwk.dao.TimedTaskMapper cn.com.l9e.zwk.service.impl.TimedTaskServiceImpl.timedTaskMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [cn.com.l9e.zwk.dao.TimedTaskMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
... 54 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [cn.com.l9e.zwk.dao.TimedTaskMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1009)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:877)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:789)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489)
... 56 more
來源:開源中國
發布時間:2017-06-07 16:42:00
HDC調試需求開發(15萬預算),能者速來!>>>
這兩天因為需求做一個數據采集的工具,之前也針對一些網站做過一些類似的東西,雖然過程上嗑嗑絆絆,但最后都達到了效果。
因為算不上經驗豐富,這回遇到的麻煩讓我比較困惑。
大概需要抓取二十多萬數據,數據源網站服務器用的是IIS7,.net平臺,請求大概一千到兩千次左右,IP會被禁止,服務器直接返回503,采集中斷,封禁時間大概為12個小時。
我采集的速度并不快,嘗試過多種暫緩方式。每抓取10條停頓3s/5s/10s,或100條停頓30s/60s,或200條停頓300s/600s,后來發現無論如何去設置間隔時間都是徒勞,我每一次重啟路由器開始抓取數量不會超過2000條,就會被服務器拒絕,直接返回503,然后封禁12個小時左右。
為此,我嘗試使用代理來完成我的工作,做一個代理控制器,然后google百度的可用代理服務器ip地址列表,這些地址質量慘不忍睹,少有可以正常工作的服務器,以非常緩慢的速度響應,這顯然不能為我所用,只好棄之,再尋它法。
由于我是使用遠程服務器24小時開機來做數據抓取,所以并不能像adsl重啟路由來獲得新的ip地址,目前服務器IP剛被解封。即使使用adsl線路依靠重啟路由的方式來完成數據抓取,20萬的量也足夠讓我困擾了,除非再寫一個定時重啟路由的程序,這意味著我隨時準備斷網,想著都痛苦。
有哪位朋友研究過iis/asp.net/iis插件來限制客戶端ip請求次數的原理的?希望能繞過去。
或者,能否偽造http請求的IP?這都比較靠近底層的協議了,小弟對這些目前白紙一張,懇請指教。
每個ip在一天內限制不到2000次,20余萬的數據,買代理服務器可否現實?有賣的不?
來源:開源中國
發布時間:2013-01-03 01:30:00
HDC調試需求開發(15萬預算),能者速來!>>>
需求:C#實現在本地IIS上搭建一個FTP站點,并啟動該站點
問題:網上很多關于C#操作IIS創建web站點的例子,其中提到可用該方法創建FTP,嘗試后發現網上說的路徑找不到,代碼如下:
DirectoryEntry Services = new DirectoryEntry("IIS://localhost/MSFTPSVC");
foreach (DirectoryEntry server in Services.Children)
{
//MessageBox.Show(server.SchemaClassName);
}
異常:第二行就提示異常信息:系統找不到指定的路徑。
參考的鏈接如下: https://www.cnblogs.com/chenkai/archive/2010/07/26/1785074.html
來源:開源中國
發布時間:2020-02-22 14:36:00
HDC調試需求開發(15萬預算),能者速來!>>> 應用程序池“###”將被自動禁用,原因是為此應用程序池提供服務的進程中出現一系列錯誤,來源是WAS,事件是5002
來源:開源中國
發布時間:2016-08-27 11:35:00
HDC調試需求開發(15萬預算),能者速來!>>>
我單位內部系統,用戶5000多人,平時在線600+
經查需要上班期間臨時更新補丁,每次重啟IIS都要10分鐘左右,期間要提前發通知。
能否設置訪問網站超過2-3秒無法打開系統時,自動跳轉到提示系統正在自動更新的網頁,其他時間正常訪問
IIS上有沒有相關功能或者其他的變通方法
謝謝,大俠們
來源:開源中國
發布時間:2019-05-16 15:40:09
HDC調試需求開發(15萬預算),能者速來!>>>
IIS 8.0 上配置對 Analysis Services 的 HTTP 訪問 出錯,出現以下錯誤,百度谷歌沒有找到任何的解決辦法。
求問各路大神,有沒有碰到過,或者是知道哪里出現問題的。 紅包感謝?。。?!
來源:開源中國
發布時間:2019-05-11 16:13:00
HDC調試需求開發(15萬預算),能者速來!>>>
公司有一個幾百兆的外網ip,然后原有項目都是用iis發布的,只有一個80端口對外,我不得不用iis做反向代理,轉發到我自己的tomcat服務上面去,現在是轉發成功了,但是配置https 我有點迷茫了。我是在哪配https了?是轉發的iis上面配置,還是在內網的tomcat上面配置了?頭好痛....沒辦法公司不想在買外網ip了。
來源:開源中國
發布時間:2018-12-25 15:02:00
HDC調試需求開發(15萬預算),能者速來!>>> Hangfire可以實現按秒級來執行任務嗎?如果不可以,在web項目中怎么實現定時按秒來執行?
來源:開源中國
發布時間:2017-01-13 09:32:00
HDC調試需求開發(15萬預算),能者速來!>>>
我沒在線上實際部署過nginx反向代理,看到網上的文章也是云云霧里!有的部署前段,有的部署后端,寫來寫去都沒突出個重點。
有實際在線上部署過的大佬幫忙解答下這個小白問題!還有就是能否普及下nginx安全之類的知識?,畢竟暴露在公網提供服務的。
來源:開源中國
發布時間:2017-06-18 09:56:00
HDC調試需求開發(15萬預算),能者速來!>>>
我最近沒事想用git弄一個自己的網站,做到一半發現打不開本機地址http://localhost4000。我百度看到好像是電腦沒有安裝lls,但是在我安裝lls時又出現0x80070057錯誤代碼,查了好多回答,都不管用,有的說要重裝系統才行,我的是家庭版的的,有的說是家庭版功能不全,求大神解決一下!不用重裝系統最好,或者怎樣解決打開localhost4000,謝謝了~
來源:開源中國
發布時間:2017-05-28 22:30:00
HDC調試需求開發(15萬預算),能者速來!>>>
想通過命令行修改IIS某個站點的物理路徑,使用如下命令修改不了,請問是哪里出了問題呢?謝謝!
.\appcmd.exe set APP "Default Web Site/A4" /physicalPath:"E:\Arc"
來源:開源中國
發布時間:2016-11-03 09:31:00
HDC調試需求開發(15萬預算),能者速來!>>>
之前一直在用lnmp,最近嘗試了一下win2008+iis7.5+php+mysql,配置https成功,可以訪問,但是在網上并沒有找到在iis下如何優化https,以下是用nginx時的設置:
ssl_session_timeout 20m;
ssl_session_cache shared:SSL:20m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-RC4-SHA:!ECDHE-RSA-RC4-SHA:ECDH-ECDSA-RC4-SHA:ECDH-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:!RC4-SHA:HIGH:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!CBC:!EDH:!kEDH:!PSK:!SRP:!kECDH;
ssl_ecdh_curve secp384r1;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
ssl_stapling_file /www/ssl/stapling_ocsp;
ssl_trusted_certificate /www/ssl/chain.pem;
resolver 172.16.0.111 172.16.0.110 valid=300s;
resolver_timeout 5s;
請問在iis7.5下是否需要這些設置?要如何去設置?謝謝。
來源:開源中國
發布時間:2017-03-20 11:48:00
HDC調試需求開發(15萬預算),能者速來!>>>
IIS怎么整合JAVA,可以上傳JAVA進行編譯,可以上傳打包好的war包進行整合編譯
來源:開源中國
發布時間:2017-02-24 14:00:00
HDC調試需求開發(15萬預算),能者速來!>>>
在一臺服務器上用安裝了nginx和iis,用nginx做反向代理,監聽80端口,iis的站點只好使用8000端口。域名解析www.a.com,因為iis站點是別人開發的,不知道為什么在提交一個表單之后,跳轉到一個新頁面后,URL自帶了端口,變成了www.a.com:8000,這樣就繞過了nginx的監聽,直接訪問的iis了,有沒有什么辦法把8000端口改成80端口
來源:開源中國
發布時間:2017-02-16 23:35:00
HDC調試需求開發(15萬預算),能者速來!>>>
80端口沒對外開放,在配置Let’s Encrypt出現下面提示,該怎么處理?
The ACME server was probably unable to reach http://XXXXX.XXXXX.XXX/.well-known/acme-challenge/eue_UrCJxw9Xpu3F7QxxIoXPq77GwaEuXSzj4RTj6so
Check in a browser to see if the answer file is being served correctly.
This could be caused by IIS not being setup to handle extensionless static files. Here's how to fix that:
1. In IIS manager goto Site/Server->Handler Mappings->View Ordered List
2. Move the StaticFile mapping above the ExtensionlessUrlHandler mappings. (like this http://i.stack.imgur.com/nkvrL.png )
3. if you need to make changes to your web,config file, update the one at D:\letsencrypt-win-simple.V1.9.1\web_config.xml
來源:開源中國
發布時間:2017-01-05 08:53:00
HDC調試需求開發(15萬預算),能者速來!>>>
在Nginx中配置了2個WEB應用地址?,F在其中一個應用地址IIS停止了。結果客戶訪問的時候到關閉的那地址時候會超時1分鐘。這個如何解決。
upstream a.com{ #ip_hash; server 192.168.1.10:80; server 192.168.1.11:80; }
詳細的Nginx配置
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; upstream a.com{ #ip_hash; server 192.168.1.10:80; server 192.168.1.11:80; } server { listen 80; #server_name localhost; server_name a.com; #charset koi8-r; #access_log logs/host.access.log main; location / { # root html; # index index.html index.htm; proxy_pass http://a.com; proxy_redirect default; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
來源:開源中國
發布時間:2016-09-20 15:48:00
HDC調試需求開發(15萬預算),能者速來!>>>
測試環境是在WINDOWS2003,IIS6,NGINX 1.0下. location ~/ { proxy_set_header Accept-Encoding "none"; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real_IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 120s; proxy_read_timeout 120s; proxy_send_timeout 120s; proxy_buffering off; proxy_pass http://127.0.0.1:8080; }
在測試的時候,如果直接訪問,127.0.0.1:80,即訪問nginx,就很容易出現錯誤:
upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream
上面這是NGINX的錯誤日志.在瀏覽器上反應就是502,504錯誤.
但如果在測試的時候,把測試地址改成http://127.0.0.1:8080,即訪問IIS,根本不會出現超時什么的.
有人說是IIS腳本執行時間太長,但問題時,使用靜態頁面也出現同樣的問題.就不應該是IIS的問題了.
后來又把同樣的程序,放到另外一臺2003上運行,把NGINX的代理地址也改了,情況就好多.
為什么直接代理本機卻出現一大堆超時錯誤.不要說把timeout的值改大,那個改大了,瀏覽器上的反應就是一直在等待.還不如直接輸出錯誤呢.
請問這種問題應該怎么解決呢?
來源:開源中國
發布時間:2011-07-28 13:17:00
HDC調試需求開發(15萬預算),能者速來!>>>
因為歷史遺留問題 以及現狀
背景:目前遇到一個很囧的情況 有一臺服務器是server2003的,裝的是IIS6。目前已經跑了三個用.net寫的項目在iis上,都是用的80端口的,我需要跑一個java的項目在tomcat上,因為要和微信交互,所以必須要也要80端口。目前三個網站所使用的二級域名是a.test.com,b.test.com,c.test.com。
問題:我不能動原來的項目也不能升級iis或者系統,而且暫時不能給我指配另一個二級域名,而且要求我和c.test.com共用一個二級域名。。。我該怎么讓一個.net寫的和一個java寫的項目跑在c.test.com這個域名上?或者讓java的跑在c.test.com/mine 這種子項目上?
謝謝各位大神
來源:開源中國
發布時間:2016-10-17 21:52:00
HDC調試需求開發(15萬預算),能者速來!>>>
iis php怎樣取得取得偽靜態后的Url
如:index.php?id=12&n=34 偽靜態后 i-12-34.html
apache可以直接取得 i-12-34.html,但iis好像取得這樣的結果只能取得動態的Url
來源:開源中國
發布時間:2011-12-27 11:40:00
HDC調試需求開發(15萬預算),能者速來!>>> 早上好 http://www.test.com/test.txt 可以下載 http://www.test.com/test.ini 下載顯示404 怎么回事???
來源:開源中國
發布時間:2016-09-22 08:13:00
HDC調試需求開發(15萬預算),能者速來!>>>
目前已知的
1.項目放到服務器上(centos7)發現mina客戶端無法收到服務端的信息,但是把mina客戶端放在本機運行連接遠程的mina服務端是可以的,客戶端和服務端通信是8080/UDP端口,centos端口已打開.
2.通過抓包確定,服務端確實成功發出了信息,但是部署在centos上的mina客戶端確實沒有收到
3.客戶端發送的數據,服務端可以正常收到
4.mina客戶端集成在springboot上邊
5.最后在說一句....本機調試mina客戶端是沒有問題的
來源:開源中國
發布時間:2019-09-15 19:45:00
HDC調試需求開發(15萬預算),能者速來!>>>
mina接收消息:開始符號,和結束符號問題,TextLineCodecFactory默認是/r/n
客戶機消息是 STX是開頭 ETX是結尾,對應16進制02 03,這時候TextLineCodecFactory需要怎么設置呢?
核心代碼:
TextLineCodecFactory tlcf = new TextLineCodecFactory(Charset.forName("gb2312"),new LineDelimiter("STXETX"),new LineDelimiter("STXETX"));
目前收到消息如下:沒有正常調用接收消息的messageReceived方法
完整代碼:
package com.yice.cloud.websocket;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.charset.Charset;
import org.apache.mina.core.service.IoAcceptor;
import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.codec.textline.LineDelimiter;
import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
import org.apache.mina.filter.logging.LoggingFilter;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MinaTimeTest {
private static final int PORT = 9123;
public static void main(String[] args) throws IOException {
//首先,我們為服務端創建IoAcceptor,NioSocketAcceptor是基于NIO的服務端監聽器
IoAcceptor acceptor = new NioSocketAcceptor();
//接著,如結構圖示,在Acceptor和IoHandler之間將設置一系列的Fliter"\r\n", "\r\n"
//包括記錄過濾器和編解碼過濾器。其中TextLineCodecFactory是mina自帶的文本解編碼器
acceptor.getFilterChain().addLast("logger", new LoggingFilter());
TextLineCodecFactory tlcf = new TextLineCodecFactory(Charset.forName("gb2312"),new LineDelimiter("STXETX"),new LineDelimiter("STXETX"));
//CustomProtocolCodecFactory tlcf = new CustomProtocolCodecFactory(Charset.forName("gb2312"));
acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(tlcf));
/*acceptor.getFilterChain().addLast("codec",
new ProtocolCodecFilter(new ObjectSerializationCodecFactory()));*/
//配置事務處理Handler,將請求轉由TimeServerHandler處理。
acceptor.setHandler(new TimeServerHandler());
//配置Buffer的緩沖區大小
acceptor.getSessionConfig().setReadBufferSize(2048);
//設置等待時間,每隔IdleTime將調用一次handler.sessionIdle()方法
acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, 10);
//綁定端口
acceptor.bind(new InetSocketAddress(PORT));
}
static class TimeServerHandler extends IoHandlerAdapter {
private Logger logger = LoggerFactory.getLogger(this.getClass());
public void exceptionCaught(IoSession session, Throwable cause)
throws Exception {
cause.printStackTrace();
}
public void messageReceived(IoSession session, Object message)
throws Exception {
logger.info("接受消息成功..." + message.toString());
super.messageReceived(session, message);
}
public void sessionIdle(IoSession session, IdleStatus status)
throws Exception {
System.out.println("IDLE ==============" + session.getIdleCount(status));
}
}
}
來源:開源中國
發布時間:2019-07-30 21:19:00
HDC調試需求開發(15萬預算),能者速來!>>>
想跑一下TLD目標跟蹤的程序,下了一個C++實現的代碼
https://github.com/jmfs/OpenTLD
程序是在vs2010下寫的,我電腦上裝的是vs2012,配置的opencv2.4.10.
打開run_tld時按照提示更新了,平臺工具集如果用Visual Studio 2012 (v110)
就會報錯,如下
1>------ 已啟動全部重新生成: 項目: ZERO_CHECK (Visual Studio 2010), 配置: Debug Win32 ------
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(42,5): error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.
2>------ 已啟動全部重新生成: 項目: LKTracker (Visual Studio 2010), 配置: Debug Win32 ------
3>------ 已啟動全部重新生成: 項目: ferNN (Visual Studio 2010), 配置: Debug Win32 ------
2>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/ZERO_CHECK.vcxproj' does not exist.
2>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(42,5): error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.
3>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/ZERO_CHECK.vcxproj' does not exist.
3>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(42,5): error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.
4>------ 已啟動全部重新生成: 項目: tld (Visual Studio 2010), 配置: Debug Win32 ------
5>------ 已啟動全部重新生成: 項目: tld_utils (Visual Studio 2010), 配置: Debug Win32 ------
4>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/ZERO_CHECK.vcxproj' does not exist.
4>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(42,5): error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.
5>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/ZERO_CHECK.vcxproj' does not exist.
5>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(42,5): error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.
6>------ 已啟動全部重新生成: 項目: run_tld, 配置: Debug Win32 ------
6>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/LKTracker.vcxproj' does not exist.
6>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/ZERO_CHECK.vcxproj' does not exist.
6>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/ferNN.vcxproj' does not exist.
6>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/tld.vcxproj' does not exist.
6>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/tld_utils.vcxproj' does not exist.
6> Building Custom Rule C:/Users/Dev/OpenTLD C++/src/CMakeLists.txt
6> 系統找不到指定的路徑。
6>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(172,5): error MSB6006: “cmd.exe”已退出,代碼為 3。
7>------ 已跳過全部重新生成: 項目: ALL_BUILD (Visual Studio 2010), 配置: Debug Win32 ------
7>沒有為此解決方案配置選中要生成的項目
========== 全部重新生成: 成功 0 個,失敗 6 個,跳過 1 個 ==========
改成v100也還是報錯
1>------ 已啟動全部重新生成: 項目: ZERO_CHECK (Visual Studio 2010), 配置: Debug Win32 ------
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(42,5): error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.
2>------ 已啟動全部重新生成: 項目: LKTracker (Visual Studio 2010), 配置: Debug Win32 ------
3>------ 已啟動全部重新生成: 項目: ferNN (Visual Studio 2010), 配置: Debug Win32 ------
3>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/ZERO_CHECK.vcxproj' does not exist.
3>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(42,5): error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.
4>------ 已啟動全部重新生成: 項目: tld (Visual Studio 2010), 配置: Debug Win32 ------
2>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/ZERO_CHECK.vcxproj' does not exist.
2>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(42,5): error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.
4>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/ZERO_CHECK.vcxproj' does not exist.
4>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(42,5): error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.
5>------ 已啟動全部重新生成: 項目: tld_utils (Visual Studio 2010), 配置: Debug Win32 ------
5>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/ZERO_CHECK.vcxproj' does not exist.
5>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(42,5): error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.
6>------ 已啟動全部重新生成: 項目: run_tld (Visual Studio 2010), 配置: Debug Win32 ------
6>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/LKTracker.vcxproj' does not exist.
6>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/ZERO_CHECK.vcxproj' does not exist.
6>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/ferNN.vcxproj' does not exist.
6>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/tld.vcxproj' does not exist.
6>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1395,5): warning : The referenced project 'C:/Users/Dev/OpenTLD C++/src/tld_utils.vcxproj' does not exist.
6>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(42,5): error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.
7>------ 已跳過全部重新生成: 項目: ALL_BUILD (Visual Studio 2010), 配置: Debug Win32 ------
7>沒有為此解決方案配置選中要生成的項目
========== 全部重新生成: 成功 0 個,失敗 6 個,跳過 1 個 ==========
應該怎么解決呢?
來源:開源中國
發布時間:2017-01-24 22:43:00
HDC調試需求開發(15萬預算),能者速來!>>> opencv中的train函數,訓練的是一個人臉的多張圖片(比如不用表情的圖片),還是不同人臉的照片啊
來源:開源中國
發布時間:2016-04-16 19:36:00
HDC調試需求開發(15萬預算),能者速來!>>>
小弟最近想要學習openCV,使用的開發環境是PyCharm,通過PyCharm下的 "Project Interpreter"安裝的opencv-python。安裝后下圖所示:
當我 import cv2 后,沒有錯誤提示,但是對于cv2模塊里面的函數沒有提示,如下圖所示:
如果我輸入“ cv2.cv2. ”之后就會出現正常的提示,如下圖所示:
而當我使用 “ cv2.cv2.imread() “ 函數并運行,就會出現錯誤,提示 cv2沒有cv2屬性:
如果我不管軟件的自動補全,直接使用 “cv2.imread()”函數則能運行,而且可以通過“cv2.imshow”函數把圖片顯示出來。
請問各位大俠,是我的PyCharm軟件有些配置沒有設置好嗎???
來源:開源中國
發布時間:2017-02-10 17:29:00
HDC調試需求開發(15萬預算),能者速來!>>> 用ffmpeg怎么無縫切換視頻源呢?我試過先把進程關閉然后重新推流,但是這樣會導致中間卡頓20秒左右,也試過用javacv循環推流,但是幀數一直上不去,請問一下還有什么方法解決。
來源:開源中國
發布時間:2016-12-29 13:45:00
HDC調試需求開發(15萬預算),能者速來!>>> 情況是這樣的, 從攝像頭獲取到的視頻, 經過opencv的處理后, 通過使用 opencv的 videoWriter 創建一個視頻流, 將獲取到的mat數據保存在android開發板上, 但是發現在android開發板上 videoWriter 都無法創建視頻文件, 更別說保存視頻了。在電腦上是可以保存的, 而且使用c++ 的系統函數ofstream 是可以在android的開發板上同一個目錄下讀寫文件的, 不是目錄文件權限問題。 這種問題應該怎么解決, 或者有其他的替代方案, 將獲取的mat數據保存為一個視頻文件, 方便以后讀取回放。 還望大神們不吝賜教
來源:開源中國
發布時間:2016-12-28 10:52:00