0

I'm currently experiencing a problem at work I've been bashing my head against for a fair while and was hoping someone here might be able to provide some help. I'd like to point out this is my first question here, so I apologise if it could be better formatted, please feel free to let me know if I should add anything.

Our application has been running quite happily off a TomEE server for the past couple of months, but recently some higher ups in our company have told us that we MUST use Jetty. Unfortunately trying to dissuade them from this won't be an option unless we can prove using Jetty is actually impossible for us.

I've since tried setting up a Jetty server, but I've been focusing on using the maven-jetty plugin. We had great success with the tomee-maven plugin in the past so I hoped this would be just as effective.

Unfortunately, we've had no luck with this approach. I understand Jetty is not a JavaEE server, so we've tried adding dependencies. Take a look at our approach:

            <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.3.9.v20160517</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.openejb</groupId>
                    <artifactId>javaee-api</artifactId>
                    <version>6.0-6</version>
                </dependency>
                <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-validator</artifactId>
                    <version>4.3.2.Final</version>
                </dependency>
                <dependency>
                    <groupId>org.jboss.weld.se</groupId>
                    <artifactId>weld-se-core</artifactId>
                    <version>1.1.33.Final</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.openejb</groupId>
                    <artifactId>openejb-core</artifactId>
                    <version>4.7.4</version>
                </dependency>
            </dependencies>
        </plugin>

Unfortunately, every attempt to contact our application at the same URL as we used in TomEE has given us a 404. Note that our Java code has not changed whatsoever since trying to migrate to Jetty.

I have done a lot of Googling and come up with very little. This SE question was found, but it was written back in the days of Jetty 6. We're using Jetty 9, so the Servlet version is no longer an issue.

So, does anyone here think this can be done?

Further details: We are using JavaEE 6, We are focused on getting CDI and Bean Validation, other EE features are unimportant.

Community
  • 1
  • 1
s.harris
  • 593
  • 4
  • 11
  • This is totally doable and probably not too difficult, but you may want to start with a skeletal project. It's probably not enough to simply add the maven dependencies. Just get used to starting jetty and exposing a servlet first. Then add weld and whatever other features you need. For example, follow the instructions in the weld docs: http://www.eclipse.org/jetty/documentation/9.3.x/framework-weld.html – Robert Moskal Jun 07 '16 at 16:47
  • Also, it might just have worked. jetty starts on a different default port than tomcat. – Robert Moskal Jun 07 '16 at 16:57
  • I would also start by standing your application up with the jetty-distribution, enabling the cdi module as needed, etc. Then once you have this working step back into the maven plugin for development purposes. You should never use any maven plugin for 'production' deployment scenarios. – jesse mcconnell Jun 07 '16 at 19:59
  • Are there any stack traces? Anything in the logs? – Hardy Jun 08 '16 at 10:31

1 Answers1

0

openejb and weld will likely not work together so either use openwebbeans (transitive with openejb) or don't use openejb if you have to use weld.

Then sadly there is no openejb integration with jetty so depending what you use you can simply start openejb aside jetty in a filter or whatever startup hook or you will have to integrate them yourself for a more advanced integration.

Romain Manni-Bucau
  • 3,354
  • 1
  • 16
  • 13