Not able to access resources api in test env, but works in local env

here is my server.xml -

<?xml version="1.0" encoding="UTF-8"?>
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
    maxThreads="150" minSpareThreads="4"/>
-->


<!-- A "Connector" represents an endpoint by which requests are received
     and responses are returned. Documentation at :
     Java HTTP Connector: /docs/config/http.html
     Java AJP  Connector: /docs/config/ajp.html
     APR (HTTP/AJP) Connector: /docs/apr.html
     Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           maxThreads="@tomcat.max.threads@"
           redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
           port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" />
-->
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
     This connector uses the NIO implementation. The default
     SSLImplementation will depend on the presence of the APR/native
     library and the useOpenSSL attribute of the
     AprLifecycleListener.
     Either JSSE or OpenSSL style configuration may be used regardless of
     the SSLImplementation selected. JSSE style configuration is used below.
-->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
           maxThreads="150" SSLEnabled="true">
    <SSLHostConfig>
        <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
                     type="RSA" />
    </SSLHostConfig>
</Connector>
-->
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
     This connector uses the APR/native implementation which always uses
     OpenSSL for TLS.
     Either JSSE or OpenSSL style configuration may be used. OpenSSL style
     configuration is used below.
-->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
           maxThreads="150" SSLEnabled="true" >
    <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
    <SSLHostConfig>
        <Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
                     certificateFile="conf/localhost-rsa-cert.pem"
                     certificateChainFile="conf/localhost-rsa-chain.pem"
                     type="RSA" />
    </SSLHostConfig>
</Connector>
-->

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" secretRequired="false" />


<!-- An Engine represents the entry point (within Catalina) that processes
     every request.  The Engine implementation for Tomcat stand alone
     analyzes the HTTP headers included with the request, and passes them
     on to the appropriate Host (virtual host).
     Documentation at /docs/config/engine.html -->

<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">

  <!--For clustering, please take a look at documentation at:
      /docs/cluster-howto.html  (simple how to)
      /docs/config/cluster.html (reference documentation) -->
  <!--
  <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
  -->

  <!-- Use the LockOutRealm to prevent attempts to guess user passwords
       via a brute-force attack -->
  <Realm className="org.apache.catalina.realm.LockOutRealm">
    <!-- This Realm uses the UserDatabase configured in the global JNDI
         resources under the key "UserDatabase".  Any edits
         that are performed against this UserDatabase are immediately
         available for use by the Realm.  -->
    <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
           resourceName="UserDatabase"/>
  </Realm>

  <Host name="localhost"  appBase="webapps"
        unpackWARs="true" autoDeploy="true">

    <!-- SingleSignOn valve, share authentication between web applications
         Documentation at: /docs/config/valve.html -->
    <!--
    <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
    -->

    <!-- Access log processes all example.
         Documentation at: /docs/config/valve.html
         Note: The pattern used is equivalent to using pattern="common" -->
    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
           prefix="localhost_access_log" suffix=".txt"
           pattern="%h %l %u %t &quot;%r&quot; %s %b" />

  </Host>
</Engine>

To access resources api - we access it - http://localhost:8080/site/resourceapi/pages/

This setup works perfectly fine in local env.

However, when deployed to test env i see this error when deploying

ERROR main [SpringComponentManager.initialize:141] Failed to initialize invalid module instance, {com.onehippo.cms7.targeting.hst.engine.pagemodelapi.v09}, because the parent ‘org.hippoecm.hst.pagemodelapi.v09’ does not exist. Module instance will be ignored.

As a result i get error accessing the resource api (org.springframework.web.client.ResourceAccessException: I/O error on GET request for “https://localhost:8443/site/resourceapi/pages/cities/citiestopicdetailpage”: Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
and i am cannot publish any xpage.

I tried changing my resource api url from http://localhost:8080/site/resourceapi/pages/https://localhost:8443/site/resourceapi/pages/ , also doesn’t work.

FYI - in local the app is all served under http. On test env the app is behind VPN and can be accessed only over https.

Hi,
First, the SpringComponentManager.initialize error does not result in the connection error. That one is about Spring set-up and is fixed in 15.2.2 per ENT-6483.

Second, are you sure your test env is accessible via localhost, as in “https://localhost:8443/site/”? That sounds incorrect. Normally it would have a different domain, maybe Apache or nginx in front [1], and the HST configuration should match you set up [2]

HTH
Jeroen

[1] Configure Apache HTTP Server as Reverse Proxy for Hippo - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS
[2] Configure Virtual Hosts in an Environment - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS

Hi Jeroen,
Sorry i missed mentioning this, my local env is accessible at http://localhost:8080/site…, i changed it to https:/localhost:8443/site… as test env is not working.

The error i get when i have http://localhost:8080/site is - org.springframework.web.client.ResourceAccessException: I/O error on GET request for “http://localhost:8080/site/resourceapi/pages/…”: Server redirected too many times (20); nested exception is java.net.ProtocolException: Server redirected too many times (20)

You most probably have https enabled on that mount, try to remove it, see: