导入不了项目

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

10回答
好帮手慕柯南 2020-04-07 18:24:51

同学你的jar包引入错了,应该是junit下的包

http://img1.sycdn.imooc.com//climg/5e8c54ef0910656403420083.jpg

祝学习愉快~

  • 提问者 weixin_慕瓜9083905 #1
    主要是我依赖引的也是1.5.8但是看maven依赖里是黑的 也用不了 已经发在刚才的截图
    2020-04-07 18:30:14
  • 请问,你将junit引入的包改了之后还报错吗?看你的截图中springboot的内容并没有报错。如果改了之后还报错,你可以按之前的方法更新一下maven,试试。祝学习愉快~
    2020-04-07 19:20:28
  • 在maven里删除lastUpdate文件后重新下载项目还是不行报错 *************************** APPLICATION FAILED TO START *************************** Description: Cannot determine embedded database driver class for database type NONE Action: If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
    2020-04-07 19:30:27
提问者 weixin_慕瓜9083905 2020-04-07 17:38:57


http://img1.sycdn.imooc.com//climg/5e8c49f70997772512220598.jpg

依赖是黑的

http://img1.sycdn.imooc.com//climg/5e8c4a0b09a715ce06110139.jpg

http://img1.sycdn.imooc.com//climg/5e8c4a160982fc0604180075.jpg还有src/test/java报错


http://img1.sycdn.imooc.com//climg/5e8c4a2d09e63fbe04290236.jpg

好帮手慕柯南 2020-04-07 17:25:25

同学你好!

你的错误原因:

springboot在启动时会自动加载数据库的配置信息,但是你的项目中应该是没有配置的,所以报错了。

老师的没有报错时因为老师使用springboot版本比较低。你的版本较高导致的。

建议你使用和老师一样的版本,避免在后期学习时由于版本问题导致错误

http://img1.sycdn.imooc.com//climg/5e8c470209c8572906430210.jpg

祝学习愉快~



提问者 weixin_慕瓜9083905 2020-04-07 16:56:55

现在控制台报错

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.

2020-04-07 16:55:22.354 ERROR 38760 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 


***************************

APPLICATION FAILED TO START

***************************


Description:


Cannot determine embedded database driver class for database type NONE


Action:


If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).


提问者 weixin_慕瓜9083905 2020-04-07 15:32:15

控制台输入:

  .   ____          _            __ _ _

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )

  '  |____| .__|_| |_|_| |_\__, | / / / /

 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::        (v2.2.6.RELEASE)


2020-04-07 15:27:15.920  INFO 62784 --- [           main] com.imooc.o2o.O2oApplication             : Starting O2oApplication on SC-201703152226 with PID 62784 (E:\o2o1\target\classes started by Administrator in E:\o2o1)

2020-04-07 15:27:15.988  INFO 62784 --- [           main] com.imooc.o2o.O2oApplication             : No active profile set, falling back to default profiles: default

2020-04-07 15:27:18.826  WARN 62784 --- [           main] o.m.s.mapper.ClassPathMapperScanner      : No MyBatis mapper was found in '[com.imooc.o2o]' package. Please check your configuration.

2020-04-07 15:27:20.711  INFO 62784 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)

2020-04-07 15:27:20.812  INFO 62784 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]

2020-04-07 15:27:20.813  INFO 62784 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.33]

2020-04-07 15:27:21.023  INFO 62784 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext

2020-04-07 15:27:21.023  INFO 62784 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 4448 ms

2020-04-07 15:27:21.556  INFO 62784 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'

2020-04-07 15:27:21.913  WARN 62784 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class

2020-04-07 15:27:21.913  INFO 62784 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'

2020-04-07 15:27:21.919  INFO 62784 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]

2020-04-07 15:27:21.961  INFO 62784 --- [           main] ConditionEvaluationReportLoggingListener : 


Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2020-04-07 15:27:21.965 ERROR 62784 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 


***************************

APPLICATION FAILED TO START

***************************


Description:


Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

 


Reason: Failed to determine a suitable driver class



Action:


Consider the following:

If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.

If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).


打开不了localhost:8080/hello

好帮手慕柯南 2020-04-07 13:44:14

同学你好!

