Reputation: 376
I'm trying to set up a DSpace 5.4 on a local VM to prepare for the upgrade to DSpace 5.5 on another machine.
The setup procedure works fine, but I can't get the solr webapp to work. I deployed it (Using Tomocat 8.0.33 and OpenJDK 1.8.0_60 on OpenSuse Leaf 42.1), and it's returning the following error when called from the VM and from the host:
java.net.UnknownHostException: linux-ai1n: unknown error
java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
java.net.InetAddress.getLocalHost(InetAddress.java:1500)
org.dspace.solr.filters.LocalHostRestrictionFilter.doFilter(LocalHostRestrictionFilter.java:38)
So when using a discovery related function, this error is returned:
Expected mime type application/octet-stream but got text/html.
Answers I found only suggest to change the solr URL, so I have tried changing the solr URL in config/modules/discovery.cfg from http://localhost:8080/solr/search to http://127.0.0.1:8008/solr/search, but that did not solve the problem.
Any hints what to check next would be very helpful. Could this be an issue with not enough memory available on the virtual machine?
Upvotes: 1
Views: 1381
Reputation: 1
The Solr web application installed along with DSpace in its default configuration uses the filter org.dspace.solr.filters.LocalHostRestrictionFilter to reject requests not originating from localhost for security. The filter is defined in Solr's web.xml which would be located at [dspace]/webapps/solr/WEB-INF/web.xml
You can either remove this filter altogether by removing the following lines from web.xml:
<!-- Any path (name) registered in solrconfig.xml will be sent to that filter -->
<filter>
<filter-name>LocalHostRestrictionFilter</filter-name>
<filter-class>org.dspace.solr.filters.LocalHostRestrictionFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>LocalHostRestrictionFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Alternatively, add the following to web.xml to configure the filter to allow all requests including those not originating from localhost.
<!-- Limit access to solr webapp.
'true': allow requests from localhost only.
'false': allow requests from all remotes. -->
<context-param>
<param-name>LocalHostRestrictionFilter.localhost</param-name>
<param-value>false</param-value>
</context-param>
If you do either of these two, I highly recommend restricting access to Solr by other means. Personally, I've added the following to the solr context file at ${catalina.base}/conf/Catalina/localhost/solr.xml
:
<Valve
className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.0\.0\.1|::1|0:0:0:0:0:0:0:1|192\.168\.1\.\d+"
/>
which would allow access coming in from localhost and the local subnet. Refer to the section titled Access Control at https://tomcat.apache.org/tomcat-7.0-doc/config/valve.html for more information.
Upvotes: 0
Reputation:
This might be a problem with /etc/hosts. If /etc/hosts does not contain the definition of the hostname it fails. Try adding linux-ai1n to the hosts file, e.g.
127.0.0.1 localhost linux-ai1n
Upvotes: 1
Reputation: 5802
The first thing I would do is check if SOLR is actually deployed. Do you have a context file in tomcat for your solr deployment? Check under [tomcat-folder]/conf/Catalina/localhost. You should have an .xml file for your xmlui/jsp deploy and one for your solr deployment.
If solr is deployed correctly, check that you can access it yourself through the browser. localhost:port/solr/.
Upvotes: 0