mausch / SolrIKVM

Running Apache Solr on .NET through IKVM
http://bugsquash.blogspot.com/2011/02/running-solr-on-net.html
Apache License 2.0
35 stars 19 forks source link

Need help on SOLR 4.4 Conversion #8

Open RAJMITTAL opened 11 years ago

RAJMITTAL commented 11 years ago

I am looking for asp.net mode. i checked .bat file on github, but mentioned files are not available in solr4.4, there is no solr.jar. only a war file. so my prime question is what all JARS should i convert and what other changes needs to done on asp.net code to trigger & use the SOLR.

mausch commented 11 years ago

Unpack the WAR file, replace all the JAR files. If you're not familiar with this, consider it an opportunity to learn (everyone needs to have a basic understanding of Java concepts).

RAJMITTAL commented 11 years ago

during port, i got my 27MB dll, but there are tons of class definition not found errors were there. Is it normal behavior

ikvmc -out:solr.dll -target:library hadoop-annotations-2.0.5-alpha.jar commons-cli-1.2.jar commons-codec-1.7.jar commons-configuration-1.6.jar commons-fileupload-1.2.1.jar commons-io-2.1.jar commons-lang-2.6.jar concurrentlinkedhashmap-lru-1.2.jar guava-14.0.1.jar hadoop-auth-2.0.5-alpha.jar hadoop-common-2.0.5-alpha.jar hadoop-hdfs-2.0.5-alpha.jar httpclient-4.2.3.jar httpcore-4.2.2.jar httpmime-4.2.3.jar joda-time-2.2.jar lucene-analyzers-common-4.4.0.jar lucene-analyzers-kuromoji-4.4.0.jar lucene-analyzers-phonetic-4.4.0.jar lucene-codecs-4.4.0.jar lucene-core-4.4.0.jar lucene-grouping-4.4.0.jar lucene-highlighter-4.4.0.jar lucene-memory-4.4.0.jar lucene-misc-4.4.0.jar lucene-queries-4.4.0.jar lucene-queryparser-4.4.0.jar lucene-spatial-4.4.0.jar lucene-suggest-4.4.0.jar noggit-0.5.jar org.restlet.ext.servlet-2.1.1.jar org.restlet-2.1.1.jar protobuf-java-2.4.0a.jar solr-core-4.4.0.jar solr-solrj-4.4.0.jar spatial4j-0.3.jar wstx-asl-3.2.7.jar zookeeper-3.4.5.jar

Errors: === i am copying only few errors=== similar to this== there are 100s of these errors

