How to run Swagger on Jboss 7.1.3 with resteasy 2.3.4

2,121 views
Skip to first unread message

delkant

unread,
Aug 19, 2013, 12:13:13 PM8/19/13
to swagger-sw...@googlegroups.com
I'm trying to deploy a very simple resteasy project with swagger on it on jboss 7.1.3 without success, I also tried the resteasy example that comes with swagger-core but it didn't work.

Does anyone have any comment, documentation or anything to help?

thanks!!

tony tam

unread,
Aug 19, 2013, 12:21:00 PM8/19/13
to swagger-sw...@googlegroups.com
Hi, can you try out the sample here:


It should be trivial to follow that.  If you're seeing issues in the sample app, can you file a ticket in github so they can be fixed?

Ritesh

unread,
Aug 19, 2013, 12:38:01 PM8/19/13
to swagger-sw...@googlegroups.com
Hi,

You are able to run war file from https://github.com/riteshmodi/RestEasy. You have posted 3 days back. Are you facing problem in war?

Regards,
Ritesh

Ritesh

unread,
Aug 19, 2013, 1:05:11 PM8/19/13
to swagger-sw...@googlegroups.com
If you would be try java-resteasy example then it will give classnotfound exception because of Issue #285 . I have sent a pull request to remove the scala file with java one.


On Monday, August 19, 2013 9:43:13 PM UTC+5:30, delkant wrote:

delkant

unread,
Aug 19, 2013, 4:20:22 PM8/19/13
to swagger-sw...@googlegroups.com
Thank you guys, now it is working. I never had problem with the example you pointed out Ritesh, but I had several problems to integrate Swagger on my project.

The first problem was related to jersey and CDI, I solved it with this:
set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager=true"

Then I deployed my swagger-ui client inside an external apache server which caused a  Cross-Domain XMLHttpRequest error. I solved it deploying the swagger-ui in a .war folder on the same Jboss AS where my project was.

To do that I followed the next instructions:

1. Stop server if running

 

2. Set enable-welcome-root to false in stanalone.xml as only one app can run in root context [In fact, in any single context]

         <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">

             <configuration>

                   <mime-mapping name="manifest" value="text/xml"/>

                              </configuration>

                              <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>

                              <virtual-server name="default-host" enable-welcome-root="false">

                                             <alias name="localhost"/>

                              </virtual-server>

               </subsystem>

 

3. Add ROOT.war folder [Exploded war] or Your own folder with .war as part of the name in deployments folder

          The structure of ROOT.war is as follows:

               ROOT.war

               ROOT.war/WEB-INF

               ROOT.war/WEB-INF/jboss-web.xml

 

      where definition of jboss-web.xml setting the context root to / is as follows:

                    <?xml version="1.0" encoding="UTF-8"?>

              <jboss-web>

                   <context-root>/</context-root>

              </jboss-web>

 

4. Add the file ROOT.war.dodeploy in deployments folder

5. Start the server

delkant

unread,
Aug 20, 2013, 11:13:35 AM8/20/13
to swagger-sw...@googlegroups.com
In case someone else need it.

The jersey problem was because of the dependency I was using  ( I got it from  https://github.com/riteshmodi/RestEasy )

I deleted this 
<dependency>
   <groupId>com.wordnik</groupId>
   <artifactId>swagger-jersey-jaxrs_2.10</artifactId>
   <version>1.3.0</version>
</dependency>

and replaced it for

<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs_2.10</artifactId>
<version>1.3.0</version>
</dependency>

With these dependencies in the pom.xml I don't have to worry anymore about jersey.

<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<scope>provided</scope>
</dependency>
<!-- swagger--> 
<dependency>
  <groupId>com.wordnik</groupId>
  <artifactId>swagger-jaxrs_2.10</artifactId>
  <version>1.3.0</version>
</dependency>
 
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-annotations_2.10</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-core_2.10</artifactId>
<version>1.3.0</version>
</dependency> 
Reply all
Reply to author
Forward
0 new messages