activating the REST API

433 views
Skip to first unread message

Sheldon Pacotti

unread,
Dec 17, 2013, 9:52:30 PM12/17/13
to hippo-c...@googlegroups.com
Hi, all.

We have followed the instructions here to enable the REST API in Hippo:

     http://www.onehippo.org/7_8/library/concepts/rest/restful-jax-rs-component-support-in-hst-2.html

But when we try to hit an endpoint we get the following error:

[INFO] [talledLocalContainer] org.hippoecm.hst.core.container.ContainerException: Unknown namedPipeline JaxrsRestContentPipeline. Request processing cannot continue.

What are the possible causes of this error?

We haven't created custom JAX-RS Components yet.  Is that necessary for reading a document over REST?  Or can we get a simple JSON response of some kind by default?

Thanks in advance for any comments... We are just getting started with Hippo and could use some help.  :-)

Jeroen Reijn

unread,
Dec 19, 2013, 2:49:53 AM12/19/13
to hippo-c...@googlegroups.com
Hi Sheldon,

no don't have to create custom components before being able to use it. There are some content based components in the product by default. They may however not be what you need. The message indicates that it can't find the default provided JaxrsRestContentPipeline. 

Can you validate that the dependency is added properly to the pom and ends up in your site target WEB-INF/lib folder? It should contain the name of hst-jaxrs-X.jar

Also make sure you have that the site project contains the following folder 'src/main/resources/META-INF/hst-assembly/overrides/' with an XML file containing at least:

<?xml version="1.0" encoding="UTF-8"?>
       xsi:schemaLocation="http://www.springframework.org/schema/beans
 
 
  <!-- The following three imports will include pipeline configurations for
       both JaxrsRestPlainPipeline and JaxrsRestContentPipeline !!! -->
  <import resource="classpath:/org/hippoecm/hst/site/optional/jaxrs
                    /SpringComponentManager-rest-jackson.xml" />
  <import resource="classpath:/org/hippoecm/hst/site/optional/jaxrs
                    /SpringComponentManager-rest-plain-pipeline.xml" />
  <import resource="classpath:/org/hippoecm/hst/site/optional/jaxrs
                    /SpringComponentManager-rest-content-pipeline.xml" />
 
</beans>
 


--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
Most Hippo developers are active here and/or follow the Stackoverflow [hippo-cms] tag.
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/groups/opt_out.



--
Jeroen Reijn
Solution Architect
Hippo

Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 101 Main Street, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

http://about.me/jeroenreijn

Sheldon Pacotti

unread,
Dec 19, 2013, 12:18:09 PM12/19/13
to hippo-c...@googlegroups.com
Hi, Jeroen.

Thank you for the reply.

I verified that the dependencies were added to /site/pom.xml.

The file hst-jaxrs-2.26.08.jar is found in:
     /site/target/site/WEB-INF/lib
     /target/tomcat6x/webapps/site/WEB-INF/lib

but not in:
     /target/cargo/installs/apache-tomcat-6.0.37/apache-tomcat-6.0.37/lib

Should I check anywhere else?

I also checked that we have a file with the exact XML shown in your post in /site/src/main/resources/META-INF/
hst-assembly/overrides/.  Does that go anywhere else, such as in the top-level /src directory?

Is there any chance of a conflict with the "CMS REST" API included by default?  We see a file called "hst-cms-rest.xml" in the same "overrides" directory, which loads one of the same components.

Can you think of any other configuration steps we might have missed?  Should I check for XML parsing errors

At the risk of creating an ugly post, here is the output of the launch sequence for the site.  Does this contain any clues?

--------------