(missing class "org.apache.commons.configuration.ConfigurationFactory$Digest

erConfigurationFactory") warning IKVMC0105: Unable to compile class "org.apache.commons.configuration.Sub setConfiguration$1" (missing class "org.apache.commons.collections.Transformer") warning IKVMC0105: Unable to compile class "org.apache.commons.configuration.Sub setConfiguration$2" (missing class "org.apache.commons.collections.Transformer") warning IKVMC0105: Unable to compile class "org.apache.commons.configuration.tre e.xpath.ConfigurationNodeIteratorBase" (missing class "org.apache.commons.jxpath.ri.model.NodeIterator") warning IKVMC0105: Unable to compile class "org.apache.commons.configuration.tre e.xpath.ConfigurationNodeIteratorAttribute" (missing class "org.apache.commons.configuration.tree.xpath.ConfigurationNod eIteratorBase") warning IKVMC0105: Unable to compile class "org.apache.commons.configuration.tre e.xpath.ConfigurationNodeIteratorChildren" (missing class "org.apache.commons.configuration.tree.xpath.ConfigurationNod eIteratorBase") warning IKVMC0105: Unable to compile class "org.apache.commons.configuration.tre e.xpath.ConfigurationNodePointer" (missing class "org.apache.commons.jxpath.ri.model.NodePointer") warning IKVMC0105: Unable to compile class "org.apache.commons.configuration.tre e.xpath.ConfigurationNodePointerFactory" (missing class "org.apache.commons.jxpath.ri.model.NodePointerFactory") warning IKVMC0105: Unable to compile class "org.apache.commons.fileupload.servle t.FileCleanerCleanup" (missing class "javax.servlet.ServletContextListener")

mausch commented 11 years ago

That is an alarming number of warnings, but I wouldn't worry about them at first. What's more important is that Solr seems to have dropped/replaced many of the classes used in the .NET side of the code here, so it doesn't compile. For example, SolrDispatchFilter was dropped (see https://issues.apache.org/jira/browse/SOLR-5091 ). Servlets were replaced with Restlets, so all classes mapping servlets to ASP.NET (i.e. all classes using javax.servlet) must be rewritten.

RAJMITTAL commented 11 years ago

i am getting following error while pinging SOLR from asp.net app

{"Object reference not set to an instance of an object."} at org.apache.solr.servlet.SolrDispatchFilter.doFilter(ServletRequest request, ServletResponse response, FilterChain chain, Boolean retry) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(ServletRequest request, ServletResponse response, FilterChain chain) at SolrIKVM.SolrHandler.ProcessRequest(HttpContextBase context) in C:\Users\rr\Documents\Visual Studio 2010\Projects\SolrIKVM\ClassLibrary1\IKVM\SolrHandler.cs:line 32 at SolrIKVM.SolrHandler.ProcessRequest(HttpContext context) in C:\Users\rr\Documents\Visual Studio 2010\Projects\SolrIKVM\ClassLibrary1\IKVM\SolrHandler.cs:line 25 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

mausch commented 11 years ago

As I said in the last message, SolrDispatchFilter was dropped, so I'm not sure what you're running there...

RAJMITTAL commented 11 years ago

but i still see this class in 4.4 documentation. http://lucene.apache.org/solr/4_4_0/solr-core/org/apache/solr/servlet/SolrDispatchFilter.html. i will check further on servelet related classes

RAJMITTAL commented 11 years ago

i tried to add new document today using following code

SolrServer solr = new HttpSolrServer(solrUrl); solr.addBean(new Document { Id = "280", SKU = "abcde", }); solr.commit(); & got this error

[RemoteSolrException: Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0]] org.apache.solr.client.solrj.impl.HttpSolrServer.request(SolrRequest request, ResponseParser processor) in HttpSolrServer.java:424 org.apache.solr.client.solrj.impl.HttpSolrServer.request(SolrRequest request) in HttpSolrServer.java:180 org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(SolrServer server) in AbstractUpdateRequest.java:117 org.apache.solr.client.solrj.SolrServer.add(SolrInputDocument doc, Int32 commitWithinMs) in SolrServer.java:116 org.apache.solr.client.solrj.SolrServer.addBean(Object obj, Int32 commitWithinMs) in SolrServer.java:136 org.apache.solr.client.solrj.SolrServer.addBean(Object obj) in SolrServer.java:125


Code from HttpSolrServer.Request from line 405 to 424

String charset = EntityUtils.getContentCharSet(response.getEntity()); //405 NamedList rsp = processor.processResponse(respBody, charset); if (httpStatus != HttpStatus.SC_OK) { String reason = null; try { NamedList err = (NamedList) rsp.get("error"); if (err != null) { reason = (String) err.get("msg"); // TODO? get the trace? } } catch (Exception ex) {} if (reason == null) { StringBuilder msg = new StringBuilder(); msg.append(response.getStatusLine().getReasonPhrase()); msg.append("\n\n"); msg.append("request: " + method.getURI()); reason = java.net.URLDecoder.decode(msg.toString(), UTF_8); } throw new RemoteSolrException(httpStatus, reason, null); //424

Pls let me know if you have any insight.

mausch commented 11 years ago

Were you able to replace the servlet adapters, etc and compile SolrIKVM? Could you push that to your fork of the repository?

mausch commented 11 years ago

About SolrDispatchFilter, you're right, it's still there, I can see it in solr-core-4.4.0.jar . But it doesn't get compiled to the .NET DLL because of this: Warning IKVMC0105: unable to compile class "org.apache.solr.servlet.SolrDispatchFilter" (missing class "javax.servlet.Filter")

Since it's deprecated and will be removed soon anyway, and it depends on servlet, which we need to remove as well, I'd say we ignore it and pretend it's not there anymore...

mausch commented 11 years ago

Ping! Could you make any progress on this?