Saturday, February 22, 2014

Deploying Solr 4.61 in to weblogic

Assumptions:

   Weblogic 10.X is installed & running fine.
download SOLR 4.61 from http://lucene.apache.org/solr/  & expand the zip file.

a) Deploy the war file via console or auto-deploy folder.

You will notice exceptions in weblogic console saying that  log jars missing exceptions

b) Now copy log jar files from \solr-4.6.1\example\lib\ext to your weblogic domain's lib
   On my local machine, this value is :  domains\base_domain\lib
  
c) After copy & restart weblogic & start accessing solr app.
   Now system will display tons of exceptions
   (see the SOLR JIRA  SOLR-4762  for the issue & resolution.)
  
   What I did is I expanded solr.war file  (jar -xvf ...) & updated weblogic.xml file.
   Following is my weblogic file

<weblogic-web-app
   xmlns="http://www.bea.com/ns/weblogic/90"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">

   <container-descriptor>
<filter-dispatched-requests-enabled>false</filter-dispatched-requests-enabled> <prefer-web-inf-classes>true</prefer-web-inf-classes>
   </container-descriptor>

</weblogic-web-app>

  
  D)Note: If you are starting weblogic with explicit Solr.solr.home  parameter, you are good
     for example my value is
        -Dsolr.solr.home=C:\Oracle\Middleware\user_projects\domains\base_domain\solr
     However, if you are trying to set this value via solr\WEB-INF\web.xml changes
       then you will face one more issue or it will start at all.

 Original web.xml contains

  <!-- People who want to hardcode their "Solr Home" directly into the
      WAR File can set the JNDI property here...
  -->

   <env-entry>
      <env-entry-name>solr/home</env-entry-name>
      <env-entry-value>C:\aa_valve_solr\solr</env-entry-value>
      <env-entry-type>java.lang.String</env-entry-type>
   </env-entry>

Above will not work. Weblogic keep saying Not valid xml file

      
  <!-- People who want to hardcode their "Solr Home" directly into the
      WAR File can set the JNDI property here...
  -->

   <env-entry>
      <env-entry-name>solr/home</env-entry-name>
      <env-entry-type>java.lang.String</env-entry-type>
      <env-entry-value>C:\aa_valve_solr\solr</env-entry-value>
   </env-entry>


With this change (yes. Ordering of elements make the difference ) & SOLR will start successfully.
From this point, everything runs fine (i.e. indexing/search & i tried data import handlers etc.)

No comments: