找不到驱动程序:[com.mysql.jdbc.Driver]播放框架

时间:2017-02-10 09:17:45

标签: java database hibernate jdbc playframework

无论我做什么,它都会不断抛出这个错误。我添加了依赖项,我添加了jar,我还在application.conf中进行了必要的更改。不知道出了什么问题。

我的application.conf:

const drDefaultStyles = {
  container: {

  },

  header: {
    borderBottom: 'solid 1px #dddddd',
    color: '#898989',
    textAlign:'left',
    marginBottom: '20px',
  },

  header_title: {
    fontSize: '14px',
    fontStyle: 'italic',
    fontFamily: 'Platino',
    textTransform: 'capitalize',
    margin: 0,
    fontWeight: 100,
  },

  tall: {
    height: '250px',
  },

  half_tall: {
    height: '120px',
  },

  image_container: {
    position: 'relative',
    width: '100%',
    height: '100%',
    background: 'rgb(245, 245, 245)',
    padding: '10px',
  },

  image: {
    width: '100%',
    height: '100%',
    backgroundSize: 'cover',
    backgroundPosition: 'center center',
    backgroundRepeat: 'no-repeat',
  },

  title: {
    position: 'absolute',
    display: 'inline-block',
    bottom: '25px',
    background: 'rgba(245, 245, 245, .85)',
    textTransform: 'uppercase',
    padding: '7px 15px',
  },
}


<section className="container" style={ _s.container }>
      <div className="row" style={ _s.header }>
        <h2 style={ _s.header_title }>Destination races</h2>
      </div>

      <div className="row" style={ _s.container }>
        <div className="col-lg-4 col-md-4 col-sm-4 col-xs-4" style={{ ..._s.tall, paddingLeft: 0, paddingRight: '5px' }}>
          <div style={ _s.image_container }>
            <div style={{ ..._s.image, backgroundImage: 'url(/images/cities/leadville.jpg)' }}></div>
            <span style={ _s.title }>Leadville</span>
          </div>
        </div>

        <div className="col-lg-4 col-md-4 col-sm-4 col-xs-4" style={{ padding: 0 }}>
          <div className="col-lg-12 col-md-12 col-sm-12 col-xs-12" style={{ ..._s.half_tall, marginBottom: '10px', padding: 0 }}>
            <div style={ _s.image_container }>
              <div style={{ ..._s.image, backgroundImage: 'url(/images/cities/san-francisco.jpg)' }}></div>
              <span style={ _s.title }>San Francisco</span>
            </div>
          </div>

          <div className="col-lg-5 col-md-5 col-sm-5 col-xs-5" style={{ ..._s.half_tall, float: 'left', padding: 0, paddingRight: '5px' }}>
            <div style={ _s.image_container }>
              <div style={{ ..._s.image, backgroundImage: 'url(/images/cities/miami.jpg)' }}></div>
              <span style={ _s.title }>Miami</span>
            </div>
          </div>

          <div className="col-lg-7 col-md-7 col-md-7 col-xs-7"  style={{ ..._s.half_tall, float: 'left', padding: 0 }}>
            <div style={ _s.image_container }>
              <div style={{ ..._s.image, backgroundImage: 'url(/images/cities/chicago.jpg)' }}></div>
              <span style={ _s.title }>Chicago</span>
            </div>
          </div>
        </div>

        <div className="col-lg-4 col-md-4 col-sm-4 col-xs-4" style={{ ..._s.tall, paddingLeft: '5px', paddingRight: 0 }}>
          <div style={ _s.image_container }>
            <div style={{ ..._s.image, backgroundImage: 'url(/images/cities/new-york.jpg)' }}></div>
            <span style={ _s.title }>New York City</span>
          </div>
        </div>
      </div>

</section>

我的Build.scala

db.default.driver=com.mysql.jdbc.Driver
db.default.url="mysql://127.0.0.1:3306"
db.default.user=root
db.default.password="password"

我的plugin.sbt文件:

val appDependencies = Seq(
    "mysql" % "mysql-connector-java" % "5.1.40"
)
// i am using mysql 5.7.17, connector/j is 5.1.40

它仍然不断抛出相同的错误。我正在使用2.2.6游戏!

3 个答案:

答案 0 :(得分:0)

db.default.driver=com.mysql.jdbc.Driver
**db.default.url="jdbc:mysql://127.0.0.1:3306/databaseName"**
db.default.user=root
db.default.password="password"

网址错误???

答案 1 :(得分:0)

使用正确的字符编码正确配置MySQL数据库:

db.default.driver=com.mysql.jdbc.Driver

db.default.url="jdbc:mysql://127.0.0.1:3306/databaseName?characterEncoding=UTF-8"

db.default.user=root

db.default.password="password"

答案 2 :(得分:0)

删除您的配置

使用您的数据库详细信息在application.conf中添加以下行。

db.default.driver="com.mysql.jdbc.Driver"
db.default.url="jdbc:mysql://localhost:3306/dbName"
db.default.user="user"
db.default.password="password"

为build.sbt添加依赖

"mysql" % "mysql-connector-java" % "5.1.30"

然后执行activator run

如果仍然无效,请尝试

activator clean
activator run