参考之前的方式在maven仓库中,将以下路径中的“xxx.lastUpdated”文件全都删掉。刷新一下项目测试一下。

http://img1.sycdn.imooc.com//climg/5e8c12b3097fccfa06670110.jpg

另外这个jar应该并没有用到,你可以试一下是否影响项目的运行。

祝学习愉快~

提问者 weixin_慕瓜9083905 2020-04-07 10:13:44

http://img1.sycdn.imooc.com//climg/5e8be14909d45a6713770733.jpg


Failure to transfer org.junit.jupiter:junit-jupiter-engine:jar:5.5.2 from https://repo.maven.apache.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. Original error: Could not transfer artifact org.junit.jupiter:junit-jupiter-engine:jar:5.5.2 from/to central (https://repo.maven.apache.org/maven2): GET request of: org/junit/jupiter/junit-jupiter-engine/5.5.2/junit-jupiter-engine-5.5.2.jar from central failed


org.eclipse.aether.transfer.ArtifactTransferException: Failure to transfer org.junit.jupiter:junit-jupiter-engine:jar:5.5.2 from https://repo.maven.apache.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. Original error: Could not transfer artifact org.junit.jupiter:junit-jupiter-engine:jar:5.5.2 from/to central (https://repo.maven.apache.org/maven2): GET request of: org/junit/jupiter/junit-jupiter-engine/5.5.2/junit-jupiter-engine-5.5.2.jar from central failed

at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:226)

at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:192)

at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:564)

at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:482)

at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:400)

at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:225)

at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:335)

at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:202)

at org.apache.maven.project.DefaultProjectBuilder.resolveDependencies(DefaultProjectBuilder.java:225)

at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:198)

at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:122)

at org.eclipse.m2e.core.internal.embedder.MavenImpl.readMavenProject(MavenImpl.java:630)

at org.eclipse.m2e.core.internal.project.registry.DefaultMavenDependencyResolver.resolveProjectDependencies(DefaultMavenDependencyResolver.java:63)

at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refreshPhase2(ProjectRegistryManager.java:551)

at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.lambda$2(ProjectRegistryManager.java:515)

at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)

at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)

at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:513)

at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:365)

at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:312)

at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:405)

at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:352)

at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:1)

at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)

at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)

at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)

at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1370)

at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:349)

at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace


还有这个报错

好帮手慕柯南 2020-04-07 10:00:27

同学你好!

你这个jar还是没有下载下来,可能是由于maven本地仓库的缓存导致始终无法下载,建议你:

  1. 将这里设置的maven镜像删除,删除后会默认使用maven配置的setting文件中的maven镜像

    http://img1.sycdn.imooc.com//climg/5e8bdd6a09de726906960208.jpg

  2. Eclipse→Window→Preferences,查看自己本地仓库的地址,如图:

    http://img1.sycdn.imooc.com//climg/5e8bddff09bb883612950472.jpg

  3. .打开maven仓库目录,进入org\apache\maven目录,形如:

    D:\CatMessage\maven\repository\org\apache\maven(注意这里应该是你自己的地址)

    然后搜索关键字:“lastUpdated”,

    将搜索到的“xxx.lastUpdated”文件全都删掉

    http://img1.sycdn.imooc.com//climg/5e8bde930960f1b513920657.jpg

  4. 选中maven项目,右键--》maven--》update让maven重新下载依赖包,注意要保持网络畅通

祝学习愉快~

提问者 weixin_慕瓜9083905 2020-04-06 19:23:05

http://img1.sycdn.imooc.com//climg/5e8b101309c1240a00000000.jpg

pom文件下载报错这个

http://img1.sycdn.imooc.com//climg/5e8b10d0095176e413090813.jpg

而且我这个src上面没有这个

http://img1.sycdn.imooc.com//climg/5e8b111209250b4b02400085.jpg


好帮手慕柯南 2020-04-06 11:53:00

同学你好!

提示信息这个项目已经存在了

http://img1.sycdn.imooc.com//climg/5e8aa743096803f505850154.jpg

建议你将原来的删除,然后再进行导入

http://img1.sycdn.imooc.com//climg/5e8aa75e0949e32102800122.jpg

祝学习愉快~


问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师