diff --git a/example/solr/conf/schema.xml b/example/solr/conf/schema.xml index bd572da59da..ab35cdda42d 100755 --- a/example/solr/conf/schema.xml +++ b/example/solr/conf/schema.xml @@ -1,12 +1,12 @@ +--> diff --git a/example/solr/conf/solrconfig.xml b/example/solr/conf/solrconfig.xml index e2cb1ff091f..3744943bb2a 100755 --- a/example/solr/conf/solrconfig.xml +++ b/example/solr/conf/solrconfig.xml @@ -3,7 +3,7 @@ + SolrServer Solr Solr Server org.apache.solr.servlet.SolrServlet - 0 + 1 @@ -28,7 +29,7 @@ SolrUpdate Solr Update Handler org.apache.solr.servlet.SolrUpdateServlet - 1 + 2 diff --git a/src/webapp/resources/admin/_info.jsp b/src/webapp/resources/admin/_info.jsp index ffcd4c3f0ed..794ac182466 100644 --- a/src/webapp/resources/admin/_info.jsp +++ b/src/webapp/resources/admin/_info.jsp @@ -3,6 +3,7 @@ org.apache.solr.schema.IndexSchema, java.io.File"%> <%@ page import="java.net.InetAddress"%> +<%@ page import="org.apache.solr.core.Config"%> <% SolrCore core = SolrCore.getSolrCore(); @@ -25,4 +26,5 @@ String defaultSearch = SolrConfig.config.get("admin/defaultQuery/text()",null); String cwd=System.getProperty("user.dir"); + String solrHome= Config.getInstanceDir(); %> diff --git a/src/webapp/resources/admin/header.jsp b/src/webapp/resources/admin/header.jsp index bd08f620cdc..b924978f0ea 100644 --- a/src/webapp/resources/admin/header.jsp +++ b/src/webapp/resources/admin/header.jsp @@ -17,4 +17,4 @@ var host_name="<%= hostname %>" <%= enabledStatus==null ? "" : (isEnabled ? " - Enabled" : " - Disabled") %> <%= hostname %>:<%= port %>
-<%= cwd %> +cwd=<%= cwd %> SolrHome=<%= solrHome %> diff --git a/src/webapp/src/org/apache/solr/servlet/SolrServlet.java b/src/webapp/src/org/apache/solr/servlet/SolrServlet.java index 820ff520165..08eb9c2f2d4 100644 --- a/src/webapp/src/org/apache/solr/servlet/SolrServlet.java +++ b/src/webapp/src/org/apache/solr/servlet/SolrServlet.java @@ -16,23 +16,23 @@ package org.apache.solr.servlet; -import org.apache.solr.core.*; -import org.apache.solr.request.*; -import org.apache.solr.schema.IndexSchema; -import org.apache.solr.util.StrUtils; +import org.apache.solr.core.Config; +import org.apache.solr.core.SolrCore; +import org.apache.solr.core.SolrException; +import org.apache.solr.request.SolrQueryResponse; +import org.apache.solr.request.XMLResponseWriter; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; import javax.servlet.ServletException; -import javax.servlet.ServletContext; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; -import java.io.BufferedReader; import java.util.logging.Logger; -import java.util.Map; -import java.util.Set; -import java.net.MalformedURLException; /** * @author yonik @@ -47,13 +47,27 @@ public class SolrServlet extends HttpServlet { public void init() throws ServletException { - ServletContext ctx = getServletContext(); + log.info("SolrServlet.init()"); try { - System.out.println("RESOURCE URL FOR .="+ctx.getResource("/select")); - } catch (MalformedURLException e) { - e.printStackTrace(); - } + Context c = new InitialContext(); + /*** + System.out.println("Enumerating JNDI Context=" + c); + NamingEnumeration en = c.list("java:comp/env"); + while (en.hasMore()) { + NameClassPair ncp = en.next(); + System.out.println(" ENTRY:" + ncp); + } + System.out.println("JNDI lookup=" + c.lookup("java:comp/env/solr/home")); + ***/ + + String home = (String)c.lookup("java:comp/env/solr/home"); + if (home!=null) Config.setInstanceDir(home); + } catch (NoInitialContextException e) { + log.info("JNDI not configured for Solr (NoInitialContextEx)"); + } catch (NamingException e) { + log.info("No /solr/home in JNDI"); + } log.info("user.dir=" + System.getProperty("user.dir")); core = SolrCore.getSolrCore(); diff --git a/src/webapp/src/org/apache/solr/servlet/SolrUpdateServlet.java b/src/webapp/src/org/apache/solr/servlet/SolrUpdateServlet.java index 28a64788515..af1795eeca8 100644 --- a/src/webapp/src/org/apache/solr/servlet/SolrUpdateServlet.java +++ b/src/webapp/src/org/apache/solr/servlet/SolrUpdateServlet.java @@ -42,6 +42,7 @@ public class SolrUpdateServlet extends HttpServlet { public void init() throws ServletException { core = SolrCore.getSolrCore(); + log.info("SolrUpdateServlet.init() done"); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {