Stuck trying to use Hibernate for persistence

Discussion in 'Plugin Development' started by lose_the_grimm, Jan 21, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    lose_the_grimm

    Hey guys,

    I'm trying to use Hibernate for persistence and I was making some progress. I've shaded in the hibernate libraries as well as some of its dependencies but now I'm stuck. Apparantly Hibernate uses or extends javax.persistence and I'm getting the following exception:
    Code:
    21:26:31 [SEVERE] Error occurred while enabling Haversack v1.1 (Is it up to date?)
    java.lang.SecurityException: sealing violation: package javax.persistence is sealed
            at java.net.URLClassLoader.defineClass(Unknown Source)
            at java.net.URLClassLoader.access$000(Unknown Source)
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader.java:80)
            at org.bukkit.plugin.java.JavaPluginLoader.getClassByName0(JavaPluginLoader.java:300)
            at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader.java:76)
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:53)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at org.hibernate.cfg.AnnotationBinder.determineCacheSettings(AnnotationBinder.java:958)
            at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:579)
            at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3443)
            at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3397)
            at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1341)
            at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)
            at st.fivepoints.haversack.Haversack.configureSessionFactory(Haversack.java:117)
            at st.fivepoints.haversack.Haversack.initializeHibernate(Haversack.java:80)
            at st.fivepoints.haversack.Haversack.onEnable(Haversack.java:71)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
            at org.bukkit.craftbukkit.v1_4_6.CraftServer.loadPlugin(CraftServer.java:282)
            at org.bukkit.craftbukkit.v1_4_6.CraftServer.enablePlugins(CraftServer.java:264)
            at net.minecraft.server.v1_4_6.MinecraftServer.j(MinecraftServer.java:321)
            at net.minecraft.server.v1_4_6.MinecraftServer.e(MinecraftServer.java:300)
            at net.minecraft.server.v1_4_6.MinecraftServer.a(MinecraftServer.java:259)
            at net.minecraft.server.v1_4_6.DedicatedServer.init(DedicatedServer.java:149)
            at net.minecraft.server.v1_4_6.MinecraftServer.run(MinecraftServer.java:399)
            at net.minecraft.server.v1_4_6.ThreadServerApplication.run(SourceFile:849)
    My understanding is that javax.persistence is also a dependency of Bukkit and trying to include both is causing an issue. I have no clue how to get around this or what the solution might be. Can any of you point me in the right direction? I haven't had much luck googling a solution. I'm probably not using the right search terms though. Any help would be appreciated. Thanks!

    P.S. I believe the offending library is: hibernate-jpa-2.0-api-1.0.1.Final.jar
     
  2. Offline

    TOdkommt

    I know this thread is really old, however I had the same issue and found the source of the issue. There is a global jar seal in the bukkit manifest which shouldn't be there, hence sealing all third party packages. I already opened an issue to fix this problem, as there is unfortunately no workaround.
     
  3. Offline

    wiigor

    I had exactly the same issue. After wrestling to find out how to load an external jar from within a craftbukkit plugin. I ran into the same exception:
    Code:
    java.lang.SecurityException: sealing violation: package javax.persistence is sealed
    The fix was easy. Just edit the craftbukkit.jar with a unzip tool and edit manifest.mf removing the line
    Sealed: true

    The best solution would be to report this issue using the issue tracker of bukkit so they can remove the global seal.
     
Thread Status:
Not open for further replies.

Share This Page