You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Vladimir Nišević <vn...@gmail.com> on 2016/05/16 09:02:44 UTC

Simpleapp 12.0.1. - Swagger not working when packaging war and deploying to Tomcat

Based on discussion in https://issues.apache.org/jira/browse/ISIS-1358 I
think I've found an issue, but I cannot create new JIRA issue any more -
seems the issue creation policy has been changed, so I am sending the issue
on this way.

*Steps to reproduce:*

1. Create archetype as described in guide
*mvn archetype:generate \*
*-D archetypeGroupId=org.apache.isis.archetype \*
*-D archetypeArtifactId=simpleapp-archetype \*
*-D archetypeVersion=1.12.1 \*
*-D groupId=com.mycompany \*
*-D artifactId=myapp \*
*-D version=1.0-SNAPSHOT \*
*-B*

2. execute "*mvn clean package"*

3. deploy simpleapp.war to external tomcat, eg. thru tomcat manager webapp
and call swagger WebUI*
http://localhost:8080/simpleapp/swagger-ui/index.html
<http://localhost:8080/simpleapp/swagger-ui/index.html> *

*Error*: Can't read swagger JSON from
http://localhost:8080/restful/swagger/public

It seems that the service
org.apache.isis.core.metamodel.services.swagger.SwaggerServiceDefault is
not recognized.

[image: Inline-Bild 2]

Re: Simpleapp 12.0.1. - Swagger not working when packaging war and deploying to Tomcat

Posted by Vladimir Nišević <vn...@gmail.com>.
Hi Dan, thanks for the advice!

We have a multiple stages for our system (Dev PC, DEV, INT, PROT),  the
context root value changes - at least between developer pc and deployment
on Tomcat.

Developer PC:
No context root since running with embedded jetty - no adaptations needed
for swagger-ui/index.html and web.xml

DEV, INT:
There is a context root e.g. "simpleapp" - adaptations needed in
swagger-ui/index.html
and web.xml


Any idea how to make that configurable so that swagger works in both cases?

Thanks,Vladimir



2016-05-17 1:10 GMT+02:00 Dan Haywood <da...@haywood-associates.co.uk>:

> Ah, I remember this issue.
>
> It turns out that it does work, so long as you deploy the webapp as
> ROOT.war.
>
> The issue is the path to the swaggerService does not resolve correctly when
> running as anything other than the root app.
>
> I did manage to figure out the hacks though if you really do want to deploy
> under "simpleapp":
>
> 1. in swagger-ui/index.html, add in "/simpleapp" to the paths for the
> input_baseUrl selector:
>
>                 <select id="input_baseUrl" name="baseUrl" style="height:
> 26px;">
>                     <option id="private" label="private"
> value="/simpleapp/restful/swagger/private"/>
>                     <option id="public" label="public"
> value="/simpleapp/restful/swagger/public"/>
>                     <option id="prototyping" label="prototyping"
> value="/simpleapp/restful/swagger/prototyping"/>
>                 </select>
>
> 2. in web.xml, allow access through to that path:
>
>
>         <filter-name>IsisSessionFilterForRestfulObjects</filter-name>
>         ...
>         <init-param>
>             <param-name>passThru</param-name>
>             <param-value>/simpleapp/restful/swagger</param-value>
>         </init-param>
>
>
> Less than ideal, but it is *only* a developer tool, so perhaps sufficient?
> Maybe just an update to the docs will suffice?
>
>
> Cheers
> Dan
>
>
>
>
>
>
>
>
>
> On 16 May 2016 at 10:17, Dan Haywood <da...@haywood-associates.co.uk> wrote:
>
> > Ok, thanks for reporting, I'll take a look hopefully this evening.
> >
> > Dan.
> > On 16 May 2016 10:02 am, "Vladimir Nišević" <vn...@gmail.com> wrote:
> >
> > Based on discussion in https://issues.apache.org/jira/browse/ISIS-1358 I
> > think I've found an issue, but I cannot create new JIRA issue any more -
> > seems the issue creation policy has been changed, so I am sending the
> issue
> > on this way.
> >
> > *Steps to reproduce:*
> >
> > 1. Create archetype as described in guide
> > *mvn archetype:generate \*
> > *-D archetypeGroupId=org.apache.isis.archetype \*
> > *-D archetypeArtifactId=simpleapp-archetype \*
> > *-D archetypeVersion=1.12.1 \*
> > *-D groupId=com.mycompany \*
> > *-D artifactId=myapp \*
> > *-D version=1.0-SNAPSHOT \*
> > *-B*
> >
> > 2. execute "*mvn clean package"*
> >
> > 3. deploy simpleapp.war to external tomcat, eg. thru tomcat manager
> webapp
> > and call swagger WebUI*
> > http://localhost:8080/simpleapp/swagger-ui/index.html
> > <http://localhost:8080/simpleapp/swagger-ui/index.html> *
> >
> > *Error*: Can't read swagger JSON from
> > http://localhost:8080/restful/swagger/public
> >
> > It seems that the service
> > org.apache.isis.core.metamodel.services.swagger.SwaggerServiceDefault is
> > not recognized.
> >
> > [image: Inline-Bild 2]
> >
> >
>

