I am getting a Connection refused - I think it is Solr / IPTABLES - can someone please help me ?

138 views
Skip to first unread message

Ashim Kapoor

unread,
Aug 11, 2021, 7:21:59 AM8/11/21
to DSpace Technical Support
Dear All,

I have setup DSpace 6.3

When I goto this link as a logged out user :

https://library.mayin.org/browse?type=author

I get :-

Connection refused (Connection refused)

Go to DSpace home

Please contact the site administrator if you wish to report this
error. If possible, please provide details about what you were doing
at the time this error occurred.

Contact site administrator || Show underlying error stack

Java stacktrace: java.net.ConnectException: Connection refused
(Connection refused) at java.net.PlainSocketImpl.socketConnect(Native
Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at
java.net.Socket.connect(Socket.java:607) at
org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:882)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.apache.solr.client.solrj.impl.HttpSolrServer.executeMethod(HttpSolrServer.java:448)
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:210)
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:206)
at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:91)
at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:310)
at org.dspace.discovery.SolrServiceImpl.search(SolrServiceImpl.java:1610)
at org.dspace.browse.SolrBrowseDAO.getSolrResponse(SolrBrowseDAO.java:201)
at org.dspace.browse.SolrBrowseDAO.doCountQuery(SolrBrowseDAO.java:257)

I have snipped the remaining error stack.

I have setup :-

1. Tomcat on port 8009 ( AJP connector)
2. Apache in front of Tomcat on port 80 and 443
3. Here is my iptables :-

cat /etc/iptables/rules
# Generated by iptables-save v1.4.14 on Mon Nov 2 10:47:47 2020
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -d 127.0.0.0/8 ! -i lo -j REJECT --reject-with icmp-port-unreachable
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 8000 -j ACCEPT
#-A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8000 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -m limit --limit 10/min -j LOG --log-prefix "iptables denied:
" --log-level 7
-A INPUT -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -j REJECT --reject-with icmp-port-unreachable
-A OUTPUT -j ACCEPT
COMMIT

4. Since 8009 port is on localhost I think the FIRST rule in iptables :-

-A INPUT -i lo -j ACCEPT

will take care of it. Perhaps I am mistaken about this?

Here is the relevant portion from my server.xml:-

<Connector port="8009" address="::" protocol="AJP/1.3"
secretRequired="false" URIEncoding="UTF-8" />

5. Here is the relevant snippet from [dspace-source]/dspace/config/local.cfg

# DSpace base host URL. Include port number etc.
dspace.baseUrl = http://library.mayin.org:80

In my setup : Apache redirects http traffic on port 80 to https on
port 443 which is proxied to port 8009 where Tomcat is listening.

Many thanks,
Ashim

Ashim Kapoor

unread,
Aug 12, 2021, 2:40:31 AM8/12/21
to DSpace Technical Support
Dear All,

Can someone please help me with this ?

Thank you,
Ashim

Ashim Kapoor

unread,
Aug 12, 2021, 5:34:33 AM8/12/21
to DSpace Technical Support
Dear All,

I think I found the answer to my query.

In local.cfg :-

# DSpace uses Solr for all search/browse capability (and for usage
statistics by default).
# The included 'solr' webapp MUST be deployed to Tomcat for DSpace to function.
# Usually it will be available via port 8080 and the 'solr' context path. But,
# But, you may need to modify this if you are running DSpace on a
custom port, etc.
solr.server = http://localhost:8080/solr

I am listening ONLY on port 8009 in Tomcat. I am not listening on port 8080.

That is why I think solr is not responding.

Query : How do I tell the software that my Solr is located at:

solr.server = ajp://localhost:8009/solr

Is the above valid?

or do I do :-

solr.server = http://localhost:80/solr

(and point to where Apache http server is listening ?)

I am counting on this redirection to happen : http 80 -> https 443 -> ajp 8009

Query: Will apache respond to query on port 80 of localhost if I have
set ServerName to a fixed value say library.example.com? I guess it
will.

Best Regards,
Ashim

Ashim Kapoor

unread,
Aug 12, 2021, 7:00:38 AM8/12/21
to DSpace Technical Support
Dear All,

This did not work. I get this error when I try to access

https://library.mayin.org/browse?type=author#


Expected mime type application/octet-stream but got text/html.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head>
<title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The
requested URL was not found on this server.</p> <hr>
<address>Apache/2.4.38 (Debian) Server at localhost Port 80</address>
</body></html>

Go to DSpace home

Please contact the site administrator if you wish to report this
error. If possible, please provide details about what you were doing
at the time this error occurred.

Contact site administrator || Show underlying error stack

Java stacktrace:
org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException:
Expected mime type application/octet-stream but got text/html.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head>
<title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The
requested URL was not found on this server.</p> <hr>
<address>Apache/2.4.38 (Debian) Server at localhost Port 80</address>
</body></html> at
org.apache.solr.client.solrj.impl.HttpSolrServer.executeMethod(HttpSolrServer.java:512)
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:210)
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:206)
at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:91)
at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:310)
at org.dspace.discovery.SolrServiceImpl.search(SolrServiceImpl.java:1610)
at org.dspace.browse.SolrBrowseDAO.getSolrResponse(SolrBrowseDAO.java:201)
at org.dspace.browse.SolrBrowseDAO.doCountQuery(SolrBrowseDAO.java:257)
at org.dspace.browse.BrowseEngine.getTotalResults(BrowseEngine.java:759)
at org.dspace.browse.BrowseEngine.browseByValue(BrowseEngine.java:453)
at org.dspace.browse.BrowseEngine.browse(BrowseEngine.java:96) at
org.dspace.app.xmlui.aspect.artifactbrowser.ConfigurableBrowse.getBrowseInfo(ConfigurableBrowse.java:859)
at org.dspace.app.xmlui.aspect.artifactbrowser.ConfigurableBrowse.addBody(ConfigurableBrowse.java:280)
at org.dspace.app.xmlui.wing.AbstractWingTransformer.startElement(AbstractWingTransformer.java:234)
at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498) at
org.apache.cocoon.core.container.spring.avalon.PoolableProxyHandler.invoke(PoolableProxyHandler.java:71)
at com.sun.proxy.$Proxy95.startElement(Unknown Source) at
org.apache.cocoon.components.sax.XMLTeePipe.startElement(XMLTeePipe.java:87)
at org.apache.cocoon.xml.AbstractXMLPipe.startElement(AbstractXMLPipe.java:94)
at org.dspace.app.xmlui.wing.AbstractWingTransformer.startElement(AbstractWingTransformer.java:251)
at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498) at
org.apache.cocoon.core.container.spring.avalon.PoolableProxyHandler.invoke(PoolableProxyHandler.java:71)
at com.sun.proxy.$Proxy95.startElement(Unknown Source)

Ashim Kapoor

unread,
Aug 12, 2021, 7:02:26 AM8/12/21
to DSpace Technical Support
Dear All,

When I try to access :-

https://library.mayin.org/jspui/

I get an Internal Server Error.

Can someone please help me ?

Thank you,
Ashim
Reply all
Reply to author
Forward
0 new messages