开发者

Hibernate Search with JPA

I want to use hibernate search +JPA in ejb3 project, i'm using jboss 5 AS and I have deployment error, i don't know why....

my entities:

package kz.edu.sdu.sea.apps.ejb.db;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import org.hibernate.search.annotations.Store;

@Entity
@Indexed
@Table(name="links")
public class Link {
private Long linkId;
private String link;
private String linkText;
private int priority;
private Page page;

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="link_id")
public Long getLinkId() {
    return linkId;
}
public void setLinkId(Long linkId) {
    this.linkId = linkId;
}

public String getLink() {
    return link;
}
public void setLink(String link) {
    this.link = link;
}

@Column(name="link_text")
@Field(index=Index.TOKENIZED, store=Store.NO)
public String getLinkText() {
    return linkText;
}
public void setLinkText(String linkText) {
    this.linkText = linkText;
}

public int getPriority() {
    return priority;
}
public void setPriority(int priority) {
    this.priority = priority;
}

@IndexedEmbedded
@OneToOne
@JoinColumn(name="link_id")
public Page getPage() {
    return page;
}
public void setPage(Page page) {
    this.page = page;
}

}

package kz.edu.sdu.sea.apps.ejb.db;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Store;


@Entity
@Table(name="pages")
public class Page {
private Long pageId;
private String content;
private String title;
private String description;
private Link link;

@Id
@Column(name="page_id")
public Long getPageId() {
    return pageId;
}
public void setPageId(Long pageId) {
    this.pageId = pageId;
}

@Column(columnDefinition="text")
@Field(index=Index.TOKENIZED, store=Store.NO)
public String getContent() {
    return content;
}
public void setContent(String content) {
    this.content = content;
}

@Field(index=Index.TOKENIZED, store=Store.NO)
public String getTitle() {
    return title;
}
public void setTitle(String title) {
    this.title = title;
}

@Column(columnDefinition="text")
@Field(index=Index.TOKENIZED, store=Store.NO)
public String getDescription() {
    return description;
}
public void setDescription(String description) {
    this.description = description;
}

@OneToOne(mappedBy="page")
public Link getLink() {
    return link;
}
public void setLink(Link link) {
    this.link = link;
}
}

Error: ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=sea.ear/sea-ejb.jar#SeaPU state=Create java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/MetadataProvider at org.hibernate.search.event.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:151) at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198) at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181) at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194) at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1338) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132) at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:301) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59) at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150) at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241) at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70) at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221) at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540) at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121) at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51) at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62) at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50) at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171) at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210) at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553) at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781) at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702) at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117) at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70) at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53) at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553) at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306) at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271) at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461) at org.jboss.Main.boot(Main.java:221) at org.jboss.Main$1.run(Main.java:556) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.ClassNotFoundException: org.hibernate.annotations.common.reflection.MetadataProvider from BaseClassLoader@f1c18{VFSClassLoaderPolicy@1fd96c5{name=vfszip:/opt/jboss-5.1.0.GA/server/default/deploy/sea.ear/ domain=ClassLoaderDomain@504ec1{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@1de3f2d} roots=[MemoryContextHandler@28669459[path= context=vfsmemory://5c4o12v-f20ynd-gpejvsex-1-gpejwdz8-2b real=vfsmemory://5c4o12v-f20ynd-gpejvsex-1-gpejwdz8-2b], DelegatingHandler@5956743[path=sea.ear context=file:/opt/jboss-5.1.0.GA/server/default/deploy/ real=file:/opt/jboss-5.1.0.GA/server/default/deploy/sea.ear], DelegatingHandler@22116869[path=sea.ear/sea-client.jar context=file:/opt/jboss-5.1.0.GA/server/default/deploy/ real=file:/opt/jboss-5.1.0.GA/server/default/deploy/sea.ear/sea-client开发者_如何学C.jar], DelegatingHandler@2234728[path=sea.ear/sea-ejb.jar context=file:/opt/jboss-5.1.0.GA/server/default/deploy/ real=file:/opt/jboss-5.1.0.GA/server/default/deploy/sea.ear/sea-ejb.jar], DelegatingHandler@11678023[path=sea.ear/sea-ejb.jar/hibernate-search-3.4.0.Final.jar context=file:/opt/jboss-5.1.0.GA/server/default/deploy/ real=file:/opt/jboss-5.1.0.GA/server/default/deploy/sea.ear/sea-ejb.jar/hibernate-search-3.4.0.Final.jar], DelegatingHandler@12673014[path=sea.ear/sea-ejb.jar/jsoup-1.6.0.jar context=file:/opt/jboss-5.1.0.GA/server/default/deploy/ real=file:/opt/jboss-5.1.0.GA/server/default/deploy/sea.ear/sea-ejb.jar/jsoup-1.6.0.jar]] delegates=null exported=[org.jsoup, org.hibernate.search.query.engine.impl, org.hibernate.search.query.engine.spi, org.jsoup.examples, org.hibernate.search, org.hibernate.search.backend.impl.lucene.works, org.hibernate.search.filter, org.hibernate.search.jpa, org.hibernate.search.query.facet, org.hibernate.search.sandbox.standalone, org.hibernate.search.bridge, org.hibernate.search.backend.impl.jms, org.hibernate.search.backend, org.hibernate.search.spi.internals, org.hibernate.search.annotations, org.hibernate.search.exception.impl, META-INF.maven.org.hibernate.hibernate-search, org.hibernate.search.store.optimization, kz.edu.sdu.sea.apps.ejb.beans, org.hibernate.search.filter.impl, org.hibernate.search.query.dsl, org.hibernate.search.spi, kz.edu.sdu.sea.apps.ejb.util, org.hibernate.search.impl, kz.edu.sdu.sea.apps.ejb.client, org.jsoup.helper, org.hibernate.search.backend.impl.lucene.overrides, org.hibernate.search.store, org.hibernate.search.backend.configuration, org.hibernate.search.backend.impl.lucene, org.hibernate.search.exception, org.hibernate.search.query.engine, org.hibernate.search.query.dsl.impl, org.jsoup.parser, org.hibernate.search.engine, org.hibernate.search.backend.impl.blackhole, org.hibernate.search.stat, org.hibernate.search.backend.impl.jgroups, org.hibernate.search.backend.impl.batchlucene, org.hibernate.search.engine.spi, org.hibernate.search.jmx, org.jsoup.safety, org.hibernate.search.query.hibernate.impl, org.hibernate.search.util, org.hibernate.search.jpa.impl, org.hibernate.search.query.collector, kz.edu.sdu.sea.apps.ejb.db, org.hibernate.search.event, org.hibernate.search.backend.impl, org.jsoup.select, META-INF.maven.org.jsoup.jsoup, org.hibernate.search.bridge.util, org.hibernate.search.cfg, org.hibernate.search.analyzer, org.hibernate.search.query.fieldcache, META-INF, org.hibernate.search.batchindexing, org.hibernate.search.engine.impl, org.hibernate.search.query, org.hibernate.search.reader, org.hibernate.search.bridge.builtin, org.jsoup.nodes] NON_EMPTY}} at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:448) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 70 more 04:09:30,231 INFO [TomcatDeployment] deploy, ctxPath=/sea 04:09:30,631 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

DEPLOYMENTS MISSING DEPENDENCIES: Deployment "jboss.j2ee:ear=sea.ear,jar=sea-ejb.jar,name=ContentFetcherBean,service=EJB3" is missing the following dependencies: Dependency "" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=sea.ear/sea-ejb.jar#SeaPU' ") Deployment "jboss.j2ee:ear=sea.ear,jar=sea-ejb.jar,name=ContentFetcherBean,service=EJB3_endpoint" is missing the following dependencies: Dependency "jboss.j2ee:ear=sea.ear,jar=sea-ejb.jar,name=ContentFetcherBean,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall") Deployment "jboss.j2ee:ear=sea.ear,jar=sea-ejb.jar,name=ContentFetcherMDB,service=EJB3" is missing the following dependencies: Dependency "" (should be in state "Described", but is actually in state " UNRESOLVED Demands 'jndi:sea/WebCrawlerBean/local-kz.edu.sdu.sea.apps.ejb.client.IWebCrawlerLocal' ") Deployment "jboss.j2ee:ear=sea.ear,jar=sea-ejb.jar,name=SearcherBean,service=EJB3" is missing the following dependencies: Dependency "" (should be in state "Described", but is actually in state " UNRESOLVED Demands 'persistence.unit:unitName=sea.ear/sea-ejb.jar#SeaPU' ") Deployment "jboss.j2ee:ear=sea.ear,jar=sea-ejb.jar,name=SearcherBean,service=EJB3_endpoint" is missing the following dependencies: Dependency "jboss.j2ee:ear=sea.ear,jar=sea-ejb.jar,name=SearcherBean,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall") Deployment "jboss.j2ee:ear=sea.ear,jar=sea-ejb.jar,name=WebCrawlerBean,service=EJB3" is missing the following dependencies: Dependency "" (should be in state "Described", but is actually in state " UNRESOLVED Demands 'persistence.unit:unitName=sea.ear/sea-ejb.jar#SeaPU' ") Dependency "" (should be in state "Described", but is actually in state " UNRESOLVED Demands 'jndi:sea/ContentFetcherBean/local-kz.edu.sdu.sea.apps.ejb.client.IContentFetcherLocal' **") Deployment "jboss.j2ee:ear=sea.ear,jar=sea-ejb.jar,name=WebCrawlerBean,service=EJB3_endpoint" is missing the following dependencies: Dependency "jboss.j2ee:ear=sea.ear,jar=sea-ejb.jar,name=WebCrawlerBean,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall")

