我正在使用以下技术
tapestry 5.4-beta-2
hibernate-core 5.2.5
com.sybase jconn4 7.0.7
hibernate-search 4.2.0.Final
当我尝试部署我的应用程序时,我遇到以下异常。
Caused by: java.lang.IllegalArgumentException: java.lang.Object is not an indexed entity or a subclass of an indexed entity
有人知道这个例外是什么意思吗?我做了很多搜索,但似乎无法找到任何信息。
我的hibernate.cfg.xml看起来像这样。
<property name="hibernate.dialect">org.hibernate.dialect.SybaseAnywhereDialect</property>
<!--DEV Database Connection-->
<property name="hibernate.connection.driver_class">com.sybase.jdbc4.jdbc.SybDataSource</property>
<property name="hibernate.connection.url">jdbc:sybase:Tds:domain:5000/test</property>
<property name="hibernate.connection.username">****</property>
<property name="hibernate.connection.password">****</property>
<property name="hibernate.hbm2ddl.auto">validate</property>
@Entity
@Indexed
@AnalyzerDef(
name = "customanalyzer",
tokenizer =
@TokenizerDef(factory = StandardTokenizerFactory.class),
filters = {
@TokenFilterDef(factory = LowerCaseFilterFactory.class),})
@FullTextFilterDefs({
@FullTextFilterDef(
name = "managerFilter",
impl = ManagerFilterFactory.class),
@FullTextFilterDef(
name = "employeeFilter",
impl = EmployeeFilterFactory.class),
@FullTextFilterDef(
name = "employeeTimeSheetFilter",
impl = EmployeeTimeSheetFilterFactory.class),
@FullTextFilterDef(
name = "supervisorFilter",
impl = SupervisorFilterFactory.class),})
public class UserProfile extends StatefulEntity {
@Field
@Analyzer(definition = "customanalyzer")
@Validate("required")
@NonVisual
@Column(
nullable = false,
unique = true)
private String shortname;
@Field
@Analyzer(definition = "customanalyzer")
private String firstName;
@Field
@Analyzer(definition = "customanalyzer")
private String lastName;
@Field
@Analyzer(definition = "customanalyzer")
private String middleInitial;
@Field
@Analyzer(definition = "customanalyzer")
private String notesName;
@Field
@Analyzer(definition = "customanalyzer")
// 2013.12.03 LDAP allows duplicate email addresses - need to play by the same rules
@Column(unique = false)
private String email;
员工
@Entity
@Indexed
@Table(name = "employee_profile")
public class EmployeeProfile extends AbstractProfileEntity {
@NonVisual
// We could return a DateFormat, but instead we'll return a String which DateField will coerce into a DateFormat.
private String dateInFormatStr = "MM/dd/yyyy";
@Field
@Analyzer(definition = "customanalyzer")
@Validate("required")
@Column(
nullable = false,
unique = true)
private String empId;
@NonVisual
private String author;
AbstractProfile
@MappedSuperclass
public abstract class AbstractProfileEntity extends AbstractAccrualEntity implements TransitoryProfile {
@NonVisual
@IndexedEmbedded
@Validate("required")
@ManyToOne
@JoinColumn(name = "supervisorId", nullable = false)
private UserProfile supervisor;
@NonVisual
@IndexedEmbedded
@ManyToOne
@JoinColumn(name = "managerId", nullable = true)
private UserProfile manager;
@NonVisual
@Field
@Analyzer(definition = "customanalyzer")
private String notesName;
完整堆栈跟踪
Feb 04, 2014 2:14:54 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter app
java.lang.RuntimeException: Exception constructing service 'RegistryStartup': Error invoking service contribution method org.domain.test.services.AppModule.initApplication(FullTextSession): java.lang.Object is not an indexed entity or a subclass of an indexed entity
at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:75)
at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:54)
at $Runnable_574fc15253b4.delegate(Unknown Source)
at $Runnable_574fc15253b4.run(Unknown Source)
at org.apache.tapestry5.ioc.internal.RegistryImpl.performRegistryStartup(RegistryImpl.java:320)
at org.apache.tapestry5.ioc.internal.RegistryWrapper.performRegistryStartup(RegistryWrapper.java:80)
at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:112)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4775)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:548)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1468)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:792)
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1447)
at org.apache.catalina.manager.HTMLManagerServlet.upload(HTMLManagerServlet.java:303)
at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:210)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:213)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:611)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2430)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2419)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.tapestry5.ioc.internal.OperationException: Error invoking service contribution method org.domain.test.services.AppModule.initApplication(FullTextSession): java.lang.Object is not an indexed entity or a subclass of an indexed entity
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:180)
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:61)
at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:78)
at org.apache.tapestry5.ioc.internal.RegistryImpl.addToOrderedConfiguration(RegistryImpl.java:624)
at org.apache.tapestry5.ioc.internal.RegistryImpl.getOrderedConfiguration(RegistryImpl.java:478)
at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$2.invoke(ServiceResourcesImpl.java:110)
at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$2.invoke(ServiceResourcesImpl.java:107)
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:80)
at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:89)
at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1112)
at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.getOrderedConfiguration(ServiceResourcesImpl.java:105)
at org.apache.tapestry5.ioc.internal.AbstractServiceCreator.getOrderedConfiguration(AbstractServiceCreator.java:123)
at org.apache.tapestry5.ioc.internal.AbstractServiceCreator.access$200(AbstractServiceCreator.java:35)
at org.apache.tapestry5.ioc.internal.AbstractServiceCreator$1.findResource(AbstractServiceCreator.java:103)
at org.apache.tapestry5.ioc.internal.util.DelegatingInjectionResources.findResource(DelegatingInjectionResources.java:38)
at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:230)
at org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:49)
at org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:288)
at org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:285)
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:80)
at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:89)
at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1112)
at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:292)
at org.apache.tapestry5.ioc.internal.util.InternalUtils$22.invoke(InternalUtils.java:1408)
at org.apache.tapestry5.ioc.internal.util.InternalUtils$22.invoke(InternalUtils.java:1403)
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:80)
at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:89)
at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1112)
at org.apache.tapestry5.ioc.internal.util.InternalUtils.createConstructorConstructionPlan(InternalUtils.java:1400)
at org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.getPlan(ConstructorServiceCreator.java:52)
at org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:61)
at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:80)
at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:89)
at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1112)
at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
at org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29)
at org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46)
at org.apache.tapestry5.ioc.internal.AdvisorStackBuilder.createObject(AdvisorStackBuilder.java:63)
at org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:54)
at org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)
at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:80)
at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:89)
at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1112)
at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:66)
... 56 more
Caused by: java.lang.RuntimeException: Error invoking service contribution method org.domain.test.services.AppModule.initApplication(FullTextSession): java.lang.Object is not an indexed entity or a subclass of an indexed entity
at org.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:130)
at org.apache.tapestry5.ioc.internal.ContributionDefImpl.contribute(ContributionDefImpl.java:80)
at org.apache.tapestry5.ioc.internal.RegistryImpl$9.run(RegistryImpl.java:628)
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:55)
... 101 more
Caused by: java.lang.IllegalArgumentException: java.lang.Object is not an indexed entity or a subclass of an indexed entity
at org.hibernate.search.impl.MassIndexerImpl.toRootEntities(MassIndexerImpl.java:103)
at org.hibernate.search.impl.MassIndexerImpl.<init>(MassIndexerImpl.java:75)
at org.hibernate.search.impl.FullTextSessionImpl.createIndexer(FullTextSessionImpl.java:209)
at $FullTextSession_574fc15253bd.createIndexer(Unknown Source)
at $FullTextSession_574fc15253bc.createIndexer(Unknown Source)
at org.domain.test.services.AppModule.initApplication(AppModule.java:396)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:120)
... 104 more
答案 0 :(得分:2)
万一有人遇到这个问题,我今天也遇到了同样的问题。我知道这很晚了,但可以帮助某人。
我的IDE在模型中自动导入了org.springframework.stereotype.Indexed
,而不是org.hibernate.search.annotations.Indexed
。将导入更改为正确的内容可以立即解决问题。
答案 1 :(得分:0)
这看起来是使用massindexer
的hibernate搜索中报告的错误https://hibernate.atlassian.net/browse/HSEARCH-1453
我遇到的问题是我的一个实体是用@Indexed注释的;我只使用@IndexedEmbedded对实体中的一个属性进行注释,而不是使用@Field对任何其他属性进行注释以进行索引。
临时解决方法是向索引添加另一个属性。这不太理想,所以欢迎任何建议。
答案 2 :(得分:0)
<property name="hibernate.search.rebuildIndex">false</property>
这使我的错误消失了。