[INFO]                                                                        
[INFO] ------------------------------------------------------------------------
[INFO] Building Join Web App 1.01.00-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- buildnumber-maven-plugin:1.2:create (default) @ joinwebapp ---
[INFO] Checking for local modifications: skipped.
[INFO] Updating project files from SCM: skipped.
[INFO] Executing: /bin/sh -c cd /opt/hippo/release_1.07.06/joinwebapp && svn --non-interactive info
[INFO] Working directory: /opt/hippo/release_1.07.06/joinwebapp
[INFO] Storing buildNumber: -1 at timestamp: 1387469537134
[INFO] Executing: /bin/sh -c cd /opt/hippo/release_1.07.06/joinwebapp && svn --non-interactive info
[INFO] Working directory: /opt/hippo/release_1.07.06/joinwebapp
[INFO] Storing buildScmBranch: UNKNOWN_BRANCH
[INFO]
[INFO] --- cargo-maven2-plugin:1.1.3:run (cargo-run) @ joinwebapp ---
[INFO] [stalledLocalDeployer] Deploying [/opt/hippo/release_1.07.06/joinwebapp/cms/target/cms.war] to [/opt/hippo/release_1.07.06/joinwebapp/target/tomcat6x/webapps]...
[INFO] [stalledLocalDeployer] Deploying [/opt/hippo/release_1.07.06/joinwebapp/site/target/site.war] to [/opt/hippo/release_1.07.06/joinwebapp/target/tomcat6x/webapps]...
[INFO] [talledLocalContainer] Tomcat 6.x starting...
[INFO] [talledLocalContainer] Listening for transport dt_socket at address: 8000
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:20 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
[WARNING] [talledLocalContainer] WARNING: Problem with directory [/opt/hippo/release_1.07.06/joinwebapp/target/tomcat6x/common/classes], exists: [false], isDirectory: [false], canRead: [false]
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:20 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
[WARNING] [talledLocalContainer] WARNING: Problem with directory [/opt/hippo/release_1.07.06/joinwebapp/target/tomcat6x/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:21 PM org.apache.catalina.core.AprLifecycleListener init
[WARNING] [talledLocalContainer] INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:21 PM org.apache.coyote.http11.Http11Protocol init
[WARNING] [talledLocalContainer] INFO: Initializing Coyote HTTP/1.1 on http-8080
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:21 PM org.apache.catalina.startup.Catalina load
[WARNING] [talledLocalContainer] INFO: Initialization processed in 1117 ms
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:21 PM org.apache.catalina.core.StandardService start
[WARNING] [talledLocalContainer] INFO: Starting service Catalina
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:21 PM org.apache.catalina.core.StandardEngine start
[WARNING] [talledLocalContainer] INFO: Starting Servlet Engine: Apache Tomcat/6.0.37
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:21 PM org.apache.catalina.startup.HostConfig deployWAR
[WARNING] [talledLocalContainer] INFO: Deploying web application archive cargocpc.war
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:22 PM org.apache.catalina.startup.HostConfig deployWAR
[WARNING] [talledLocalContainer] INFO: Deploying web application archive site.war
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:22 PM org.apache.catalina.realm.JAASRealm setUseContextClassLoader
[WARNING] [talledLocalContainer] INFO: Setting useContextClassLoader = true
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:33 PM org.apache.catalina.startup.HostConfig deployWAR
[WARNING] [talledLocalContainer] INFO: Deploying web application archive cms.war
[INFO] [talledLocalContainer] 19.12.2013 17:12:48 INFO  main [EventProcessor.<init>:117] Automatic export is disabled
[INFO] [talledLocalContainer] 19.12.2013 17:12:48 INFO  main [InitializeItem.initContentResourceValues:205] Content resource configuration/richtextconfig/xinha.xml uses unrecognized delta xml semantics; export in this context will be disabled.
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:50 PM org.apache.catalina.startup.HostConfig deployDirectory
[WARNING] [talledLocalContainer] INFO: Deploying web application directory manager
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:50 PM org.apache.catalina.startup.HostConfig deployDirectory
[WARNING] [talledLocalContainer] INFO: Deploying web application directory host-manager
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:50 PM org.apache.coyote.http11.Http11Protocol start
[WARNING] [talledLocalContainer] INFO: Starting Coyote HTTP/1.1 on http-8080
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:50 PM org.apache.jk.common.ChannelSocket init
[WARNING] [talledLocalContainer] INFO: JK: ajp13 listening on /0.0.0.0:8009
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:50 PM org.apache.jk.server.JkMain start
[WARNING] [talledLocalContainer] INFO: Jk running ID=0 time=0/92  config=null
[WARNING] [talledLocalContainer] Dec 19, 2013 5:12:50 PM org.apache.catalina.startup.Catalina start
[WARNING] [talledLocalContainer] INFO: Server startup in 29254 ms
[INFO] [talledLocalContainer] Tomcat 6.x started on port [8080]
[INFO] Press Ctrl-C to stop the container...

--------------
Thanks again,
Sheldon

Jeroen Reijn

unread,
Dec 19, 2013, 2:18:30 PM12/19/13
to hippo-c...@googlegroups.com
On Thu, Dec 19, 2013 at 6:18 PM, Sheldon Pacotti <spac...@gmail.com> wrote:
Hi, Jeroen.

Thank you for the reply.

I verified that the dependencies were added to /site/pom.xml.

The file hst-jaxrs-2.26.08.jar is found in:
     /site/target/site/WEB-INF/lib
     /target/tomcat6x/webapps/site/WEB-INF/lib

but not in:
     /target/cargo/installs/apache-tomcat-6.0.37/apache-tomcat-6.0.37/lib

That's ok. It's just the default apache install.
 

Should I check anywhere else?

No that seems to be ok.
 

I also checked that we have a file with the exact XML shown in your post in /site/src/main/resources/META-INF/
hst-assembly/overrides/.  Does that go anywhere else, such as in the top-level /src directory?

Is there any chance of a conflict with the "CMS REST" API included by default?  We see a file called "hst-cms-rest.xml" in the same "overrides" directory, which loads one of the same components.

No it should not. 

Can you think of any other configuration steps we might have missed?  Should I check for XML parsing errors

Yes you could. Also checking the hippo-site.log might give some addition information. You should find that in  /target/tomcat6x/logs.
 

At the risk of creating an ugly post, here is the output of the launch sequence for the site.  Does this contain any clues?

No I don't see anything obvious in there. It might be worthwhile if you perhaps can send an xml export of you HST configuration containing the REST mount configuration. You can do so from the CMS console.
 

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
Most Hippo developers are active here and/or follow the Stackoverflow [hippo-cms] tag.
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/groups/opt_out.

Sheldon Pacotti

unread,
Dec 20, 2013, 5:55:32 AM12/20/13
to hippo-c...@googlegroups.com
Hi, Jeroen

Thanks again...

Here is the XML export for the mount we created, under hst:hst --> hst:hosts --> dev-localhost --> localhost --> hst:root --> restapi

<?xml version="1.0" encoding="UTF-8"?>
<sv:node sv:name="restapi" xmlns:sv="http://www.jcp.org/jcr/sv/1.0">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
    <sv:value>hst:mount</sv:value>
  </sv:property>
  <sv:property sv:name="jcr:uuid" sv:type="String">
    <sv:value>a2061c79-d95f-4c58-8e33-eab56d8397cc</sv:value>
  </sv:property>
  <sv:property sv:name="hst:isSite" sv:type="Boolean">
    <sv:value>false</sv:value>
  </sv:property>
  <sv:property sv:name="hst:namedpipeline" sv:type="String">
    <sv:value>JaxrsRestContentPipeline</sv:value>
  </sv:property>
</sv:node>

Does that look all right?

Thanks,
Sheldon
 

Jeroen Reijn

unread,
Dec 20, 2013, 6:11:36 AM12/20/13
to hippo-c...@googlegroups.com
Hi Sheldon,

thanks for the XML snippet. That looks fine to me. Can you also take a look at the hippo-site.log? 
The only way I can imagine that this does not work and the pipeline is not found is that somehow the imports in the Spring XML are not working or that the XML file is incorrectly formatted or is invalid somehow. 

If that does not give us any answers, the only way to solve this is by having somebody from our technical support department to take a look at the source code, but that would require a support contract and I'm not sure if you have that.

Jeroen


--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
Most Hippo developers are active here and/or follow the Stackoverflow [hippo-cms] tag.
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/groups/opt_out.

Sheldon Pacotti

unread,
Dec 20, 2013, 6:41:40 AM12/20/13
to hippo-c...@googlegroups.com
Hi, Jeroen.

I checked the hippo-site.log, and it was empty except for the failure to load the REST content parser.  (I'll post below.)

Also, I didn't see anything too suspicious in to other logs... maybe something slightly suspicious in hippo-cms.log.  I do think we might have just purchased an enterprise license.  If that's the case, how do we share our code?  (I will also reach out to our contact at Hippo.)

from hippo-site.log:
--------

20.12.2013 12:27:20 WARN  http-8080-4 [HstFilter.doFilter:518] org.hippoecm.hst.core.container.ContainerException for '/site/restapi/products/phones/blackberry-z10':

org.hippoecm.hst.core.container.ContainerException: Unknown namedPipeline JaxrsRestContentPipeline. Request processing cannot continue.
        at org.hippoecm.hst.core.container.HstRequestProcessorImpl.processRequest(HstRequestProcessorImpl.java:61)
        at org.hippoecm.hst.container.HstFilter.processResolvedSiteMapItem(HstFilter.java:850)
        at org.hippoecm.hst.container.HstFilter.doFilter(HstFilter.java:460)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.hippoecm.hst.container.XSSUrlFilter.doFilter(XSSUrlFilter.java:49)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:744)


slightly suspicious messages in hippo-cms.log:
------------


19.12.2013 17:12:48 INFO  main [EventProcessor.<init>:117] Automatic export is disabled
19.12.2013 17:12:48 INFO  main [InitializeItem.initContentResourceValues:205] Content resource configuration/richtextconfig/xinha.xml uses unrecognized delta xml semantics; export in this context will be disabled.
19.12.2013 17:13:35 ERROR http-8080-1 [JcrMap.get:303] This session has been closed. See the chained exception for a trace of where the session was closed.
19.12.2013 17:13:35 ERROR http-8080-1 [JcrMap.get:303] This session has been closed. See the chained exception for a trace of where the session was closed.
19.12.2013 17:13:35 ERROR http-8080-1 [JcrMap.get:303] This session has been closed. See the chained exception for a trace of where the session was closed.
19.12.2013 17:13:35 ERROR http-8080-1 [JcrMap.get:303] This session has been closed. See the chained exception for a trace of where the session was closed.
~                                                         

Sheldon Pacotti

unread,
Dec 20, 2013, 9:15:32 AM12/20/13
to hippo-c...@googlegroups.com
The problem turned out to be that the "geronimo-annotation_1.1_spec" jar was missing from the resulting war.  By rebuilding ("mvn package") we eliminated the error and now have access to the REST API.

Thanks again for all of the help.

Sheldon

Jeroen Reijn

unread,
Dec 20, 2013, 9:34:36 AM12/20/13
to hippo-c...@googlegroups.com
Great! Thanks for the feedback!


--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
Most Hippo developers are active here and/or follow the Stackoverflow [hippo-cms] tag.
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages