java ClassNotFoundException for org.h2.Driver

前端 未结 13 2531
被撕碎了的回忆
被撕碎了的回忆 2021-01-01 10:40

I am trying to use H2 to connect to a database in Java (using Eclipse as the IDE). The sample does (below) throws a ClassNotFoundException. The thing is, I

13条回答
  •  灰色年华
    2021-01-01 11:10

    In my case (unrelated a bit, but worth mentioning), I added this to my maven pom, and the error message went away:

      
        com.h2database
        h2
        xxx 
      
    

    or if you are only using h2 during unit testing:

      
        com.h2database
        h2
        xxx 
        test
      
    

提交回复
热议问题