DEPLOYMENTS IN ERROR: Deployment "" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=sea.ear/sea-ejb.jar#SeaPU' *, * UNRESOLVED Demands 'jndi:sea/ContentFetcherBean/local-kz.edu.sdu.sea.apps.ejb.client.IContentFetcherLocal' ** Deployment "" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=sea.ear/sea-ejb.jar#SeaPU' ** Deployment "" is in error due to the following reason(s): ** UNRESOLVED Demands 'jndi:sea/WebCrawlerBean/local-kz.edu.sdu.sea.apps.ejb.client.IWebCrawlerLocal' ** Deployment "persistence.unit:unitName=sea.ear/sea-ejb.jar#SeaPU" is in error due to the following reason(s): java.lang.ClassNotFoundException: org.hibernate.annotations.common.reflection.MetadataProvider from BaseClassLoader@f1c18{VFSClassLoaderPolicy@1fd96c5{name=vfszip:/opt/jboss-5.1.0.GA/server/default/deploy/sea.ear/ domain=ClassLoaderDomain@504ec1{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@1de3f2d} roots=[MemoryContextHandler@28669459[path= context=vfsmemory://5c4o12v-f20ynd-gpejvsex-1-gpejwdz8-2b real=vfsmemory://5c4o12v-f20ynd-gpejvsex-1-gpejwdz8-2b], DelegatingHandler@5956743[path=sea.ear context=file:/opt/jboss-5.1.0.GA/server/default/deploy/ real=file:/opt/jboss-5.1.0.GA/server/default/deploy/sea.ear], DelegatingHandler@22116869[path=sea.ear/sea-client.jar context=file:/opt/jboss-5.1.0.GA/server/default/deploy/ real=file:/opt/jboss-5.1.0.GA/server/default/deploy/sea.ear/sea-client.jar], DelegatingHandler@2234728[path=sea.ear/sea-ejb.jar context=file:/opt/jboss-5.1.0.GA/server/default/deploy/ real=file:/opt/jboss-5.1.0.GA/server/default/deploy/sea.ear/sea-ejb.jar], DelegatingHandler@11678023[path=sea.ear/sea-ejb.jar/hibernate-search-3.4.0.Final.jar context=file:/opt/jboss-5.1.0.GA/server/default/deploy/ real=file:/opt/jboss-5.1.0.GA/server/default/deploy/sea.ear/sea-ejb.jar/hibernate-search-3.4.0.Final.jar], DelegatingHandler@12673014[path=sea.ear/sea-ejb.jar/jsoup-1.6.0.jar context=file:/opt/jboss-5.1.0.GA/server/default/deploy/ real=file:/opt/jboss-5.1.0.GA/server/default/deploy/sea.ear/sea-ejb.jar/jsoup-1.6.0.jar]] delegates=null exported=[org.jsoup, org.hibernate.search.query.engine.impl, org.hibernate.search.query.engine.spi, org.jsoup.examples, org.hibernate.search, org.hibernate.search.backend.impl.lucene.works, org.hibernate.search.filter, org.hibernate.search.jpa, org.hibernate.search.query.facet, org.hibernate.search.sandbox.standalone, org.hibernate.search.bridge, org.hibernate.search.backend.impl.jms, org.hibernate.search.backend, org.hibernate.search.spi.internals, org.hibernate.search.annotations, org.hibernate.search.exception.impl, META-INF.maven.org.hibernate.hibernate-search, org.hibernate.search.store.optimization, kz.edu.sdu.sea.apps.ejb.beans, org.hibernate.search.filter.impl, org.hibernate.search.query.dsl, org.hibernate.search.spi, kz.edu.sdu.sea.apps.ejb.util, org.hibernate.search.impl, kz.edu.sdu.sea.apps.ejb.client, org.jsoup.helper, org.hibernate.search.backend.impl.lucene.overrides, org.hibernate.search.store, org.hibernate.search.backend.configuration, org.hibernate.search.backend.impl.lucene, org.hibernate.search.exception, org.hibernate.search.query.engine, org.hibernate.search.query.dsl.impl, org.jsoup.parser, org.hibernate.search.engine, org.hibernate.search.backend.impl.blackhole, org.hibernate.search.stat, org.hibernate.search.backend.impl.jgroups, org.hibernate.search.backend.impl.batchlucene, org.hibernate.search.engine.spi, org.hibernate.search.jmx, org.jsoup.safety, org.hibernate.search.query.hibernate.impl, org.hibernate.search.util, org.hibernate.search.jpa.impl, org.hibernate.search.query.collector, kz.edu.sdu.sea.apps.ejb.db, org.hibernate.search.event, org.hibernate.search.backend.impl, org.jsoup.select, META-INF.maven.org.jsoup.jsoup, org.hibernate.search.bridge.util, org.hibernate.search.cfg, org.hibernate.search.analyzer, org.hibernate.search.query.fieldcache, META-INF, org.hibernate.search.batchindexing, org.hibernate.search.engine.impl, org.hibernate.search.query, org.hibernate.search.reader, org.hibernate.search.bridge.builtin, org.jsoup.nodes] NON_EMPTY}} Deployment "" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=sea.ear/sea-ejb.jar#SeaPU' **

04:09:30,665 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080 04:09:30,706 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009 04:09:30,722 INFO [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)] Started in 1m:5s:228ms

Thanks!!!!


Seems to me you are missing the hibernate-commons-annotations dependency.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