Re: Simpleapp 12.0.1. - Swagger not working when packaging war and deploying to Tomcat

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Ah, I remember this issue.

It turns out that it does work, so long as you deploy the webapp as
ROOT.war.

The issue is the path to the swaggerService does not resolve correctly when
running as anything other than the root app.

I did manage to figure out the hacks though if you really do want to deploy
under "simpleapp":

1. in swagger-ui/index.html, add in "/simpleapp" to the paths for the
input_baseUrl selector:

                <select id="input_baseUrl" name="baseUrl" style="height:
26px;">
                    <option id="private" label="private"
value="/simpleapp/restful/swagger/private"/>
                    <option id="public" label="public"
value="/simpleapp/restful/swagger/public"/>
                    <option id="prototyping" label="prototyping"
value="/simpleapp/restful/swagger/prototyping"/>
                </select>

2. in web.xml, allow access through to that path:


        <filter-name>IsisSessionFilterForRestfulObjects</filter-name>
        ...
        <init-param>
            <param-name>passThru</param-name>
            <param-value>/simpleapp/restful/swagger</param-value>
        </init-param>


Less than ideal, but it is *only* a developer tool, so perhaps sufficient?
Maybe just an update to the docs will suffice?


Cheers
Dan









On 16 May 2016 at 10:17, Dan Haywood <da...@haywood-associates.co.uk> wrote:

> Ok, thanks for reporting, I'll take a look hopefully this evening.
>
> Dan.
> On 16 May 2016 10:02 am, "Vladimir Nišević" <vn...@gmail.com> wrote:
>
> Based on discussion in https://issues.apache.org/jira/browse/ISIS-1358 I
> think I've found an issue, but I cannot create new JIRA issue any more -
> seems the issue creation policy has been changed, so I am sending the issue
> on this way.
>
> *Steps to reproduce:*
>
> 1. Create archetype as described in guide
> *mvn archetype:generate \*
> *-D archetypeGroupId=org.apache.isis.archetype \*
> *-D archetypeArtifactId=simpleapp-archetype \*
> *-D archetypeVersion=1.12.1 \*
> *-D groupId=com.mycompany \*
> *-D artifactId=myapp \*
> *-D version=1.0-SNAPSHOT \*
> *-B*
>
> 2. execute "*mvn clean package"*
>
> 3. deploy simpleapp.war to external tomcat, eg. thru tomcat manager webapp
> and call swagger WebUI*
> http://localhost:8080/simpleapp/swagger-ui/index.html
> <http://localhost:8080/simpleapp/swagger-ui/index.html> *
>
> *Error*: Can't read swagger JSON from
> http://localhost:8080/restful/swagger/public
>
> It seems that the service
> org.apache.isis.core.metamodel.services.swagger.SwaggerServiceDefault is
> not recognized.
>
> [image: Inline-Bild 2]
>
>

Re: Simpleapp 12.0.1. - Swagger not working when packaging war and deploying to Tomcat

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Ok, thanks for reporting, I'll take a look hopefully this evening.

Dan.
On 16 May 2016 10:02 am, "Vladimir Nišević" <vn...@gmail.com> wrote:

Based on discussion in https://issues.apache.org/jira/browse/ISIS-1358 I
think I've found an issue, but I cannot create new JIRA issue any more -
seems the issue creation policy has been changed, so I am sending the issue
on this way.

*Steps to reproduce:*

1. Create archetype as described in guide
*mvn archetype:generate \*
*-D archetypeGroupId=org.apache.isis.archetype \*
*-D archetypeArtifactId=simpleapp-archetype \*
*-D archetypeVersion=1.12.1 \*
*-D groupId=com.mycompany \*
*-D artifactId=myapp \*
*-D version=1.0-SNAPSHOT \*
*-B*

2. execute "*mvn clean package"*

3. deploy simpleapp.war to external tomcat, eg. thru tomcat manager webapp
and call swagger WebUI*
http://localhost:8080/simpleapp/swagger-ui/index.html
<http://localhost:8080/simpleapp/swagger-ui/index.html> *

*Error*: Can't read swagger JSON from
http://localhost:8080/restful/swagger/public

It seems that the service
org.apache.isis.core.metamodel.services.swagger.SwaggerServiceDefault is
not recognized.

[image: Inline-Bild 2]