启动spark-shell遇到的问题

Caused by: org.apache.derby.iapi.error.StandardException: Failed to start database 'metastore_db' with class loader org.apache.spark.sql.hive.client.IsolatedClientLoader$$anon$1@52354202, see the next exception for details.
  at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
  at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown Source)
  ... 153 more
Caused by: org.apache.derby.iapi.error.StandardException: Another instance of Derby may have already booted the database /opt/module/spark/metastore_db.
  at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
  at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
  at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.privGetJBMSLockOnDB(Unknown Source)
  at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.run(Unknown Source)
  at java.security.AccessController.doPrivileged(Native Method)
  at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.getJBMSLockOnDB(Unknown Source)
  at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.boot(Unknown Source)
  at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
  at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
  at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
  at org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown Source)
  at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source)
  at org.apache.derby.impl.store.raw.RawStore$6.run(Unknown Source)
  at java.security.AccessController.doPrivileged(Native Method)
  at org.apache.derby.impl.store.raw.RawStore.bootServiceModule(Unknown Source)
  at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source)
  at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
  at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
  at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
  at org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown Source)
  at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source)
  at org.apache.derby.impl.store.access.RAMAccessManager$5.run(Unknown Source)
  at java.security.AccessController.doPrivileged(Native Method)
  at org.apache.derby.impl.store.access.RAMAccessManager.bootServiceModule(Unknown Source)
  at org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown Source)
  at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
  at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
  at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
  at org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown Source)
  at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source)
  at org.apache.derby.impl.db.BasicDatabase$5.run(Unknown Source)
  at java.security.AccessController.doPrivileged(Native Method)
  at org.apache.derby.impl.db.BasicDatabase.bootServiceModule(Unknown Source)
  at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Source)
  at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source)
  at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
  at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
  at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown Source)
  at org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(Unknown Source)
  at org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(Unknown Source)
  at org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Unknown Source)
  at org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknown Source)
  at org.apache.derby.impl.jdbc.EmbedConnection$4.run(Unknown Source)
  at org.apache.derby.impl.jdbc.EmbedConnection$4.run(Unknown Source)
  at java.security.AccessController.doPrivileged(Native Method)
  at org.apache.derby.impl.jdbc.EmbedConnection.startPersistentService(Unknown Source)
  ... 150 more
:14: error: not found: value spark
       import spark.implicits._
              ^
:14: error: not found: value spark
       import spark.sql
              ^
Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /___/ .__/\_,_/_/ /_/\_\   version 2.1.1
      /_/
         
Using Scala version 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_144)
Type in expressions to have them evaluated.
Type :help for more information.

scala>

删除Spark目录下的metastore_db即可

重新启动Spark即可

你可能感兴趣的:(Spark)