简体   繁体   English

如何打包hibernate-memcached以在JBoss 7中使用它

[英]how to package hibernate-memcached to use it in JBoss 7

I have been trying to set up a Java EE Application on JBOSS AS 7 to use hibernate-memcached as a second level cache. 我一直在尝试在JBOSS AS 7上设置Java EE应用程序,以将hibernate-memcached用作第二级缓存。 The goal is to be able to scale at JPA level and to use a clustered cache. 目标是能够在JPA级别上扩展并使用集群缓存。 I've tried to manually put the jar in jboss modules but I am getting this errors. 我尝试将jar手动放入jboss模块,但出现此错误。 here are some of those errors: 这是其中一些错误:

Caused by: org.hibernate.cache.CacheException: could not instantiate CacheProvider [com.googlecode.hibernate.memcached.MemcachedCacheProvider]
    at org.hibernate.cache.internal.bridge.RegionFactoryCacheProviderBridge.<init>(RegionFactoryCacheProviderBridge.java:68)
    ... 24 more
Caused by: java.lang.ClassNotFoundException: com.googlecode.hibernate.memcached.MemcachedCacheProvider from [Module "org.hibernate:main" from local module loader @1839bb3 (roots: C:\jboss-7.0.0\modules)]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101)
    at java.lang.Class.forName0(Native Method) [:1.7.0_03]
    at java.lang.Class.forName(Class.java:186) [:1.7.0_03]
    at org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:191)
    at org.hibernate.cache.internal.bridge.RegionFactoryCacheProviderBridge.<init>(RegionFactoryCacheProviderBridge.java:65)
    ... 24 more

How can I fix these errors? 如何解决这些错误?

A couple of ways come to mind: 有两种方法可以想到:

  • Define a new hibernate-memcached module, and add a dependency to it in the main hibernate module; 定义一个新的hibernate-memcached模块,并在主hibernate模块中添加一个依赖关系; or 要么

  • just add the hibernate-memcached JARs to the main hibernate module and add them as resource-roots in module.xml . 只需将hibernate-memcached JAR添加到主要的hibernate模块中,然后将它们作为resource-roots添加到module.xml

For details on how to create and modify modules see the documentation on class loading and modules in AS7 . 有关如何创建和修改模块的详细信息,请参见AS7中有关类加载和模块文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM