Error loading custom jar file on Tomcat

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error loading custom jar file on Tomcat

Pavel Bonbarev
I have developed my custom factory class solr.HyphenationCompoundWordTokenFilterFactory

It works properly with Solr Night build snapshot under Windows: I have copied compiled jar file HyphenationCompoundWordTokenFilterFactory.class

into C:\hudson\apache-solr-4.0-2010-06-30_08-05-55\example\work\Jetty_0_0_0_0_8983_solr.war__solr__k1kf17\webapp\WEB-INF\lib\apache-solr-core-4.0-2010-06-30_08-05-55.jar\org\apache\solr\analysis\

add to xml
<filter class="solr.HyphenationCompoundWordTokenFilterFactory" hyphenator="de_DR.xml" dictionary="de_DE_frami.dic" minSubwordSize="3"/>

and restart jetty server

But I can not do it with Linux/Tomcat

the same with archive
/opt/tomcat6/webapps/solr-nightbuild/WEB-INF/lib/apache-solr-core-4.0-2010-06-30_08-05-55.jar

But error:

Severe errors in solr configuration. Check your log files for more detailed information on what may be wrong. ------------------------------------------------------------- java.lang.NoClassDefFoundError: org/apache/solr/analysis/HyphenationCompoundWordTokenFilterFactory (wrong name: HyphenationCompoundWordTokenFilterFactory) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) at java.lang.ClassLoader.defineClass(ClassLoader.java:616) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2527) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1010) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1483) at java.lang.ClassLoader.loadClass(ClassLoader.java:296) at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:627) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:382) at org.apache.solr.core.SolrResourceLoader.newInstance(SolrResourceLoader.java:403) at org.apache.solr.util.plugin.AbstractPluginLoader.create(AbstractPluginLoader.java:85) at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:142) at org.apache.solr.schema.IndexSchema.readAnalyzer(IndexSchema.java:935) at org.apache.solr.schema.IndexSchema.access$100(IndexSchema.java:60) at org.apache.solr.schema.IndexSchema$1.create(IndexSchema.java:450) at org.apache.solr.schema.IndexSchema$1.create(IndexSchema.java:435) at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:142) at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:480) at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:122) at org.apache.solr.core.CoreContainer.create(CoreContainer.java:429) at org.apache.solr.core.CoreContainer.load(CoreContainer.java:286) at org.apache.solr.core.CoreContainer.load(CoreContainer.java:198) at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:123) at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:86) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:785) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:519) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:581) 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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414
-- 
Mit freundlichen Grüßen,

i.A. Pavel Bondarev
Softwareentwickler (Dipl.-Math.(FH))

Eventoni GmbH
Uferstr. 27, 95028 Hof


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

p_bondarev.vcf (250 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Error loading custom jar file on Tomcat

Chris Hostetter-3

: It works properly with Solr Night build snapshot under Windows: I have copied
: compiled jar file HyphenationCompoundWordTokenFilterFactory.class
:
: into
: C:\hudson\apache-solr-4.0-2010-06-30_08-05-55\example\work\Jetty_0_0_0_0_8983_solr.war__solr__k1kf17\webapp\WEB-INF\lib\apache-solr-core-4.0-2010-06-30_08-05-55.jar\org\apache\solr\analysis\

1) Don't do that.

this is a really bad idea for loading custom classes in Solr.  Compile
your class, put it into your *own* jar, and then configure SOlr to load
that jar...

http://wiki.apache.org/solr/SolrPlugins#How_to_Load_Plugins

2) The specific error you are getting...

: java.lang.NoClassDefFoundError:
: org/apache/solr/analysis/HyphenationCompoundWordTokenFilterFactory (wrong
: name: HyphenationCompoundWordTokenFilterFactory) at

indicates that the class file java is finding when it loads
org/apache/solr/analysis/HyphenationCompoundWordTokenFilterFactory out of
the classpath doesn't actually have the fully qualified package name that
matches where you put it.

Googling for "java.lang.NoClassDefFoundError wrong name" turned up lots of
explanation on this type of error, here is a very nicely written straight
forward one...

http://www.cs.usfca.edu/~parrt/course/601/lectures/java.tools.html


-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]