brettwooldridge / HikariCP

光 HikariCP・A solid, high-performance, JDBC connection pool at last.
Apache License 2.0
19.85k stars 2.92k forks source link

ClassNotFoundException While ShuttingDown Apache Felix Using H2 #933

Open xipki opened 7 years ago

xipki commented 7 years ago

Environment

HikariCP version: 2.6.2
JDK version     : 1.8.0_121
Database        : H2
Driver version  : 1.4.196

I got the same error as #298, even the DataSource is closed explicty. I use apache karaf 4.0.9, HikariCP 2.6.2 and H2 database 1.4.196. The maven project to reproduce the bug is attached.

The steps to reproduce the bug are as follows (hikaricp-h2-bug*.jar will be generated contained in the attached file):

  1. Unzip the attached zip-file, and then
    mvn clean install
  2. Download the apache-karaf from https://repository.apache.org/content/groups/public/org/apache/karaf/apache-karaf/4.0.9/apache-karaf-4.0.9.tar.gz
  3. Unzip the tgz-file
  4. Start the karaf
    bin/karaf
  5. In the karaf console, execute the following commands:
    karaf@root()> karaf@root()> install mvn:com.h2database/h2/1.4.196
    Bundle ID: 52
    karaf@root()> install mvn:com.zaxxer/HikariCP/2.6.2
    Bundle ID: 53
    karaf@root()> install mvn:foo/hikaricp-h2-bug/0.1.0-SNAPSHOT
    Bundle ID: 54
    karaf@root()> start 54
    Created H2 DataSoruce
    karaf@root()> list
    START LEVEL 100 , List Threshold: 50
    ID | State    | Lvl | Version        | Name
    ---------------------------------------------------------
    52 | Resolved |  80 | 1.4.196        | H2 Database Engine
    53 | Resolved |  80 | 2.6.2          | HikariCP
    54 | Active   |  80 | 0.1.0.SNAPSHOT | hikaricp-h2-bug
    karaf@root()> uninstall 54
    Closing H2 DataSoruce
    Closed H2 DataSoruce
    karaf@root()> shutdown -f
    karaf@root()>
    WARNING: EventAdmin: Exception: java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@55e2fae6 rejected from java.util.concurrent.ThreadPoolExecutor@d37a7f1[Shutting down, pool size = 8, active threads = 0, queued tasks = 0, completed tasks = 822] (java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@55e2fae6 rejected from java.util.concurrent.ThreadPoolExecutor@d37a7f1[Shutting down, pool size = 8, active threads = 0, queued tasks = 0, completed tasks = 822])
    Exception in thread "Thread-18" java.lang.NoClassDefFoundError: org/h2/mvstore/MVMap$2
    at org.h2.mvstore.MVMap.entrySet(MVMap.java:870)
    at org.h2.store.LobStorageMap.removeAllForTable(LobStorageMap.java:314)
    at org.h2.engine.Database.removeOrphanedLobs(Database.java:1340)
    at org.h2.engine.Database.close(Database.java:1261)
    at org.h2.engine.DatabaseCloser.run(DatabaseCloser.java:63)
    Caused by: java.lang.ClassNotFoundException: Unable to load class 'org.h2.mvstore.MVMap$2' because the bundle wiring for org.h2 is no longer valid.
    at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1515)
    at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:79)
    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1958)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 5 more

    hikaricp-h2-bug.zip

brettwooldridge commented 7 years ago

@xipki Thanks for the zip, but I don't have a Karaf installation, so it doesn't help that much.

xipki commented 7 years ago

@brettwooldridge Thanks for excellent project. I updated the issue description.