关于MAVEN配置ORACLE数据库的问题

我安装的是MAVEN3.2.3。然后在CMD中,输入
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.1.0 -Dpackaging=jar -Dfile=E:\app\admin\product\11.2.0\dbhome_1\jdbc\lib\ojdbc6.jar

BUILD SUCCESS。
我再回到MAVEN仓库中看,也确实是有了这个JAR包。
但是跑后台的时候,就是找不到这个驱动。已经困扰两天了。实属无奈。希望大神们帮帮忙。
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.OracleDrive'

The error may exist in file [C:\Users\admin\Desktop\MUDAO\mudao\target\classes\com\cn\mudao\mapping\UserMapper.xml]

The error may involve com.cn.mudao.dao.IUserDao.selectByPrimaryKey

The error occurred while executing a query

Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.OracleDrive'

at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
at com.sun.proxy.$Proxy16.selectOne(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:163)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:68)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
at com.sun.proxy.$Proxy17.selectByPrimaryKey(Unknown Source)
at com.cn.mudao.service.impl.UserServiceImpl.getUserById(UserServiceImpl.java:18)
at org.zsl.testmybatis.TestMyBatis.test1(TestMyBatis.java:35)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
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:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:175)
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.apache.ibatis.exceptions.PersistenceException:

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.OracleDrive'

The error may exist in file [C:\Users\admin\Desktop\MUDAO\mudao\target\classes\com\cn\mudao\mapping\UserMapper.xml]

The error may involve com.cn.mudao.dao.IUserDao.selectByPrimaryKey

The error occurred while executing a query

Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.OracleDrive'

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:111)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:66)
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.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)
... 35 more

Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.OracleDrive'
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:81)
at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:67)
at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:279)
at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:72)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:59)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:137)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:96)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:77)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:108)
... 42 more
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.OracleDrive'
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
... 52 more
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleDrive
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1130)
... 55 more

10个回答

maven本地安装了,但是项目的pom里有没有引入oracle的驱动????

weixin_29858463
嗯哼丶啊哈丶 引入了。。。 <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>11.2.0.1.0</version> </dependency>
接近 3 年之前 回复

求各位大神帮帮忙啊。这个工作效率,我受不了了。。

图片说明这是mysql的写法,你的只需要改成oracle的就行了

baixuefeng1
90mark 回复weixin_29858463:开发工具下执行maven install安装一下就行了,不要手动lib引入,下面有方法
接近 3 年之前 回复
weixin_29858463
嗯哼丶啊哈丶 POM.XML里,我是有加入的,原本项目用的是MYSQL。这次换ORACLE。我特地去下了个MAVEN,配置了一下,想把ODBC6的包加到我仓库里去的。项目里我检查过,确实是加进去了。但是跑的时候,就是找不到。
接近 3 年之前 回复
weixin_29858463
嗯哼丶啊哈丶 <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>11.2.0.1.0</version> </dependency>
接近 3 年之前 回复

图片说明maven的jar下有没有这个包

weixin_29858463
嗯哼丶啊哈丶 回复90mark: 有。ODBC
接近 3 年之前 回复
baixuefeng1
90mark 你的是oracle的
接近 3 年之前 回复

为了验证,是没找到这个JAR包。我手动拉到LIB里。写了个JAVA类,去测试一下,结果,JAVA读到了这个JAR包。但是,放在WEB工程里,通过画面URL,跑到后台。就找不到。我用的是SSM框架。

图片说明

最终解决方式:必须maven下要有上面的oracle的jar包,你的问题应该是没有引入这个。问题我应该清楚了,oracle的驱动你是通过lib手动引入的出错(把你手动的删除)。然后,你只需要在开发工具pom--然后右键run--maven install,成功后,最后再运行一遍服务项目就行了

weixin_29858463
嗯哼丶啊哈丶 不是的。那个手动引入的JAR包。是我新建了一个项目,来测试的,目的是为了知道,是不是因为MAVEN没有把ODBC6给加入导致这个异常。您说的我现在先试一下。
接近 3 年之前 回复

Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-booter/2.10/surefire-booter-2.10.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-booter/2.10/surefire-booter-2.10.pom (3 KB at 1.3 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-api/2.10/surefire-api-2.10.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-api/2.10/surefire-api-2.10.pom (3 KB at 1.1 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.10/maven-surefire-common-2.10.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.10/maven-surefire-common-2.10.pom (4 KB at 3.4 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/2.1/plexus-utils-2.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/2.1/plexus-utils-2.1.pom (4 KB at 5.7 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting-api/2.0.9/maven-reporting-api-2.0.9.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting-api/2.0.9/maven-reporting-api-2.0.9.pom (2 KB at 0.5 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting/2.0.9/maven-reporting-2.0.9.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting/2.0.9/maven-reporting-2.0.9.pom (2 KB at 1.0 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-toolchain/2.0.9/maven-toolchain-2.0.9.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven-toolchain/2.0.9/maven-toolchain-2.0.9.pom (4 KB at 1.8 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-common-artifact-filters/1.3/maven-common-artifact-filters-1.3.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-common-artifact-filters/1.3/maven-common-artifact-filters-1.3.pom (4 KB at 5.6 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-components/12/maven-shared-components-12.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-components/12/maven-shared-components-12.pom (10 KB at 9.1 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/13/maven-parent-13.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/13/maven-parent-13.pom (23 KB at 9.0 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-9/plexus-container-default-1.0-alpha-9.pom
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.0-alpha-9/plexus-container-default-1.0-alpha-9.pom (2 KB at 1.7 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-booter/2.10/surefire-booter-2.10.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-api/2.10/surefire-api-2.10.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.10/maven-surefire-common-2.10.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-common-artifact-filters/1.3/maven-common-artifact-filters-1.3.jar
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/2.1/plexus-utils-2.1.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting-api/2.0.9/maven-reporting-api-2.0.9.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting-api/2.0.9/maven-reporting-api-2.0.9.jar (10 KB at 14.3 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-common-artifact-filters/1.3/maven-common-artifact-filters-1.3.jar (31 KB at 20.5 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-booter/2.10/surefire-booter-2.10.jar (34 KB at 21.2 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-api/2.10/surefire-api-2.10.jar (158 KB at 50.8 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.10/maven-surefire-common-2.10.jar (60 KB at 3.4 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/2.1/plexus-utils-2.1.jar (220 KB at 11.7 KB/sec)
[INFO] Surefire report directory: C:\Users\admin\Desktop\MUDAO\mudao\target\surefire-reports
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.10/surefire-junit4-2.10.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.10/surefire-junit4-2.10.pom (3 KB at 2.0 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-providers/2.10/surefire-providers-2.10.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-providers/2.10/surefire-providers-2.10.pom (3 KB at 1.7 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.10/surefire-junit4-2.10.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.10/surefire-junit4-2.10.jar (33 KB at 10.5 KB/sec)


T E S T S

Running org.zsl.testmybatis.TestMyBatis
[org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from class path resource [spring-mybatis.xml]
[org.springframework.context.support.GenericApplicationContext] - Refreshing org.springframework.context.support.GenericApplicationContext@adcae8: startup date [Tue May 09 13:59:49 CST 2017]; root of context hierarchy
[org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] - Loading properties file from class path resource [jdbc.properties]
[org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.631 sec <<< FAILURE!
[org.springframework.context.support.GenericApplicationContext] - Closing org.springframework.context.support.GenericApplicationContext@adcae8: startup date [Tue May 09 13:59:49 CST 2017]; root of context hierarchy

Results :

Tests in error:
test1(org.zsl.testmybatis.TestMyBatis): nested exception is org.apache.ibatis.exceptions.PersistenceException:

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 54.269s
[INFO] Finished at: Tue May 09 13:59:49 CST 2017
[INFO] Final Memory: 6M/17M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project MUDAO: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\admin\Desktop\MUDAO\mudao\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

baixuefeng1
90mark 回复weixin_29858463: 加微信Wing0858,再次maven install把打包信息截图发过来
接近 3 年之前 回复
weixin_29858463
嗯哼丶啊哈丶 回复90mark: 这是啥意思?是说JAR包不对?还是JAR包有问题?其他的JAR包,肯定没问题,之前我都正常,之前是用MYSQL的。所以没问题,这次就换了一个ORACLE。想把ODBC6给加到仓库里去。就出错了。
接近 3 年之前 回复
baixuefeng1
90mark 你要再开发端检查一下那些jar出错的问题了,maven打包失败,说明jar哪里有错,oracle的错误已经被跟新了,现在是其他的问题
接近 3 年之前 回复

我看日志是 can not load 看看中央仓库是否有pom文件里配置的jar(包括版本等都对上)

看了会觉得可能你那命令有点不规范
把 -Dfile 命令 提到 -DgroupId前面 再次将jar包导入maven 仓库试试

mvn install:install-file -Dfile=E:\app\admin\product\11.2.0\dbhome_1\jdbc\lib\ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.1.0 -Dpackaging=jar

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
oracle数据库更换为达梦数据库项目启动报错?
INFO {dataSource-1} inited INFO {dataSource-1} closed 15:58:45.904 [RMI TCP Connection(2)-127.0.0.1] ERROR org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adminCfgService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.westar.core.service.FinancialService com.westar.core.service.AdminCfgService.financialService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'financialService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: ……(省略)…… com.westar.core.service.FlowDesignService.cusActivitService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cusActivitService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.activiti.engine.RuntimeService com.westar.core.service.CusActivitService.runtimeService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineFactory': FactoryBean threw exception on object creation; nested exception is org.activiti.engine.ActivitiException: couldn't deduct database type from database product name 'DM DBMS' 我引入了达梦数据库连接的驱动jar包,并重新配置了文件jdbc文件的连接方式;希望大神指点一下,万分感谢!!!
自建jetspeed发布时找不到oracle数据源的问题
初次接触jetspeed 按照官方的biuld guid生成了一个portal ,准备发布到tomcat上 但执行命令过程中出现错误,似乎是要去中央仓库下载oracle的数据源(classes12.jar),中央仓库是没有这个的,为此已经用nexus把oracle里的classes12.jar发布到了本地仓库(3rd party) 但程序并没有访问本地仓库,貌似直接去中央仓库找jar包。不知哪里配置错了。 以下是出错信息 d:\workspace\mavenDemo-HelloPortal\hello>mvn org.apache.portals.jetspeed-2:jetsp eed-mvn-maven-plugin:mvn -Dtarget=db [INFO] Scanning for projects... [INFO] ......省略很多log ......省略很多log ......省略很多log [INFO] ------------------------------------------------------------------------ [INFO] Building Jetspeed-2 Maven Invoker Configuration for My Portal 1.0.0 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- jetspeed-db-maven-plugin:2.2.2:init (unpack) @ jetspeed-mvn-portal-po m --- [WARNING] The POM for org.springframework:spring-ojb:jar:2.0-rc2 is missing, no dependency information available [WARNING] The POM for com.oracle:classes12:jar:10.2.0.1.0 is missing, no depende ncy information available [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 11.308s [INFO] Finished at: Thu Dec 15 20:27:25 CST 2011 [INFO] Final Memory: 5M/15M [INFO] ------------------------------------------------------------------------ [ERROR] [color=red]Failed to execute goal org.apache.portals.jetspeed-2:jetspeed-db-maven-p lugin:2.2.2:init (unpack) on project jetspeed-mvn-portal-pom: Execution unpack o f goal org.apache.portals.jetspeed-2:jetspeed-db-maven-plugin:2.2.2:init failed: Plugin org.apache.portals.jetspeed-2:jetspeed-db-maven-plugin:2.2.2 or one of i ts dependencies could not be resolved: Failure to find com.oracle:classes12:jar: 10.2.0.1.0 in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elap sed or updates are forced[/color] -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o rg.apache.portals.jetspeed-2:jetspeed-db-maven-plugin:2.2.2:init (unpack) on pro ject jetspeed-mvn-portal-pom: Execution unpack of goal org.apache.portals.jetspe ed-2:jetspeed-db-maven-plugin:2.2.2:init failed: Plugin org.apache.portals.jetsp eed-2:jetspeed-db-maven-plugin:2.2.2 or one of its dependencies could not be res olved: Failure to find com.oracle:classes12:jar:10.2.0.1.0 in http://repo1.maven .org/maven2 was cached in the local repository, resolution will not be reattempt ed until the update interval of central has elapsed or updates are forced at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:225) 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.buildProje ct(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje ct(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu ild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl eStarter.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:537) 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:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun cher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav a:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La uncher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java: 352) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution unpack of goal org.apache.portals.jetspeed-2:jetspeed-db-maven-plugin:2.2.2:init failed: Plugin org.apache.portals.jetspeed-2:jetspeed-db-maven-plugin:2.2.2 or one of it s dependencies could not be resolved: Failure to find com.oracle:classes12:jar:1 0.2.0.1.0 in http://repo1.maven.org/maven2 was cached in the local repository, r esolution will not be reattempted until the update interval of central has elaps ed or updates are forced at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default BuildPluginManager.java:82) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:209) ... 19 more Caused by: org.apache.maven.plugin.PluginResolutionException: Plugin org.apache. portals.jetspeed-2:jetspeed-db-maven-plugin:2.2.2 or one of its dependencies cou ld not be resolved: Failure to find com.oracle:classes12:jar:10.2.0.1.0 in http: //repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.re solve(DefaultPluginDependenciesResolver.java:215) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.createPlug inRealm(DefaultMavenPluginManager.java:353) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.setupPlugi nRealm(DefaultMavenPluginManager.java:321) at org.apache.maven.plugin.DefaultBuildPluginManager.getPluginRealm(Defa ultBuildPluginManager.java:175) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default BuildPluginManager.java:78) ... 20 more Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Failure t o find com.oracle:classes12:jar:10.2.0.1.0 in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the upd ate interval of central has elapsed or updates are forced at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(Def aultArtifactResolver.java:541) at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArti facts(DefaultArtifactResolver.java:220) at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDepe ndencies(DefaultRepositorySystem.java:395) at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.re solve(DefaultPluginDependenciesResolver.java:207) ... 24 more Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Failure to fi nd com.oracle:classes12:jar:10.2.0.1.0 in http://repo1.maven.org/maven2 was cach ed in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced at org.sonatype.aether.impl.internal.DefaultUpdateCheckManager.checkArti fact(DefaultUpdateCheckManager.java:190) at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(Def aultArtifactResolver.java:430) ... 27 more [ERROR] [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please rea d the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResoluti onException [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] hello portal project .............................. FAILURE [1:33.959s] [INFO] hello portal ...................................... SKIPPED [INFO] hello portlet application ......................... SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1:35.230s [INFO] Finished at: Thu Dec 15 20:27:25 CST 2011 [INFO] Final Memory: 3M/15M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.portals.jetspeed-2:jetspeed-mvn-maven- plugin:2.2.2:mvn (default-cli) on project hello: ...FAILED[code=1]. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit ch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please rea d the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc eption d:\workspace\mavenDemo-HelloPortal\hello> 以下是jetspeed-mvn-portal-pom.xml的主要配置信息(其他默认) <org.apache.jetspeed.production.jdbc.driver.groupId>com.oracle</org.apache.jetspeed.production.jdbc.driver.groupId> <org.apache.jetspeed.production.jdbc.driver.artifactId>classes12</org.apache.jetspeed.production.jdbc.driver.artifactId> <org.apache.jetspeed.production.jdbc.driver.version>10.2.0.1.0</org.apache.jetspeed.production.jdbc.driver.version> <org.apache.jetspeed.production.database.default.name>oracle10</org.apache.jetspeed.production.database.default.name> <org.apache.jetspeed.production.database.url>jdbc:oracle:thin:@192.168.1.201:1521:ORCL</org.apache.jetspeed.production.database.url> <org.apache.jetspeed.production.database.driver>oracle.jdbc.OracleDriver</org.apache.jetspeed.production.database.driver> <org.apache.jetspeed.production.database.user>shopping</org.apache.jetspeed.production.database.user> <org.apache.jetspeed.production.database.password>shopping</org.apache.jetspeed.production.database.password> 以下是maven的settings.xml的主要配置信息 <profile> <id>dev</id> <repositories> <repository> <id>local-nexus</id> <url>http://localhost:8081/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> </profile> </profiles> <!-- activeProfiles | List of profiles that are active for all builds. | <activeProfiles> <activeProfile>alwaysActiveProfile</activeProfile> <activeProfile>anotherAlwaysActiveProfile</activeProfile> </activeProfiles> --> <activeProfiles> <activeProfile>dev</activeProfile> </activeProfiles> 弄了好久好久,就是不知道哪里有问题.......
maven 反向生成实体项目问题
想在eclipse里面弄一个maven的反向生成实体工程,配置好之后运行一直不生成实体,运行过程也不报错,运行命令使用的:hibernate3:hbm2java ,配置文件如下: pom.xml ``` <?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>AAAAA</groupId> <artifactId>AAAAA</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <groupId>AAAAA_PO</groupId> <artifactId>AAAAA_PO</artifactId> <name>AAAAA_PO</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> </dependencies> <build> <finalName>AAAAA_PO</finalName> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>hibernate3-maven-plugin</artifactId> <version>2.2</version> <dependencies> <!-- mysql链接驱动,如果是Oracle的就换成Oracle的驱动 <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.25</version> </dependency> --> <!-- oracle 链接驱动 --> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>11.2.0.1.0</version> </dependency> <dependency> <groupId>cglib</groupId> <artifactId>cglib</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>ejb3-persistence</artifactId> <version>3.3.2.Beta1</version> </dependency> </dependencies> <!-- 运行命令: mvn hibernate3:hbm2java hibernate3:hbm2hbmxml --> <configuration> <components> <!-- 映射文件夹 项目目录下运行命令:mvn hibernate3:hbm2hbmxml --> <component> <name>hbm2hbmxml</name> <implementation>jdbcconfiguration</implementation> <outputDirectory>src/main/java/</outputDirectory> </component> <!-- 实体类 项目目录下运行命令:mvn hibernate3:hbm2java --> <component> <name>hbm2java</name> <outputDirectory>src/main/java/</outputDirectory> <implementation>jdbcconfiguration</implementation> </component> </components> <componentProperties> <!-- 生成指定表名的实体类和映射文件(不配置则生成所有的数据表) --> <revengfile>src/main/resources/reveng/hibernate.reveng.xml</revengfile> <!-- hibernate总配置文件,注意是链接数据库的信息 --> <configurationfile>src/main/resources/reveng/hibernate.cfg.xml</configurationfile> <!-- 输出的包名 --> <packagename>org</packagename> <!-- true为注解实体类方式,只需要生成java类即可,false为映射文件和非注解java实体类,结合 --> <ejb3>true</ejb3> </componentProperties> <!-- 1、如果你要生成注解方式的 java文件,就运行 mvn hibernate3:hbm2java 2、如果你要生成 hbm.xml 配合 java 的形式就先把 pom 里面 <ejb3>false</ejb3> 弄成false 然后分别运行 mvn hibernate3:hbm2hbmxml 和 mvn hibernate3:hbm2java --> </configuration> </plugin> </plugins> </build> </project> ``` hibernate.cfg.xml ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property> <property name="hibernate.connection.password">fj_inms</property> <property name="hibernate.connection.url">jdbc:oracle:thin:@127.0.0.1:1521:testOrac</property> <property name="hibernate.connection.username">fj_inms</property> <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property> </session-factory> </hibernate-configuration> ``` hibernate.reveng.xml ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-reverse-engineering SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd"> <hibernate-reverse-engineering> <table-filter match-name="sys_organization"/> </hibernate-reverse-engineering> ``` 运行配置 ``` hibernate3:hbm2java ``` 运行控制台打印 ``` [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building AAAAA_PO 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> hibernate3-maven-plugin:2.2:hbm2java (default-cli) > process-resources @ AAAAA_PO >>> [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ AAAAA_PO --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 2 resources [INFO] [INFO] <<< hibernate3-maven-plugin:2.2:hbm2java (default-cli) < process-resources @ AAAAA_PO <<< [INFO] [INFO] --- hibernate3-maven-plugin:2.2:hbm2java (default-cli) @ AAAAA_PO --- [INFO] using jdbcconfiguration task. [INFO] Hibernate 3.3.1.GA [INFO] hibernate.properties not found [INFO] Bytecode provider name : javassist [INFO] using JDK 1.4 java.sql.Timestamp handling [INFO] Configuration XML file loaded: file:/E:/work/workspace_mars/AAAAA/AAAAA_PO/src/main/resources/reveng/hibernate.cfg.xml [INFO] configuring from url: file:/E:/work/workspace_mars/AAAAA/AAAAA_PO/src/main/resources/reveng/hibernate.cfg.xml [INFO] Configured SessionFactory: null [INFO] No hibernate properties file loaded. [INFO] Override file: E:\work\workspace_mars\AAAAA\AAAAA_PO\src\main\resources\reveng\hibernate.reveng.xml [INFO] Using Hibernate built-in connection pool (not for production use!) [INFO] Hibernate connection pool size: 20 [INFO] autocommit mode: false [INFO] using driver: oracle.jdbc.OracleDriver at URL: jdbc:oracle:thin:@127.0.0.1:1521:testOrac [INFO] connection properties: {user=fj_inms, password=****} [INFO] RDBMS: Oracle, version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options [INFO] JDBC driver: Oracle JDBC driver, version: 11.2.0.1.0 [INFO] Using dialect: org.hibernate.dialect.Oracle10gDialect [INFO] Using default transaction strategy (direct JDBC transactions) [INFO] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) [INFO] Automatic flush during beforeCompletion(): disabled [INFO] Automatic session close at end of transaction: disabled [INFO] JDBC batch size: 15 [INFO] JDBC batch updates for versioned data: disabled [INFO] Scrollable result sets: enabled [INFO] JDBC3 getGeneratedKeys(): disabled [INFO] Connection release mode: auto [INFO] Default batch fetch size: 1 [INFO] Generate SQL with comments: disabled [INFO] Order SQL updates by primary key: disabled [INFO] Order SQL inserts for batching: disabled [INFO] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory [INFO] Using ASTQueryTranslatorFactory [INFO] Query language substitutions: {} [INFO] JPA-QL strict compliance: disabled [INFO] Second-level cache: enabled [INFO] Query cache: disabled [INFO] Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory [INFO] Optimize cache for minimal puts: disabled [INFO] Structured second-level cache entries: disabled [INFO] Statistics: disabled [INFO] Deleted entity synthetic identifier rollback: disabled [INFO] Default entity-mode: pojo [INFO] Named query checking : enabled [INFO] cleaning up connection pool: jdbc:oracle:thin:@127.0.0.1:1521:testOrac [INFO] Hibernate Tools 3.2.2.GA [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.482 s [INFO] Finished at: 2017-01-16T22:12:45+08:00 [INFO] Final Memory: 18M/246M [INFO] ------------------------------------------------------------------------ [INFO] cleaning up connection pool: jdbc:oracle:thin:@127.0.0.1:1521:testOrac ```
maven构建多模块SSH项目配置文件的问题
<p>1、使用maven做为项目构建工具,创建studio、common、oa、system四个模块项目,其中studio为父模块,common为数据库操作模块、Oa 和system为业务模块。common 配置了spring 集成hibernate的基本配置文件common-spring.xml。现在需要在oa模块中建立一个实体类user和user.hbm.xml,请问oa中的oa_spring如何配置,common中如何读取user.hbm.xml?</p> <p>我的common_spring.xml内容如下:</p> <p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br>&lt;beans xmlns="http://www.springframework.org/schema/beans"<br>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"<br>    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"<br>    xmlns:context="http://www.springframework.org/schema/context"<br>    xsi:schemaLocation="<br>     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd<br>     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd<br>     http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd<br>     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd<br>     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"<br>    default-autowire="byName"&gt;<br>    &lt;!-- enable component scanning (beware that this does not enable mapper <br>        scanning!) --&gt;<br>    &lt;context:component-scan base-package="com.huadainfo.com.dao" /&gt;<br>    &lt;context:component-scan base-package="com.huadainfo.com.dao.impl" /&gt;<br>    &lt;bean<br>        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;<br>        &lt;property name="locations" value="classpath:datasource.properties" /&gt;<br>    &lt;/bean&gt;<br><br>    &lt;!-- 数据源配置 --&gt;<br>    &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"<br>        destroy-method="close"&gt;<br>        &lt;property name="driverClassName" value="${jdbc.driverClassName}"&gt;&lt;/property&gt;<br>        &lt;property name="url" value="${jdbc.url}"&gt;&lt;/property&gt;<br>        &lt;property name="username" value="${jdbc.username}"&gt;&lt;/property&gt;<br>        &lt;property name="password" value="${jdbc.password}"&gt;&lt;/property&gt;<br>        &lt;property name="initialSize" value="10"&gt;&lt;/property&gt;<br>        &lt;property name="maxActive" value="1000"&gt;&lt;/property&gt;<br>        &lt;property name="maxIdle" value="300"&gt;&lt;/property&gt;<br>        &lt;property name="minIdle" value="10"&gt;&lt;/property&gt;<br>        &lt;property name="maxWait" value="10000"&gt;&lt;/property&gt;<br>        &lt;property name="removeAbandoned" value="true" /&gt;<br>        &lt;property name="removeAbandonedTimeout" value="60"/&gt;<br>        &lt;property name="logAbandoned" value="true" /&gt;<br>        &lt;property name="testOnBorrow" value="true"/&gt; <br>           &lt;property name="testWhileIdle" value="true"/&gt; <br>           &lt;property name="validationQuery" value="select getdate()"/&gt; <br>    &lt;/bean&gt;<br><br>    &lt;bean id="sessionFactory"<br>        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;<br>        &lt;property name="dataSource" ref="dataSource" /&gt;<br>        &lt;property name="hibernateProperties"&gt;<br>            &lt;props&gt;<br>                &lt;!-- 指定Hibernate的连接方言 --&gt;<br>                &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.Oracle10gDialect&lt;/prop&gt;<br>                &lt;!-- 配置启动应用时,是否根据Hibernate映射自动创建数据表 --&gt;<br>                &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;<br>                &lt;prop key="hibernate.format_sql"&gt;true&lt;/prop&gt;<br>                &lt;prop key="hibernate.current_session_context_class"&gt;org.springframework.orm.hibernate4.SpringSessionContext<br>                &lt;/prop&gt;<br>                &lt;prop key="hibernate.cache.provider_class"&gt;net.sf.ehcache.hibernate.EhCacheProvider&lt;/prop&gt;<br>                &lt;prop key="hibernate.cache.region.factory_class"&gt;org.hibernate.cache.ehcache.EhCacheRegionFactory<br>                &lt;/prop&gt;<br>            &lt;/props&gt;<br>            <br>        &lt;/property&gt;<br>       <span style="text-decoration: underline;"><span style="background-color: #ff0000;"> &lt;property name="mappingResources"&gt;<br>            &lt;list&gt;<br>                &lt;value&gt;classpath*:com/huadainfo/entity/*.hbm.xml&lt;/value&gt;<br>            &lt;/list&gt;<br>        &lt;/property&gt;</span></span>这部分该怎么写<br>        <br>    &lt;/bean&gt;<br>        &lt;!-- A transaction manager for working with Hibernate SessionFactories --&gt;<br>    &lt;bean id="transactionManager"<br>        class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;<br>        &lt;property name="sessionFactory" ref="sessionFactory" /&gt;<br>    &lt;/bean&gt;<br>    &lt;!-- 配置事务的传播特性 --&gt;<br>    &lt;tx:advice id="txAdvice" transaction-manager="transactionManager"&gt;<br>        &lt;tx:attributes&gt;<br>            &lt;tx:method name="add*" propagation="REQUIRED" read-only="false" /&gt;<br>            &lt;tx:method name="delete*" propagation="REQUIRED" read-only="false" /&gt;<br>            &lt;tx:method name="update*" propagation="REQUIRED" read-only="false" /&gt;<br>            &lt;tx:method name="save*" propagation="REQUIRED" read-only="false" /&gt;<br>            &lt;tx:method name="*" read-only="true" /&gt;<br>        &lt;/tx:attributes&gt;<br>    &lt;/tx:advice&gt;<br>    &lt;!-- 那些类的哪些方法参与事务 --&gt;<br>    &lt;aop:config&gt;<br>        &lt;aop:pointcut id="allManagerMethod"<br>            expression="execution(public * com.huadainfo.common.dao.impl.*.*(..))" /&gt;<br>        &lt;aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice" /&gt;<br>    &lt;/aop:config&gt;<br>    &lt;context:component-scan base-package="com.huadainfo.common.dao" /&gt;<br>    &lt;context:component-scan base-package="com.huadainfo.common.dao.impl" /&gt;<br>    &lt;bean id="hiberDao" class="com.huadainfo.common.dao.impl.HibernateDaoImpl"&gt;<br>        &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;<br>    &lt;/bean&gt;<br>&lt;/beans&gt;</p> <p>oa_spring.xml的内容&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br>&lt;beans xmlns="http://www.springframework.org/schema/beans"<br>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"<br>    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"<br>    xmlns:context="http://www.springframework.org/schema/context"<br>    xsi:schemaLocation="<br>     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd<br>     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd<br>     http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd<br>     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd<br>     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"&gt;<br>    &lt;!-- enable component scanning (beware that this does not enable mapper <br>        scanning!) --&gt;<br>   <span style="text-decoration: underline;"><span style="background-color: #ff0000;"> &lt;import resource="classpath*:common_spring.xml"/&gt;</span></span>(引入不到文件)<br>    &lt;bean id="tset" class="com.huadainfo.oa.service.impl.TestNameimpl"&gt;<br>        &lt;property name="hiberDao" ref="hiberDao"&gt;&lt;/property&gt;<br>    &lt;/bean&gt;<br>    <br>&lt;/beans&gt;</p> <p> </p>
Springboot启动报错 一个是找不到url 一个是找不到dao
## 之前一直启动都没有问题,今天突然发现启动不了 ![图片说明](https://img-ask.csdn.net/upload/201910/10/1570671612_490949.jpg) ## 然后我把启动的位置改成@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) ``` package com.mall.shopping.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; /*@SpringBootApplication*/ @SpringBootApplication(exclude = DataSourceAutoConfiguration.class) public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } } ``` ## 然后会报新的错: ![图片说明](https://img-ask.csdn.net/upload/201910/10/1570671806_766601.jpg) # 到现在没找到新错误的原因 还是在报找不到dao的错误。 ## 实体类代码: ![图片说明](https://img-ask.csdn.net/upload/201910/10/1570672651_585106.jpg) ## controller代码: ``` package com.mall.shopping.demo.controller; import com.mall.shopping.demo.services.UserService; import com.mall.shopping.demo.vo.Huser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Iterator; import java.util.List; @Controller public class UserController { @Autowired private UserService userService; @RequestMapping("/tiao") public ModelAndView zhuan() { ModelAndView modelAndView = new ModelAndView("loginindex"); return modelAndView; } @RequestMapping("/tiao1") public ModelAndView zhuan1() { ModelAndView modelAndView = new ModelAndView("adminindex"); return modelAndView; } @RequestMapping("/Userlogin") public String userlogin(HttpServletRequest request, HttpServletResponse response) { String username = (String) request.getParameter("username"); String userpwd = (String)request.getParameter("userpwd"); List<Huser> huser = userService.userlogin(); Iterator iter = huser.iterator(); while(iter.hasNext()){ Huser ha = (Huser) iter.next(); if(username.equals(ha.getHuser())) { if(userpwd.equals(ha.getHpwd())) { return "redirect:/tiao1"; } else { return "redirect:/tiao"; } } } return "redirect:/tiao"; } } ``` ## services代码: ``` package com.mall.shopping.demo.services; import com.mall.shopping.demo.dao.UserDao; import com.mall.shopping.demo.vo.Huser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class UserService { @Autowired private UserDao userDao; public List<Huser> userlogin(){ return userDao.userlogin();} } ``` ## daoceng代码: ``` package com.mall.shopping.demo.dao; import com.mall.shopping.demo.vo.Huser; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; import java.util.List; @Repository @Mapper public interface UserDao { List<Huser>userlogin(); } ``` ## mybatitsconfig: ``` <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <!-- 开启驼蜂标识:last_name lastName --> <settings> <setting name="mapUnderscoreToCamelCase" value="true"/> </settings> <!-- 实体Bean别名 --> <typeAliases> <package name="com.mall.shopping.demo.vo.Huser"/> <package name="com.mall.shopping.demo.vo.Hdaohang"/> </typeAliases> <mappers> <mapper resource="mapper/select-login.xml"/> <mapper resource="mapper/select-hdaohang.xml"/> </mappers> </configuration> ``` ## xml代码: ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.mall.shopping.demo.dao.UserDao"> <resultMap id="SelectLogin" type="com.mall.shopping.demo.vo.Huser"> <id property="hid" column="HID"></id> <result property="huser" column="HUSER"></result> <result property="hpwd" column="HPWD"></result> </resultMap> <select id="userlogin" resultMap="SelectLogin"> select * from huser </select> </mapper> ``` ## application.properties ``` server.port=8083 server.address=127.0.0.1 #server.session-timeout=60 spring.datasource.url=jdbc:oracle:thin:@127.0.0.1:1521:orcl spring.datasource.username=scott spring.datasource.password=tiger spring.datasource.driver-class-name=oracle.jdbc.OracleDriver mybatis.mapperLocations=classpath:mapper/*.xml mybatis.config-locations=classpath:mybatis/mybatis-config.xml spring.mvc.view.prefix=/WEB-INF/views/ spring.mvc.view.suffix=.jsp ``` ## pom文件: ``` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.7.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.mall.shopping</groupId> <artifactId>demo</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>demo</name> <description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> <spring.version>5.1.5.RELEASE</spring.version> <!-- mybatis版本号 --> <mybatis.version>3.4.5</mybatis.version> <!-- oracle驱动版本号 --> <oracle-driver.version>11.2.0</oracle-driver.version> <!-- log4j日志包版本号 --> <slf4j.version>1.7.18</slf4j.version> <log4j.version>1.2.17</log4j.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-webflux</artifactId> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.1.0</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>io.projectreactor</groupId> <artifactId>reactor-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> <!-- 添加spring核心库 --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-oxm</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring.version}</version> </dependency> <!-- 添加mybatis依赖 --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>${mybatis.version}</version> </dependency> <!-- mybatis/spring包 --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> <version>1.3.0</version> </dependency> <!-- oracle驱动依赖 --> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>${oracle-driver.version}</version> </dependency> <!-- dbcp,用来在spring-mybatis.xml中配置数据库 --> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.2.2</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>${log4j.version}</version> </dependency> <dependency> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-core</artifactId> <version>1.3.5</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.9.12</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-core-asl</artifactId> <version>1.9.12</version> </dependency> <dependency> <groupId>org.xmlunit</groupId> <artifactId>xmlunit-core</artifactId> </dependency> <!-- <dependency> <groupId>com.mchange</groupId> <artifactId>c3p0</artifactId> <version>0.9.5.2</version> </dependency>--> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> </dependency> <!--用于编译jsp --> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> <scope>provided</scope> </dependency> <!--添加热部署--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> <scope>true</scope> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <artifactId>maven-clean-plugin</artifactId> <version>3.1.0</version> </plugin> <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging --> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>3.2.2</version> </plugin> <plugin> <artifactId>maven-install-plugin</artifactId> <version>2.5.2</version> </plugin> <plugin> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.2</version> </plugin> <!--热部署配置--> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <!--fork:如果没有该项配置,整个devtools不会起作用--> <fork>true</fork> </configuration> </plugin> <!-- <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> <version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <versionRange>[1.2,)</versionRange> <goals> <goal>enforce</goal> </goals> </pluginExecutionFilter> <action> <ignore /> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin>--> <!--mybatis 逆向工程插件--> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.5</version> <configuration> <configurationFile>src/main/resources/mybatis-generator/generatorConfig.xml</configurationFile> <verbose>true</verbose> <overwrite>true</overwrite> </configuration> <executions> <execution> <id>Generate MyBatis Artifacts</id> <goals> <goal>generate</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>${oracle-driver.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-core</artifactId> <version>1.3.5</version> </dependency> </dependencies> </plugin> </plugins> <!-- <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> <resource> <directory>src/main/resources</directory> </resource> </resources>--> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources> </build> </project> ``` ## 目录结构: ![图片说明](https://img-ask.csdn.net/upload/201910/10/1570672730_102043.jpg)
springboot项目创建entityManagerFactory时出错:Error activating Bean Validation integration,如何解决?
在svn上拉下项目来本地时无法开启项目,包和配置都和别人一样,但是别人能启动,项目是springboot2.1.9+JPA+mybatis-plus+mysql+oracle+application.properties 所有配置都写到了application.propertiese中 麻烦熟悉JPA的entityManagerFactory生命周期的大神们帮忙解决下,感激不 尽。 鄙人已尝试过的操作: * 1检查实体类与数据库的字段是否匹配,换springboot的版本。 * 2 重新倒jar包、挂上@Entity @ID @GeneratedValue 、重写get set方法、import javax.persistence.Id。 * 3倒入各种hibernate相关的包和javassist包,换mave版本,重新开maven库单独下载包 具体错误如下 ``` org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.cfg.beanvalidation.IntegrationException: Error activating Bean Validation integration at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.10.RELEASE.jar:5.1.10.RELEASE] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105) ~[spring-context-5.1.10.RELEASE.jar:5.1.10.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-5.1.10.RELEASE.jar:5.1.10.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.10.RELEASE.jar:5.1.10.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) [spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE] at com.south.robot.RobotApplication.main(RobotApplication.java:13) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.1.9.RELEASE.jar:2.1.9.RELEASE] ```
【mybatis generator的报错】前期配置问题!!!!!官方文件看了一直也一头雾水
错误如下 Description Resource Path Location Type The content of element type "context" must match "(property*,plugin*,commentGenerator?,(connectionFactory|jdbcConnection),javaTypeResolver?,javaModelGenerator,sqlMapGenerator?,javaClientGenerator?,table+)". generatorConfig.xml /oracle/generator line 4 XML Problem 指向的代码错误是这样的 ``` <generatorConfiguration> <context id="oracleTables" defaultModelType="hierachical" targetRuntime="MyBatis3"> ``` 错误指向context id 改了半天一直报错。。难道是pom.xml的代码顺序问题?? 补源代码 ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> <generatorConfiguration> <context id="oracleTables" defaultModelType="hierachical" targetRuntime="MyBatis3"> <!-- 自动识别数据库关键字段,默认false --> <property name="autoDelimitKeywords" value="false"/> <!-- 生成的Java文件的编码 --> <property name="javaFileEncoding" value="UTF-8"/> <!-- 格式化XML代码 --> <property name="xmlFormatter" value="org.mybatis.generator.api.dom.DefaultXmlFormatter"/> <!-- 指明数据库的用于标记数据库对象名的符号 --> <property name="beginningDelimiter" value='"'/> <property name="endingDelimiter" value='"'/> <!-- 连接oracle --> <jdbcConnection connectionURL="jdbc:oracle:thin:@localhost:1521:orcl" driverClass="oracle.jdbc.driver.OracleDriver" password="S123456" userId="c##refeal" /> <!-- Java类型处理器 --> <javaTypeResolver type="org.mybatis.generator.internal.types.JavaTypeResolverDefaultImpl"> <property name="forceBigDecimals" value="false"/> </javaTypeResolver> <!-- Java模型创建器 --> <javaModelGenerator targetPackage="com.SJY.domain" targetProject="src/main/java" /> <!-- for mabatis3 自动为每个生成的类创建一个构造方法 --> <property name="constructorBased" value="false"/> <!-- 在targetPachage的基础上,根据数据库的schema再生成一层package,最终生成的类放到这个package下 --> <property name="enableSubPackages" value="true"/> <!-- for MyBatis3 是否创建一个不可变类 --> <property name="immutable" value="false"/> <!-- 设置是否在getter方法中,对String类型字段调用trim()方法 --> <property name="rootClass" value="com.sjy.domain"/> <!-- 生成SQLmap的XML文件生成器 --> <sqlMapGenerator targetPackage="com.SJY.dao" targetProject="src/main/resources" /> <!-- 在targetPackage的基础上,根据数据库的schema再生成一层package --> <property name="enableSubPackages" value="true"/> <!-- 生成mapper接口 --> <javaClientGenerator targetPackage="com.SJY.domain" targetProject="src/main/java" type="XMLMAPPER" /> <!-- 在targetPackage的基础上,根据数据库的schema再生成一层package --> <property name="enableSubPackages" value="true"/> <!-- 与数据库相对应 --> <table schema="" tableName="SJY_YH_YHXXB" domainObjectName="YH_YHXXB" mapperName="YH_YHXXBMapper" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true"> <generatedKey column="USERID" sqlStatement="SELECT SJY_YH_YHXXB_SEQUENCE.nextval AS USERID from DUAL"/> <columnOverride column="USERID" property="???" /> </table> </context> </generatorConfiguration> ``` 表字段暂时可以无视吧
阿里巴巴连接池断开连接
环境:spring spring mvc mybatis的maven项目。 问题:使用阿里巴巴连接池、登录后如果不去操作等待5分钟的样子就会报错如下: 23:28:14.801 [Druid-ConnectionPool-Destroy-1512369669] ERROR com.alibaba.druid.util.JdbcUtils - close connection error java.sql.SQLRecoverableException: IO 错误: Software caused connection abort: recv failed at oracle.jdbc.driver.T4CConnection.logoff(T4CConnection.java:504) ~[ojdbc6-11.2.jar:11.2.0.1.0] at oracle.jdbc.driver.PhysicalConnection.close(PhysicalConnection.java:3754) ~[ojdbc6-11.2.jar:11.2.0.1.0] at com.alibaba.druid.filter.FilterChainImpl.connection_close(FilterChainImpl.java:169) ~[druid-1.0.20.jar:1.0.20] at com.alibaba.druid.filter.stat.StatFilter.connection_close(StatFilter.java:254) ~[druid-1.0.20.jar:1.0.20] at com.alibaba.druid.filter.FilterChainImpl.connection_close(FilterChainImpl.java:165) ~[druid-1.0.20.jar:1.0.20] at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.close(ConnectionProxyImpl.java:115) ~[druid-1.0.20.jar:1.0.20] at com.alibaba.druid.util.JdbcUtils.close(JdbcUtils.java:83) ~[druid-1.0.20.jar:1.0.20] at com.alibaba.druid.pool.DruidDataSource.shrink(DruidDataSource.java:2297) [druid-1.0.20.jar:1.0.20] at com.alibaba.druid.pool.DruidDataSource$DestroyTask.run(DruidDataSource.java:2084) [druid-1.0.20.jar:1.0.20] at com.alibaba.druid.pool.DruidDataSource$DestroyConnectionThread.run(DruidDataSource.java:2071) [druid-1.0.20.jar:1.0.20] Caused by: java.net.SocketException: Software caused connection abort: recv failed at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.7.0_67] at java.net.SocketInputStream.read(SocketInputStream.java:152) ~[na:1.7.0_67] at java.net.SocketInputStream.read(SocketInputStream.java:122) ~[na:1.7.0_67] at oracle.net.ns.Packet.receive(Packet.java:282) ~[ojdbc6-11.2.jar:11.2.0.1.0] at oracle.net.ns.DataPacket.receive(DataPacket.java:103) ~[ojdbc6-11.2.jar:11.2.0.1.0] at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:230) ~[ojdbc6-11.2.jar:11.2.0.1.0] at oracle.net.ns.NetInputStream.read(NetInputStream.java:175) ~[ojdbc6-11.2.jar:11.2.0.1.0] at oracle.net.ns.NetInputStream.read(NetInputStream.java:100) ~[ojdbc6-11.2.jar:11.2.0.1.0] at oracle.net.ns.NetInputStream.read(NetInputStream.java:85) ~[ojdbc6-11.2.jar:11.2.0.1.0] at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:122) ~[ojdbc6-11.2.jar:11.2.0.1.0] at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:78) ~[ojdbc6-11.2.jar:11.2.0.1.0] at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1179) ~[ojdbc6-11.2.jar:11.2.0.1.0] at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1155) ~[ojdbc6-11.2.jar:11.2.0.1.0] at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:279) ~[ojdbc6-11.2.jar:11.2.0.1.0] at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186) ~[ojdbc6-11.2.jar:11.2.0.1.0] at oracle.jdbc.driver.T4C7Ocommoncall.doOLOGOFF(T4C7Ocommoncall.java:61) ~[ojdbc6-11.2.jar:11.2.0.1.0] at oracle.jdbc.driver.T4CConnection.logoff(T4CConnection.java:491) ~[ojdbc6-11.2.jar:11.2.0.1.0] ... 9 common frames omitted 然后继续使用如果登录还未失效就会等很久才响应、页面才加载出来。​ 数据库使用的:oracle 配置如下: <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"> <!-- 数据库基本信息配置 --> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="filters" value="stat" /> <!-- 初始化连接数量 --> <property name="initialSize" value="1" /> <!-- 最小空闲连接数 --> <property name="minIdle" value="1" /> <!-- 最大并发连接数 --> <property name="maxActive" value="20" /> <!-- 配置获取连接等待超时的时间 --> <property name="maxWait" value="60000" /> <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 --> <property name="timeBetweenEvictionRunsMillis" value="60000" /> <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 --> <property name="minEvictableIdleTimeMillis" value="300000" /> <property name="removeAbandoned" value="true" /> <property name="removeAbandonedTimeout" value="1800" /> <!-- 申请连接的时候检测 --> <property name="testWhileIdle" value="true" /> <!-- 检测连接是否可用 --> <property name="validationQuery" value="SELECT 1 FROM DUAL" /> <!-- 申请连接时执行validationQuery检测连接是否有效 --> <property name="testOnBorrow" value="false" /> <!-- 归还连接时执行validationQuery检测连接是否有效 --> <property name="testOnReturn" value="false" /> <!-- 打开PSCache,并且指定每个连接上PSCache的大小 --> <property name="poolPreparedStatements" value="true" /> <property name="maxPoolPreparedStatementPerConnectionSize" value="20" /> </bean> ​ 请问有人知道怎么回事吗?
Exception in thread "main" java.lang.NoClassDefFoundError如何解决
本人初学Hibernate框架,网络上找的视频自学的,刚刚到第一次运行文件就出现这个错误,用的是eclipse,错误代码如下: ``` Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException at org.hibernate.boot.spi.XmlMappingBinderAccess.<init>(XmlMappingBinderAccess.java:43) at org.hibernate.boot.MetadataSources.<init>(MetadataSources.java:87) at org.hibernate.cfg.Configuration.<init>(Configuration.java:123) at org.hibernate.cfg.Configuration.<init>(Configuration.java:118) at cn.ljs.text.HibernateTest.main(HibernateTest.java:13) Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source) at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ... 5 more ``` 文件代码如下: ``` package cn.ljs.text; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; import cn.ljs.pojo.User; public class HibernateTest { public static void main(String[] args) { Configuration cfg=new Configuration().configure(); ServiceRegistry registry=new StandardServiceRegistryBuilder().applySettings(cfg.getProperties()).build(); SessionFactory factory=cfg.buildSessionFactory(registry); Session session=factory.openSession(); User user=(User) session.get(User.class, 1); System.out.println(user); session.close(); factory.close(); } } ``` 很简单,就是测试一下布置有没有问题 以下是包图: ![图片说明](https://img-ask.csdn.net/upload/201902/15/1550193069_565517.jpg) 跟着教学视频走的,代码无误,视频里直接输出了数据库表中的信息,而我就报错... 已自行百度后作出以下修改: ------------------------- 1.将jar包修改到classpath目录下, ![图片说明](https://img-ask.csdn.net/upload/201902/15/1550193227_189559.jpg) 无效 2.修改classpath等配置, ![图片说明](https://img-ask.csdn.net/upload/201902/15/1550193280_600490.jpg) ![图片说明](https://img-ask.csdn.net/upload/201902/15/1550193296_623025.jpg) path:D:\OracleWINDOWS.X64_180000_db_home\bin;%JAVA_HOME%\bin;%MAVEN_HOME%\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;D:\java\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\wbem 我半路出家,在外面培训班学过4个月java基础,学的是SSM框架,现在想自己拓展一下学习Hibernate,哪知道一开始就遇到这问题 o(╥﹏╥)o,请高手指点!谢谢!
MavenWeb项目使用mybatis的分页查询插件,在项目部署时出现错误
MavenWeb项目使用mybatis的分页查询插件,在项目部署时出现错误,在程序中 运行可以查询出来,但是我只要用tomcat启动项目就报错,把mybatis的分页插件 配置注掉后就又可以部署成功,有没有大佬知道是什么情况!?? 下面是报错信息 ``` D:\apache-tomcat-9.0.19\bin\catalina.bat run [2019-06-22 06:33:48,732] Artifact SSM整合:war exploded: Waiting for server connection to start artifact deployment... Using CATALINA_BASE: "C:\Users\95638\.IntelliJIdea2018.3\system\tomcat\Unnamed_SSM整合" Using CATALINA_HOME: "D:\apache-tomcat-9.0.19" Using CATALINA_TMPDIR: "D:\apache-tomcat-9.0.19\temp" Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_144" Using CLASSPATH: "D:\apache-tomcat-9.0.19\bin\bootstrap.jar;D:\apache-tomcat-9.0.19\bin\tomcat-juli.jar" 22-Jun-2019 18:33:49.881 警告 [main] org.apache.tomcat.util.digester.Digester.endElement No rules found matching [Server/Service/Context] 22-Jun-2019 18:33:49.917 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server.服务器版本: Apache Tomcat/9.0.19 22-Jun-2019 18:33:49.917 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server.构建: Apr 12 2019 14:22:48 UTC 22-Jun-2019 18:33:49.917 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.19.0 22-Jun-2019 18:33:49.917 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10 22-Jun-2019 18:33:49.917 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS.版本: 10.0 22-Jun-2019 18:33:49.917 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 结.造: amd64 22-Jun-2019 18:33:49.917 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java 环境变量: C:\Program Files\Java\jdk1.8.0_144\jre 22-Jun-2019 18:33:49.917 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM 版本: 1.8.0_144-b01 22-Jun-2019 18:33:49.917 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM.供应商: Oracle Corporation 22-Jun-2019 18:33:49.917 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Users\95638\.IntelliJIdea2018.3\system\tomcat\Unnamed_SSM整合 22-Jun-2019 18:33:49.917 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: D:\apache-tomcat-9.0.19 22-Jun-2019 18:33:49.918 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\95638\.IntelliJIdea2018.3\system\tomcat\Unnamed_SSM整合\conf\logging.properties 22-Jun-2019 18:33:49.918 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 22-Jun-2019 18:33:49.918 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote= 22-Jun-2019 18:33:49.918 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099 22-Jun-2019 18:33:49.918 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false 22-Jun-2019 18:33:49.918 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false 22-Jun-2019 18:33:49.918 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1 22-Jun-2019 18:33:49.918 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048 22-Jun-2019 18:33:49.918 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources 22-Jun-2019 18:33:49.918 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs= 22-Jun-2019 18:33:49.918 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\95638\.IntelliJIdea2018.3\system\tomcat\Unnamed_SSM整合 22-Jun-2019 18:33:49.918 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=D:\apache-tomcat-9.0.19 22-Jun-2019 18:33:49.918 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=D:\apache-tomcat-9.0.19\temp 22-Jun-2019 18:33:49.918 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.21] using APR version [1.6.5]. 22-Jun-2019 18:33:49.918 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 22-Jun-2019 18:33:49.919 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true] 22-Jun-2019 18:33:49.922 信息 [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1a 20 Nov 2018] 22-Jun-2019 18:33:50.039 信息 [main] org.apache.coyote.AbstractProtocol.init 初始化协议处理器 ["http-nio-8080"] 22-Jun-2019 18:33:50.062 信息 [main] org.apache.coyote.AbstractProtocol.init 初始化协议处理器 ["ajp-nio-8009"] 22-Jun-2019 18:33:50.066 信息 [main] org.apache.catalina.startup.Catalina.load 服务器在[448]毫秒内初始化 22-Jun-2019 18:33:50.094 信息 [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina] 22-Jun-2019 18:33:50.094 信息 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.19] 22-Jun-2019 18:33:50.107 信息 [main] org.apache.coyote.AbstractProtocol.start 开始协议处理句柄["http-nio-8080"] 22-Jun-2019 18:33:50.121 信息 [main] org.apache.coyote.AbstractProtocol.start 开始协议处理句柄["ajp-nio-8009"] 22-Jun-2019 18:33:50.124 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in [58] milliseconds Connected to server [2019-06-22 06:33:50,289] Artifact SSM整合:war exploded: Artifact is being deployed, please wait... 22-Jun-2019 18:33:52.765 信息 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars 至少有一个JAR被扫描用于TLD但尚未包含TLD。 为此记录器启用调试日志记录,以获取已扫描但未在其中找到TLD的完整JAR列表。 在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间。 22-Jun-2019 18:33:52.844 信息 [RMI TCP Connection(3)-127.0.0.1] org.springframework.web.context.ContextLoader.initWebApplicationContext Root WebApplicationContext: initialization started 22-Jun-2019 18:33:53.914 信息 [MLog-Init-Reporter] com.mchange.v2.log.MLog. MLog clients using java 1.4+ standard logging. 22-Jun-2019 18:33:53.996 信息 [RMI TCP Connection(3)-127.0.0.1] com.mchange.v2.c3p0.C3P0Registry. Initializing c3p0-0.9.5.4 [built 23-March-2019 23:00:48 -0700; debug? true; trace: 10] 22-Jun-2019 18:33:54.097 警告 [RMI TCP Connection(3)-127.0.0.1] org.springframework.context.support.AbstractApplicationContext.refresh Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'departmentService': Unsatisfied dependency expressed through field 'departmentMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'departmentMapper' defined in file [E:\SSM整合\out\artifacts\SSM_war_exploded\WEB-INF\classes\com\neuedu\dao\DepartmentMapper.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.xml]: Cannot create inner bean 'com.github.pagehelper.PageInterceptor#360582c8' of type [com.github.pagehelper.PageInterceptor] while setting bean property 'plugins' with key [0]; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.github.pagehelper.PageInterceptor] for bean with name 'com.github.pagehelper.PageInterceptor#360582c8' defined in class path resource [spring.xml]; nested exception is java.lang.ClassNotFoundException: com.github.pagehelper.PageInterceptor 22-Jun-2019 18:33:54.103 严重 [RMI TCP Connection(3)-127.0.0.1] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'departmentService': Unsatisfied dependency expressed through field 'departmentMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'departmentMapper' defined in file [E:\SSM整合\out\artifacts\SSM_war_exploded\WEB-INF\classes\com\neuedu\dao\DepartmentMapper.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.xml]: Cannot create inner bean 'com.github.pagehelper.PageInterceptor#360582c8' of type [com.github.pagehelper.PageInterceptor] while setting bean property 'plugins' with key [0]; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.github.pagehelper.PageInterceptor] for bean with name 'com.github.pagehelper.PageInterceptor#360582c8' defined in class path resource [spring.xml]; nested exception is java.lang.ClassNotFoundException: com.github.pagehelper.PageInterceptor at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1411) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:400) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:291) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4682) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5150) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:713) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1728) 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.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:289) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:457) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:406) 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.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:289) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) 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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'departmentMapper' defined in file [E:\SSM整合\out\artifacts\SSM_war_exploded\WEB-INF\classes\com\neuedu\dao\DepartmentMapper.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.xml]: Cannot create inner bean 'com.github.pagehelper.PageInterceptor#360582c8' of type [com.github.pagehelper.PageInterceptor] while setting bean property 'plugins' with key [0]; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.github.pagehelper.PageInterceptor] for bean with name 'com.github.pagehelper.PageInterceptor#360582c8' defined in class path resource [spring.xml]; nested exception is java.lang.ClassNotFoundException: com.github.pagehelper.PageInterceptor at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:314) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1681) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1433) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1251) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1171) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593) ... 60 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring.xml]: Cannot create inner bean 'com.github.pagehelper.PageInterceptor#360582c8' of type [com.github.pagehelper.PageInterceptor] while setting bean property 'plugins' with key [0]; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.github.pagehelper.PageInterceptor] for bean with name 'com.github.pagehelper.PageInterceptor#360582c8' defined in class path resource [spring.xml]; nested exception is java.lang.ClassNotFoundException: com.github.pagehelper.PageInterceptor at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:361) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:124) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedArray(BeanDefinitionValueResolver.java:388) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:155) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1681) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1433) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:303) ... 73 more Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.github.pagehelper.PageInterceptor] for bean with name 'com.github.pagehelper.PageInterceptor#360582c8' defined in class path resource [spring.xml]; nested exception is java.lang.ClassNotFoundException: com.github.pagehelper.PageInterceptor at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1392) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:487) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:346) ... 85 more Caused by: java.lang.ClassNotFoundException: com.github.pagehelper.PageInterceptor at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1363) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1186) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.springframework.util.ClassUtils.forName(ClassUtils.java:275) at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:444) at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1457) at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1384) ... 87 more 22-Jun-2019 18:33:54.140 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file 22-Jun-2019 18:33:54.142 严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors [2019-06-22 06:33:54,184] Artifact SSM整合:war exploded: Error during artifact deployment. See server log for details. 22-Jun-2019 18:34:00.118 信息 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [D:\apache-tomcat-9.0.19\webapps\manager] 22-Jun-2019 18:34:00.415 信息 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\apache-tomcat-9.0.19\webapps\manager] has finished in [297] ms ``` # springmvc.xml的配置 ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd"> <context:component-scan base-package="com.neuedu" use-default-filters="false"> <!--指定指挥扫描那些类型的注解,这里指定只会扫描com.neuedu下或子包中的注解@Controller。其他注解不扫描--> <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan> <!--导入依赖注入的注解解析器 --> <context:annotation-config></context:annotation-config> <!--开启基于注解的处理器映射器与处理器适配器 --> <mvc:annotation-driven ></mvc:annotation-driven> <!--配置吧静态资源交给tomcat来处理(springmvc框架就不要处理了) --> <mvc:default-servlet-handler></mvc:default-servlet-handler> <!-- 视图解析器 解析jsp解析,默认使用jstl标签,classpath下的得有jstl的包 --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <!-- 配置jsp路径的前缀 --> <property name="prefix" value="/WEB-INF/jsp/"/> <!-- 配置jsp路径的后缀 --> <property name="suffix" value=".jsp"/> </bean> </beans> ``` # spring.xml的配置 ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/cache" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"> <!--配置对service及dao包的扫描 --> <context:component-scan base-package="com.neuedu"> <!--配置对那些注解不进行扫描(不扫描注解@controller,因为他被springmvc扫描了) --> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan> <!--配置开启依赖注入的注解解析器(主要针对@Autoired,@Resource注解) --> <context:annotation-config/> <!--配置通过引入配置文件来进行数据库连接 --> <context:property-placeholder location="classpath:jdbc"/> <!--配置基于c3p0的数据库连接池,该类在c3p0对应的jar包中 --> <bean id="c3p0DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <!--配置数据库连接的基本属性 --> <property name="driverClass" value="${jdbc.driverClass}"/> <property name="jdbcUrl" value="${jdbc.dburl}"/> <property name="user" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> </bean> <!--配置sqlSessionFactory 该类在Mybatis-spring jar包中--> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <!--通过整合mybatis框架的核心配置文件,通过属性configLocation来指定 --> <property name="configLocation" value="classpath:mybatis-config.xml"/> <!--配置引用数据源(数据库连接池) --> <property name="dataSource" ref="c3p0DataSource"/> <!--配置加载那些mybatis框架中的映射文件 --> <property name="mapperLocations" value="classpath:mapper/*.xml"/> <!-- 在 Spring 配置文件中配置拦截器插件 --> <property name="typeAliasesPackage" value="com.isea533.mybatis.model"/> <property name="plugins"> <array> <bean class="com.github.pagehelper.PageInterceptor"> <!-- 这里的几个配置主要演示如何使用,如果不理解,一定要去掉下面的配置 --> <property name="properties"> <value> helperDialect=mysql reasonable=true supportMethodsArguments=true params=count=countSql autoRuntimeDialect=true </value> </property> </bean> </array> </property> </bean> <!--配置事务管理器类,该类在Spring-jdbc jar包中 --> <bean id="tx" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <!--关联数据源 --> <property name="dataSource" ref="c3p0DataSource"/> </bean> <!--配置开启基于注解的事务管理的注解解析器(@Transactional) --> <!--<tx:annotation-driven transaction-manager="tx"/>--> <!--配置dao曾家口的实现代理 --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <!--配置对那个包进行接口扫描 --> <property name="basePackage" value="com.neuedu.dao"/> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/> </bean> </beans> ``` # mybatis.xml的配置 ``` <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <settings> <setting name="mapUnderscoreToCamelCase" value="true"/> </settings> </configuration> ``` 来个大佬捞一手叭!
在中国程序员是青春饭吗?
今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...
《MySQL 性能优化》之理解 MySQL 体系结构
本文介绍 MySQL 的体系结构,包括物理结构、逻辑结构以及插件式存储引擎。
【资源】一个C/C++开发工程师的学习路线(已经无路可退,唯有逆风飞翔)【内附资源页】
声明: 1)该文章整理自网上的大牛和专家无私奉献的资料,具体引用的资料请看参考文献。 2)本文仅供学术交流,非商用。所以每一部分具体的参考资料并没有详细对应。如果某部分不小心侵犯了大家的利益,还望海涵,并联系博主删除。 3)博主才疏学浅,文中如有不当之处,请各位指出,共同进步,谢谢。 4)此属于第一版本,若有错误,还需继续修正与增删。还望大家多多指点。大家都共享一点点,一起为祖国科研的推进...
程序员请照顾好自己,周末病魔差点一套带走我。
程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。
20道你必须要背会的微服务面试题,面试一定会被问到
写在前面: 在学习springcloud之前大家一定要先了解下,常见的面试题有那块,然后我们带着问题去学习这个微服务技术,那么就会更加理解springcloud技术。如果你已经学了springcloud,那么在准备面试的时候,一定要看看看这些面试题。 文章目录1、什么是微服务?2、微服务之间是如何通讯的?3、springcloud 与dubbo有哪些区别?4、请谈谈对SpringBoot 和S...
达摩院十大科技趋势发布:2020 非同小可!
【CSDN编者按】1月2日,阿里巴巴发布《达摩院2020十大科技趋势》,十大科技趋势分别是:人工智能从感知智能向认知智能演进;计算存储一体化突破AI算力瓶颈;工业互联网的超融合;机器间大规模协作成为可能;模块化降低芯片设计门槛;规模化生产级区块链应用将走入大众;量子计算进入攻坚期;新材料推动半导体器件革新;保护数据隐私的AI技术将加速落地;云成为IT技术创新的中心 。 新的画卷,正在徐徐展开。...
轻松搭建基于 SpringBoot + Vue 的 Web 商城应用
首先介绍下在本文出现的几个比较重要的概念: 函数计算(Function Compute): 函数计算是一个事件驱动的服务,通过函数计算,用户无需管理服务器等运行情况,只需编写代码并上传。函数计算准备计算资源,并以弹性伸缩的方式运行用户代码,而用户只需根据实际代码运行所消耗的资源进行付费。Fun: Fun 是一个用于支持 Serverless 应用部署的工具,能帮助您便捷地管理函数计算、API ...
Python+OpenCV实时图像处理
目录 1、导入库文件 2、设计GUI 3、调用摄像头 4、实时图像处理 4.1、阈值二值化 4.2、边缘检测 4.3、轮廓检测 4.4、高斯滤波 4.5、色彩转换 4.6、调节对比度 5、退出系统 初学OpenCV图像处理的小伙伴肯定对什么高斯函数、滤波处理、阈值二值化等特性非常头疼,这里给各位分享一个小项目,可通过摄像头实时动态查看各类图像处理的特点,也可对各位调参、测试...
2020年一线城市程序员工资大调查
人才需求 一线城市共发布岗位38115个,招聘120827人。 其中 beijing 22805 guangzhou 25081 shanghai 39614 shenzhen 33327 工资分布 2020年中国一线城市程序员的平均工资为16285元,工资中位数为14583元,其中95%的人的工资位于5000到20000元之间。 和往年数据比较: yea...
为什么猝死的都是程序员,基本上不见产品经理猝死呢?
相信大家时不时听到程序员猝死的消息,但是基本上听不到产品经理猝死的消息,这是为什么呢? 我们先百度搜一下:程序员猝死,出现将近700多万条搜索结果: 搜索一下:产品经理猝死,只有400万条的搜索结果,从搜索结果数量上来看,程序员猝死的搜索结果就比产品经理猝死的搜索结果高了一倍,而且从下图可以看到,首页里面的五条搜索结果,其实只有两条才是符合条件。 所以程序员猝死的概率真的比产品经理大,并不是错...
害怕面试被问HashMap?这一篇就搞定了!
声明:本文以jdk1.8为主! 搞定HashMap 作为一个Java从业者,面试的时候肯定会被问到过HashMap,因为对于HashMap来说,可以说是Java集合中的精髓了,如果你觉得自己对它掌握的还不够好,我想今天这篇文章会非常适合你,至少,看了今天这篇文章,以后不怕面试被问HashMap了 其实在我学习HashMap的过程中,我个人觉得HashMap还是挺复杂的,如果真的想把它搞得明明白...
毕业5年,我问遍了身边的大佬,总结了他们的学习方法
我问了身边10个大佬,总结了他们的学习方法,原来成功都是有迹可循的。
python爬取百部电影数据,我分析出了一个残酷的真相
2019年就这么匆匆过去了,就在前几天国家电影局发布了2019年中国电影市场数据,数据显示去年总票房为642.66亿元,同比增长5.4%;国产电影总票房411.75亿元,同比增长8.65%,市场占比 64.07%;城市院线观影人次17.27亿,同比增长0.64%。 看上去似乎是一片大好对不对?不过作为一名严谨求实的数据分析师,我从官方数据中看出了一点端倪:国产票房增幅都已经高达8.65%了,为什...
推荐10个堪称神器的学习网站
每天都会收到很多读者的私信,问我:“二哥,有什么推荐的学习网站吗?最近很浮躁,手头的一些网站都看烦了,想看看二哥这里有什么新鲜货。” 今天一早做了个恶梦,梦到被老板辞退了。虽然说在我们公司,只有我辞退老板的份,没有老板辞退我这一说,但是还是被吓得 4 点多都起来了。(主要是因为我掌握着公司所有的核心源码,哈哈哈) 既然 4 点多起来,就得好好利用起来。于是我就挑选了 10 个堪称神器的学习网站,推...
这些软件太强了,Windows必装!尤其程序员!
Windows可谓是大多数人的生产力工具,集娱乐办公于一体,虽然在程序员这个群体中都说苹果是信仰,但是大部分不都是从Windows过来的,而且现在依然有很多的程序员用Windows。 所以,今天我就把我私藏的Windows必装的软件分享给大家,如果有一个你没有用过甚至没有听过,那你就赚了????,这可都是提升你幸福感的高效率生产力工具哦! 走起!???? NO、1 ScreenToGif 屏幕,摄像头和白板...
阿里面试,面试官没想到一个ArrayList,我都能跟他扯半小时
我是真的没想到,面试官会这样问我ArrayList。
曾经优秀的人,怎么就突然不优秀了。
职场上有很多辛酸事,很多合伙人出局的故事,很多技术骨干被裁员的故事。说来模板都类似,曾经是名校毕业,曾经是优秀员工,曾经被领导表扬,曾经业绩突出,然而突然有一天,因为种种原因,被裁员了,...
大学四年因为知道了这32个网站,我成了别人眼中的大神!
依稀记得,毕业那天,我们导员发给我毕业证的时候对我说“你可是咱们系的风云人物啊”,哎呀,别提当时多开心啦????,嗯,我们导员是所有导员中最帅的一个,真的???? 不过,导员说的是实话,很多人都叫我大神的,为啥,因为我知道这32个网站啊,你说强不强????,这次是绝对的干货,看好啦,走起来! PS:每个网站都是学计算机混互联网必须知道的,真的牛杯,我就不过多介绍了,大家自行探索,觉得没用的,尽管留言吐槽吧???? 社...
良心推荐,我珍藏的一些Chrome插件
上次搬家的时候,发了一个朋友圈,附带的照片中不小心暴露了自己的 Chrome 浏览器插件之多,于是就有小伙伴评论说分享一下我觉得还不错的浏览器插件。 我下面就把我日常工作和学习中经常用到的一些 Chrome 浏览器插件分享给大家,随便一个都能提高你的“生活品质”和工作效率。 Markdown Here Markdown Here 可以让你更愉快的写邮件,由于支持 Markdown 直接转电子邮...
看完这篇HTTP,跟面试官扯皮就没问题了
我是一名程序员,我的主要编程语言是 Java,我更是一名 Web 开发人员,所以我必须要了解 HTTP,所以本篇文章就来带你从 HTTP 入门到进阶,看完让你有一种恍然大悟、醍醐灌顶的感觉。 最初在有网络之前,我们的电脑都是单机的,单机系统是孤立的,我还记得 05 年前那会儿家里有个电脑,想打电脑游戏还得两个人在一个电脑上玩儿,及其不方便。我就想为什么家里人不让上网,我的同学 xxx 家里有网,每...
2020 年,大火的 Python 和 JavaScript 是否会被取而代之?
Python 和 JavaScript 是目前最火的两大编程语言,但是2020 年,什么编程语言将会取而代之呢? 作者 |Richard Kenneth Eng 译者 |明明如月,责编 | 郭芮 出品 | CSDN(ID:CSDNnews) 以下为译文: Python 和 JavaScript 是目前最火的两大编程语言。然而,他们不可能永远屹立不倒。最终,必将像其他编程语言一...
史上最全的IDEA快捷键总结
现在Idea成了主流开发工具,这篇博客对其使用的快捷键做了总结,希望对大家的开发工作有所帮助。
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
谁是华为扫地僧?
是的,华为也有扫地僧!2020年2月11-12日,“养在深闺人不知”的华为2012实验室扫地僧们,将在华为开发者大会2020(Cloud)上,和大家见面。到时,你可以和扫地僧们,吃一个洋...
AI 没让人类失业,搞 AI 的人先失业了
最近和几个 AI 领域的大佬闲聊 根据他们讲的消息和段子 改编出下面这个故事 如有雷同 都是巧合 1. 老王创业失败,被限制高消费 “这里写我跑路的消息实在太夸张了。” 王葱葱哼笑一下,把消息分享给群里。 阿杰也看了消息,笑了笑。在座几位也都笑了。 王葱葱是个有名的人物,21岁那年以全额奖学金进入 KMU 攻读人工智能博士,累计发表论文 40 余篇,个人技术博客更是成为深度学习领域内风向标。 ...
2020年,冯唐49岁:我给20、30岁IT职场年轻人的建议
点击“技术领导力”关注∆每天早上8:30推送 作者|Mr.K 编辑| Emma 来源|技术领导力(ID:jishulingdaoli) 前天的推文《冯唐:职场人35岁以后,方法论比经验重要》,收到了不少读者的反馈,觉得挺受启发。其实,冯唐写了不少关于职场方面的文章,都挺不错的。可惜大家只记住了“春风十里不如你”、“如何避免成为油腻腻的中年人”等不那么正经的文章。 本文整理了冯...
神级宝库!GitHub 标星 1.2w+,Chrome 最天秀的插件都在这里啦!
作者 | Rocky0429 来源 | Python空间 大家好,我是 Rocky0429,一个沉迷 Chrome 不能自拔的蒟蒻… 作为一个在远古时代用过什么 IE、360、猎豹等浏览器的资深器哥,当我第一次了解 Chrome 的时候,就被它的美貌给吸引住了… 就在我用了一段时间之后,我坚决的卸载了电脑上其它碍眼的浏览器,并觉得在之前的搬砖生涯中,我不配当哥,我只配是个沙雕… ...
作为一名大学生,如何在B站上快乐的学习?
B站是个宝,谁用谁知道???? 作为一名大学生,你必须掌握的一项能力就是自学能力,很多看起来很牛X的人,你可以了解下,人家私底下一定是花大量的时间自学的,你可能会说,我也想学习啊,可是嘞,该学习啥嘞,不怕告诉你,互联网时代,最不缺的就是学习资源,最宝贵的是啥? 你可能会说是时间,不,不是时间,而是你的注意力,懂了吧! 那么,你说学习资源多,我咋不知道,那今天我就告诉你一个你必须知道的学习的地方,人称...
那些年,我们信了课本里的那些鬼话
教材永远都是有错误的,从小学到大学,我们不断的学习了很多错误知识。 斑羚飞渡 在我们学习的很多小学课文里,有很多是错误文章,或者说是假课文。像《斑羚飞渡》: 随着镰刀头羊的那声吼叫,整个斑羚群迅速分成两拨,老年斑羚为一拨,年轻斑羚为一拨。 就在这时,我看见,从那拨老斑羚里走出一只公斑羚来。公斑羚朝那拨年轻斑羚示意性地咩了一声,一只半大的斑羚应声走了出来。一老一少走到伤心崖,后退了几步,突...
张朝阳回应迟到 1 分钟罚 500:资本家就得剥削员工
loonggg读完需要2分钟速读仅需 1 分钟大家我,我是你们的校长。前几天,搜狐的董事局主席兼 CEO 张朝阳和搜狐都上热搜了。原因很简单,就是搜狐出了“考勤新规”。一封搜狐对员工发布...
一个程序在计算机中是如何运行的?超级干货!!!
强烈声明:本文很干,请自备茶水!???? 开门见山,咱不说废话! 你有没有想过,你写的程序,是如何在计算机中运行的吗?比如我们搞Java的,肯定写过这段代码 public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } ...
【蘑菇街技术部年会】程序员与女神共舞,鼻血再次没止住。(文末内推)
蘑菇街技术部的年会,别开生面,一样全是美女。
那个在阿里养猪的工程师,5年了……
简介: 在阿里,走过1825天,没有趴下,依旧斗志满满,被称为“五年陈”。他们会被授予一枚戒指,过程就叫做“授戒仪式”。今天,咱们听听阿里的那些“五年陈”们的故事。 下一个五年,猪圈见! 我就是那个在养猪场里敲代码的工程师,一年多前我和20位工程师去了四川的猪场,出发前总架构师慷慨激昂的说:同学们,中国的养猪产业将因为我们而改变。但到了猪场,发现根本不是那么回事:要个WIFI,没有;...
为什么程序猿都不愿意去外包?
分享外包的组织架构,盈利模式,亲身经历,以及根据一些外包朋友的反馈,写了这篇文章 ,希望对正在找工作的老铁有所帮助
Java校招入职华为,半年后我跑路了
何来 我,一个双非本科弟弟,有幸在 19 届的秋招中得到前东家华为(以下简称 hw)的赏识,当时秋招签订就业协议,说是入了某 java bg,之后一系列组织架构调整原因等等让人无法理解的神操作,最终毕业前夕,被通知调往其他 bg 做嵌入式开发(纯 C 语言)。 由于已至于校招末尾,之前拿到的其他 offer 又无法再收回,一时感到无力回天,只得默默接受。 毕业后,直接入职开始了嵌入式苦旅,由于从未...
从顶级黑客到上市公司老板
一看标题,很多老读者就知道我在写什么了。今天Ucloud成功上市,季昕华成为我所熟悉的朋友里又双叒叕一个成功上市的案例。我们认识大概是十五年多吧,如果没记错,第一次见面应该是2004年,...
世界上有哪些代码量很少,但很牛逼很经典的算法或项目案例?
点击上方蓝字设为星标下面开始今天的学习~今天分享四个代码量很少,但很牛逼很经典的算法或项目案例。1、no code 项目地址:https://github.com/kelseyhight...
​两年前不知如何编写代码的我,现在是一名人工智能工程师
全文共3526字,预计学习时长11分钟 图源:Unsplash 经常有小伙伴私信给小芯,我没有编程基础,不会写代码,如何进入AI行业呢?还能赶上AI浪潮吗? 任何时候努力都不算晚。 下面,小芯就给大家讲一个朋友的真实故事,希望能给那些处于迷茫与徘徊中的小伙伴们一丝启发。(下文以第一人称叙述) 图源:Unsplash 正如Elsa所说,职业转换是...
强烈推荐10本程序员必读的书
很遗憾,这个春节注定是刻骨铭心的,新型冠状病毒让每个人的神经都是紧绷的。那些处在武汉的白衣天使们,尤其值得我们的尊敬。而我们这些窝在家里的程序员,能不外出就不外出,就是对社会做出的最大的贡献。 有些读者私下问我,窝了几天,有点颓丧,能否推荐几本书在家里看看。我花了一天的时间,挑选了 10 本我最喜欢的书,你可以挑选感兴趣的来读一读。读书不仅可以平复恐惧的压力,还可以对未来充满希望,毕竟苦难终将会...
立即提问