Page 1 of 1

Custom BridgeHelper configuration

PostPosted: Tue Mar 09, 2010 8:10 pm
by johnjhufnagle
Hi,

I have a test custom BridgeHelper class:

package edu.mbl.search.bridges;
import ome.model.core.Image;
import ome.services.fulltext.BridgeHelper;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;

public class CellImageBridge extends BridgeHelper {

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

logger().debug("CellImageBridge name: " + name);
logger().debug(" value: " + value.toString());
logger().debug(" index: " + index.toString());
logger().debug(" ");
if (value instanceof Image) {

logger().debug("Indexing all image names for " + value);
not much done after this point...
....
}
To config this helper into OMERO.server I:
>> bin/omero config set omero.search.bridges edu.mbl.search.bridges.CellImageBridge

I dropped the jar containing my helper into my omero dist/lib/server directory

I added to omero dist/etc/log4j-indexing.xml
<category name="edu.mbl.search.bridges"><priority value="DEBUG"/></category>

and restarted and imported an image.

Should I have expected to have seen some logging from my test bridge helper class?
If not where did I go wrong in configuration.
Thanks
John

Re: Custom BridgeHelper configuration

PostPosted: Wed Mar 10, 2010 7:44 am
by jmoore
The "Configuration" section of SearchBridges describes how to use the "omero.search.bridges" property defined by default in etc/omero.properties:
Code: Select all

# Extra bridge classes, comma-separated, to be invoked on each indexing.
# Bridges are used to parse more information out of the your data.
omero.search.bridges=

# Fore more information, see:
# http://trac.openmicroscopy.org.uk/omero/wiki/OmeroSearch

As with other server properties, this can be modified via bin/omero config set.

Cheers,
~Josh

Re: Custom BridgeHelper configuration

PostPosted: Wed Mar 10, 2010 2:37 pm
by johnjhufnagle
My post must have been unclear. I had done the config step you mentioned I believe:

bin/omero config set omero.search.bridges edu.mbl.search.bridges.CellImageBridge

when I issue a 'bin/omero config get' I see my property set correctly:

JHMBPro:omero_dist johnhufnagle$ bin/omero config get
omero.db.host=localhost
omero.search.bridges=edu.mbl.search.bridges.CellImageBridge

Below are the Indexer log errors.
If I remove my custom search bridge from the configuration OMERO.server starts correctly. Do I need to do something else to allow OMERO to find my jar containing my search bridge class other than dropping the jar into the lib/server directory?

Below is the Indexer-0.log contents with its errors. I was unable to attach the file...sorry about pasting it in here.



2010-03-10 09:25:30,933 INFO [ ome.services.blitz.Entry] ( main) Creating ome.fulltext. Please wait...
2010-03-10 09:25:32,855 INFO [ng.ShutdownSafeEhcacheManagerFactoryBean] ( main) Initializing EHCache CacheManager
2010-03-10 09:25:37,451 INFO [ ome.services.fulltext.FullTextAnalyzer] ( main) Initialized FullTextAnalyzer
2010-03-10 09:25:45,754 INFO [.services.scheduler.SchedulerFactoryBean] ( main) Shutting down Quartz Scheduler
2010-03-10 09:25:45,772 INFO [ng.ShutdownSafeEhcacheManagerFactoryBean] ( main) Shutting down EHCache CacheManager
2010-03-10 09:25:45,773 ERROR [ ome.services.blitz.Entry] ( main) Error on startup.
org.springframework.beans.factory.access.BootstrapException: Unable to return specified BeanFactory instance: factory key [ome.fulltext], from group with resource name [classpath*:beanRefContext.xml]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ome.fulltext' defined in URL [jar:file:/Users/johnhufnagle/Desktop/omero_dist/lib/server/server.jar!/beanRefContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [ome.system.OmeroContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistentEventLogLoader' defined in class path resource [ome/services/service-ome.api.Search.xml]: Cannot resolve reference to bean 'internal-ome.api.ITypes' while setting bean property 'types'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'internal-ome.api.ITypes' defined in class path resource [ome/services/service-ome.api.ITypes.xml]: Cannot resolve reference to bean 'internal-ome.api.IUpdate' while setting bean property 'updateService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'internal-ome.api.IUpdate' defined in class path resource [ome/services/service-ome.api.IUpdate.xml]: Cannot resolve reference to bean 'fullTextBridge' while setting bean property 'fullTextBridge'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fullTextBridge' defined in class path resource [ome/services/service-ome.api.Search.xml]: 3 constructor arguments specified but no matching constructor found in bean 'fullTextBridge' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)
at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:410)
at ome.system.OmeroContext.getInstance(OmeroContext.java:203)
at ome.services.blitz.Entry.start(Entry.java:203)
at ome.services.blitz.Entry.main(Entry.java:121)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ome.fulltext' defined in URL [jar:file:/Users/johnhufnagle/Desktop/omero_dist/lib/server/server.jar!/beanRefContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [ome.system.OmeroContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistentEventLogLoader' defined in class path resource [ome/services/service-ome.api.Search.xml]: Cannot resolve reference to bean 'internal-ome.api.ITypes' while setting bean property 'types'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'internal-ome.api.ITypes' defined in class path resource [ome/services/service-ome.api.ITypes.xml]: Cannot resolve reference to bean 'internal-ome.api.IUpdate' while setting bean property 'updateService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'internal-ome.api.IUpdate' defined in class path resource [ome/services/service-ome.api.IUpdate.xml]: Cannot resolve reference to bean 'fullTextBridge' while setting bean property 'fullTextBridge'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fullTextBridge' defined in class path resource [ome/services/service-ome.api.Search.xml]: 3 constructor arguments specified but no matching constructor found in bean 'fullTextBridge' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:254)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:835)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:885)
at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:397)
... 3 more
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [ome.system.OmeroContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistentEventLogLoader' defined in class path resource [ome/services/service-ome.api.Search.xml]: Cannot resolve reference to bean 'internal-ome.api.ITypes' while setting bean property 'types'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'internal-ome.api.ITypes' defined in class path resource [ome/services/service-ome.api.ITypes.xml]: Cannot resolve reference to bean 'internal-ome.api.IUpdate' while setting bean property 'updateService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'internal-ome.api.IUpdate' defined in class path resource [ome/services/service-ome.api.IUpdate.xml]: Cannot resolve reference to bean 'fullTextBridge' while setting bean property 'fullTextBridge'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fullTextBridge' defined in class path resource [ome/services/service-ome.api.Search.xml]: 3 constructor arguments specified but no matching constructor found in bean 'fullTextBridge' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:248)
... 16 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistentEventLogLoader' defined in class path resource [ome/services/service-ome.api.Search.xml]: Cannot resolve reference to bean 'internal-ome.api.ITypes' while setting bean property 'types'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'internal-ome.api.ITypes' defined in class path resource [ome/services/service-ome.api.ITypes.xml]: Cannot resolve reference to bean 'internal-ome.api.IUpdate' while setting bean property 'updateService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'internal-ome.api.IUpdate' defined in class path resource [ome/services/service-ome.api.IUpdate.xml]: Cannot resolve reference to bean 'fullTextBridge' while setting bean property 'fullTextBridge'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fullTextBridge' defined in class path resource [ome/services/service-ome.api.Search.xml]: 3 constructor arguments specified but no matching constructor found in bean 'fullTextBridge' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:308)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:948)
at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:702)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:378)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:105)
at ome.system.OmeroContext.<init>(OmeroContext.java:98)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
... 18 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'internal-ome.api.ITypes' defined in class path resource [ome/services/service-ome.api.ITypes.xml]: Cannot resolve reference to bean 'internal-ome.api.IUpdate' while setting bean property 'updateService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'internal-ome.api.IUpdate' defined in class path resource [ome/services/service-ome.api.IUpdate.xml]: Cannot resolve reference to bean 'fullTextBridge' while setting bean property 'fullTextBridge'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fullTextBridge' defined in class path resource [ome/services/service-ome.api.Search.xml]: 3 constructor arguments specified but no matching constructor found in bean 'fullTextBridge' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
... 42 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'internal-ome.api.IUpdate' defined in class path resource [ome/services/service-ome.api.IUpdate.xml]: Cannot resolve reference to bean 'fullTextBridge' while setting bean property 'fullTextBridge'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fullTextBridge' defined in class path resource [ome/services/service-ome.api.Search.xml]: 3 constructor arguments specified but no matching constructor found in bean 'fullTextBridge' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
... 55 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fullTextBridge' defined in class path resource [ome/services/service-ome.api.Search.xml]: 3 constructor arguments specified but no matching constructor found in bean 'fullTextBridge' (hint: specify index and/or type arguments for simple parameters to avoid type ambiguities)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:181)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:835)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
... 68 more

