ixrjog / opscloud4

云上运维
Apache License 2.0
1.32k stars 509 forks source link

貌似windows下跑不起来 #32

Closed JamesLiAndroid closed 4 years ago

JamesLiAndroid commented 4 years ago
  1. 环境
  1. 配置信息
  1. 错误日志
2020-09-06 09:27:04.468 ERROR 6640 --- [           main] o.s.b.web.embedded.tomcat.TomcatStarter  : Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'authFilter': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authBaseFacadeImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ocAuthResourceServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ocAuthResourceMapper' defined in file [D:\Dev\DevOps\opscloud\opscloud-service\target\classes\com\baiyi\opscloud\mapper\opscloud\OcAuthResourceMapper.class]: Cannot resolve reference to bean 'opscloudSqlSessionTemplate' while setting bean property 'sqlSessionTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'opscloudSqlSessionTemplate' defined in class path resource [com/baiyi/opscloud/config/DatasourceOpscloudConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.mybatis.spring.SqlSessionTemplate]: Factory method 'opscloudSqlSessionTemplate' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'opscloudDataSourceSqlSessionFactory' defined in class path resource [com/baiyi/opscloud/config/DatasourceOpscloudConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'opscloudDataSourceSqlSessionFactory' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'opscloudDataSource' defined in class path resource [com/baiyi/opscloud/config/DatasourceOpscloudConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'opscloudDataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2020-09-06 09:27:04.524  INFO 6640 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2020-09-06 09:27:04.543  WARN 6640 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2020-09-06 09:27:04.553  INFO 6640 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-09-06 09:27:04.568 ERROR 6640 --- [           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 (the profiles open are currently active).

Process finished with exit code 1

搞了一早上搞不太明白,我数据库信息已经导入3.0.1版本的sql文件了,而且我本地用工具连接数据库是正常的。

请指教,谢谢

ixrjog commented 4 years ago

application-dev*.yml配置文件没有提交,你可以用prod配置文件开发

ixrjog commented 4 years ago

./opscloud-manage/pom.xml 文件内容

  <profiles>
        <profile>
            <id>dev</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <env>dev</env>
            </properties>
        </profile>
        <profile>
            <id>test</id>
            <properties>
                <env>test</env>
            </properties>
        </profile>
        <profile>
            <id>open</id>
            <properties>
                <env>open</env>
            </properties>
        </profile>
        <profile>
            <id>pre</id>
            <properties>
                <env>pre</env>
            </properties>
        </profile>
        <profile>
            <id>prod</id>
            <properties>
                <env>prod</env>
            </properties>
        </profile>
    </profiles>

修改为

  <profiles>
        <profile>
            <id>dev</id>
            <properties>
                <env>dev</env>
            </properties>
        </profile>
        <profile>
            <id>test</id>
            <properties>
                <env>test</env>
            </properties>
        </profile>
        <profile>
            <id>open</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <env>open</env>
            </properties>
        </profile>
        <profile>
            <id>pre</id>
            <properties>
                <env>pre</env>
            </properties>
        </profile>
        <profile>
            <id>prod</id>
            <properties>
                <env>prod</env>
            </properties>
        </profile>
    </profiles>
JamesLiAndroid commented 4 years ago

已解决,谢谢!