-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: ClassCastException: java.lang.Long
PostPosted: Thu Mar 29, 2007 1:54 pm 
Newbie

Joined: Wed Mar 28, 2007 2:51 pm
Posts: 16
Hi,
Has anyone seen this exception before? I traced it into the search code, but not sure what triggers it.

regards.

Code:
java.lang.ClassCastException: java.lang.Long at
org.hibernate.search.bridge.builtin.StringBridge.objectToString(StringBridge.java:16)
org.hibernate.search.bridge.String2FieldBridgeAdaptor.set(String2FieldBridgeAdaptor.java:21)
org.hibernate.search.engine.DocumentBuilder.getDocument(DocumentBuilder.java:395)
org.hibernate.search.engine.DocumentBuilder.addWorkToQueue(DocumentBuilder.java:302)
org.hibernate.search.backend.impl.BatchedQueueingProcessor.performWork(BatchedQueueingProcessor.java:111)
org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.afterCompletion(PostTransactionWorkQueueSynchronization.java:49)
org.hibernate.transaction.JDBCTransaction.notifyLocalSynchsAfterTransactionCompletion(JDBCTransaction.java:243)
org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:121)
mil.darpa.tn.model.ReportModelFactory.saveReport(ReportModelFactory.java:102)
mil.darpa.tn.model.ReportFactory.saveReport(ReportFactory.java:77)
        at mil.darpa.tn.TNMain.insertReport(TNMain.java:61)
        at mil.darpa.tn.TNMain.main(TNMain.java:73)






In Work.java there is:

Code:
            public Serializable getId() {
                        return id;
            }




Which I confirmed returns a Long.

However, this value is then sent to:

Code:
                                    builder.addWorkToQueue(work.getEntity(), work.getId(), work.getType(), luceneQueue, searchFactory);


in BatchQueuingProcessor, where it eventually gets sent to:

Code:
                                    idBridge.set( idKeywordName, id, doc, Field.Store.YES, Field.Index.UN_TOKENIZED, idBoost );


in DocumentBuilder. idBridge is String2FieldBridgeAdaptor


Code:
            public void set(String name, Object value, Document document, Field.Store store, Field.Index index, Float boost) {

                        String indexedString = stringBridge.objectToString( value );   <---- CCE


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 29, 2007 11:39 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Hum interesting,
Pretty much like Hibernate, you will have to specify the actual type needed, because the type is resolved at init time, not at runtime

Annotating your serializable type to @FieldBridge(impl=LongBridge.class) should do the trick.

The weird thing is that an exception should have been raised (Unable to guess FieldBridge).

I have opened a JIRA issue to track it down http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-37

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 30, 2007 9:09 am 
Newbie

Joined: Wed Mar 28, 2007 2:51 pm
Posts: 16
Thank you for the tip. Oddly enough, this field was the required Hibernate Long getId() property.

EDIT: Adding the FieldBridge annotation does not seem to work (for me).


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 24, 2007 12:37 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Hey, I tried to reproduce your problem but I could not managed to.
There should be something else not described in the post. If you still have the code around, can you post ti to JIRA.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 05, 2007 3:17 pm 
Newbie

Joined: Fri Oct 05, 2007 3:05 pm
Posts: 2
I'll try to help you with that .. It should be easy .. because I don't seem to have problems with the FieldBridge annotation..
I'll see what I can do.

Cheers

_________________
Too many people are thinking of security instead of opportunity. They seem more afraid of life than death.
- James F. Byrnes
Marine


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 18, 2008 1:48 pm 
Newbie

Joined: Tue Nov 18, 2008 1:20 pm
Posts: 2
I have the same problem - and I can't figure out where to place the @FiledBridge annotation. Here's my full stack trace:

java.lang.ClassCastException: java.lang.Long
at org.hibernate.search.bridge.builtin.StringBridge.objectToString(StringBridge.java:15)
at org.hibernate.search.bridge.TwoWayString2FieldBridgeAdaptor.objectToString(TwoWayString2FieldBridgeAdaptor.java:23)
at org.hibernate.search.engine.DocumentBuilder.addWorkToQueue(DocumentBuilder.java:688)
at org.hibernate.search.backend.impl.BatchedQueueingProcessor.addWorkToBuilderQueue(BatchedQueueingProcessor.java:159)
at org.hibernate.search.backend.impl.BatchedQueueingProcessor.processWorkByLayer(BatchedQueueingProcessor.java:140)
at org.hibernate.search.backend.impl.BatchedQueueingProcessor.prepareWorks(BatchedQueueingProcessor.java:128)
at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.beforeCompletion(PostTransactionWorkQueueSynchronization.java:40)
at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1473)
at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1092)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:306)
at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:486)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:346)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
at org.jboss.ejb.Container.invoke(Container.java:873)
at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:415)
at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:88)
at $Proxy176.updateTask(Unknown Source)
at com.zanibal.zeus.service.api.workflow.WorkflowServiceProxyImpl.updateTask(WorkflowServiceProxyImpl.java:122)
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:585)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:230)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:1134)
at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:190)
at org.mozilla.javascript.continuations.ContinuationInterpreter.interpret(ContinuationInterpreter.java:138)
at org.mozilla.javascript.continuations.InterpretedFunctionImpl.call(InterpretedFunctionImpl.java:121)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1244)
at org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java:1591)
at org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.handleContinuation(FOM_JavaScriptInterpreter.java:853)
at org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:123)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:142)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:92)
at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:234)
at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:176)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:248)
at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:117)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:142)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:92)
at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:234)
at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:176)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:248)
at org.apache.cocoon.Cocoon.process(Cocoon.java:679)
at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1154)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.zanibal.zeus.service.api.system.CocoonFilter.doFilter(CocoonFilter.java:87)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.sso.ClusteredSingleSignOn.invoke(ClusteredSingleSignOn.java:404)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)

I'm using the versions recommended in the documentation:

http://www.hibernate.org/hib_docs/searc ... gle/#d0e44

namely

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</artifactId>
<version>3.0.1.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.3.0.ga</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.3.1.ga</version>
</dependency>

I run jboss-4.0.3SP1.

PS. the stack trace is from the latest search version - that's why the line is 15 not 16.

Also the $Proxy176.updateTask(Unknown Source) is a EJBLocalObject implementation - I don't known if that's relevant.

Any clues?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 18, 2008 2:18 pm 
Newbie

Joined: Tue Nov 18, 2008 1:20 pm
Posts: 2
Also can somebody direct me to where I can read more about how the search deals with inheritance?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.