Re: Custom BridgeHelper configuration

PostPosted: Wed Mar 10, 2010 2:47 pm
by johnjhufnagle
I'm now thinking it is a jar problem. I removed the configuration for my custom bridge and instead configured in your example ProjectWithImageNameBridge and it starts up fine.
Do I have to do something to ensure my class/jar is on the OMERO.server classpath? Did I miss that part?

Re: Custom BridgeHelper configuration

PostPosted: Wed Mar 10, 2010 3:28 pm
by jmoore
Hi John,

First, sorry. I was rushing and missed your mentioning bin/omero config set. Secondly, you didn't miss anything on the SearchBridges page, it's just that there wasn't a back link to "Extending Omero" (added).

https://trac.openmicroscopy.org.uk/omero/wiki/ExtendingOmero#JavaDeployment describes (briefly) the magic location: lib/server/extensions.jar.

The alternative is to use the OMERO build system directly to have the classes properly packaged (which amounts to putting the resources in extensions.jar :) )

Cheers,
~Josh.

Re: Custom BridgeHelper configuration

PostPosted: Wed Mar 10, 2010 3:36 pm
by johnjhufnagle
Thanks! That did it. My helper is being called.

Re: Custom BridgeHelper configuration

PostPosted: Wed Mar 10, 2010 3:45 pm
by jmoore
Glad to help, John.

Re: Custom BridgeHelper configuration

PostPosted: Thu Mar 18, 2010 3:21 pm
by johnjhufnagle
When a custom bridge helper is called because something was modified on the object, is it true that the lucene Document for that object is new and that we are re-creating the Document i.e. not just adding/modifying index fields on it? Or does the bridge helper need to go examining what fields/values already exist on the Document and deal with that also?

Re: Custom BridgeHelper configuration

PostPosted: Fri Mar 19, 2010 7:49 am
by jmoore
If I understand what you're asking, John, the custom bridge shouldn't need to examine the document, but can assume that whatever other bridges were present previously are still present and will take care of the other fields, and the custom bridge itself will only need to set its field values. The only issue may arise if the bridge is overwriting an existing field. Is that necessary in your case?

Cheers,
~Josh.