eclipse-ee4j / cargotracker

The project demonstrates how you can develop applications with Jakarta EE using widely adopted architectural best practices like Domain-Driven Design (DDD).
https://eclipse-ee4j.github.io/cargotracker/
MIT License
343 stars 138 forks source link

Support WildFly #180

Open m-reza-rahman opened 3 years ago

m-reza-rahman commented 3 years ago

As an alternative to Payara or default runtime.

hantsy commented 3 years ago

WildFly/Hibernate is ok in my fork, I have not tried to run it in OpenLiberty.

m-reza-rahman commented 3 years ago

Does it also work with Payara? How about the Arquillian tests? If so, let me create a separate branch and you can issue the PR there. Once I can examine the code and do regression testing to verify everything is OK for both servers, we can merge it to master.

hantsy commented 3 years ago

Yes, I added Github Actions to build it and running tests. https://github.com/hantsy/cargotracker/

  1. JPA Entities, there are small fixes added due to some Hibernate-specific issues. Check notes in https://github.com/hantsy/cargotracker/blob/master/src/main/java/org/eclipse/cargotracker/domain/model/cargo/Itinerary.java
  2. Jackson is used by default in the latest WildFly, but not configure Java 8 DateTimeSupport. https://github.com/hantsy/cargotracker/blob/master/src/main/java-wildfly/org/eclipse/cargotracker/infrastructure/routing/client/JacksonObjectMapperContextResolver.java
  3. To avoid the famous lazy init exception from Hibernate etc, use a transaction to wrap the codes where some lazy access on a proxied object there, I added some @Transactional in some web layer codes, and use manual UserTransaction in the tests to make the codes work. https://github.com/hantsy/cargotracker/blob/master/src/test/java/org/eclipse/cargotracker/application/BookingServiceTest.java It seems the @Transactional did not work in Arquillian tests directly.
hantsy commented 3 years ago

Another issue I found about the LocalDateTime persistence in Hibernate, https://github.com/hantsy/cargotracker/blob/master/src/main/java/org/eclipse/cargotracker/domain/model/cargo/Leg.java#L66, the nano value is different when fetching from db.

Not sure there are some configuration in Hibernate to fix it.

m-reza-rahman commented 3 years ago

I just want to be clear - at this point do you have a codebase that works with both Payara and WildFly? Or is it the case that you have ported the code to WildFly and it no longer works with Payara? If it’s the latter, do you need help achieving the former?

hantsy commented 3 years ago

Yeah, my fork works both Payara and WildFly.

  1. The tests passed on both Payara and WildFly. My fork has more tests than the upstream.
  2. Manually deployed to WildFly successfully (but I am not sure everything is working well, not tried every links).
m-reza-rahman commented 3 years ago

OK, I have created a 'develop' branch you can issue PRs against. Hopefully we don't have to keep that branch longer term. It is a bit cumbersome.

hantsy commented 3 years ago

WildFly support is availble in #195

hantsy commented 3 years ago

I think the basic Hibernate/WildFly is included in the develop branch.

So it is better to split this issue into smaller issues.

Such as:

m-reza-rahman commented 3 years ago

I wouldn't say this is a very big priority for us just yet. It is a good way to get contributions though. I would like to keep it as-is for now.

m-reza-rahman commented 3 years ago

For folks interested in WildFly support, there is an initial starting point here: https://github.com/eclipse-ee4j/cargotracker/tree/wildfly-experimental.

hantsy commented 3 years ago

I tried to run the Cargotracker application on OpenLiberty,

  1. All annotation-based configurations for DataSource and JMS Queue did not work. Check: https://twitter.com/hantsy/status/1401371324652691457?s=20 and https://twitter.com/hantsy/status/1401369955912781831?s=20 I am not sure if the configurations via web.xml are working?

  2. MyFaces is another challenge, there are some compatible issues when opening the pages.

    Currently, I created a branch in my fork for running on OpenLiberty, https://github.com/hantsy/cargotracker/tree/openliberty-config Changes can be found in the PR: https://github.com/hantsy/cargotracker/pull/59/files

m-reza-rahman commented 3 years ago

Please post questions to the Open Liberty and MyFaces forums?

hantsy commented 3 years ago

Posted in OpenLiberty Gitter channels and groups.io, but Open liberty seems not active as others. In Gitter channels, only a few messages over months.

hantsy commented 3 years ago

Now the main problem is myfaces. For DataSource and JMS config, it seems I have to remove the global prefix(java:app/) from its JNDI name to make it work.

hantsy commented 3 years ago

@m-reza-rahman The portable @DataSourceDefinition and @JMSDestinationDefinition are required part of the Jakarta EE TCK?

m-reza-rahman commented 3 years ago

I don't know. I would ask on the TCK alias: https://accounts.eclipse.org/mailing-list/jakartaee-tck-dev.

m-reza-rahman commented 2 years ago

Some experimental work for Liberty support here: https://github.com/eclipse-ee4j/cargotracker/tree/liberty-experimental.

ojuschugh1 commented 1 year ago

I am working for documentation to use WIldFly as a runtime. Is it ok sir?

m-reza-rahman commented 1 year ago

Sure, please go ahead?

ojuschugh1 commented 1 year ago

ok thanks i was waiting for permission :)

m-reza-rahman commented 1 year ago

GlassFish port in progress here: https://github.com/eclipse-ee4j/cargotracker/pull/243.

m-reza-rahman commented 11 months ago

GlassFish support merged to main here: https://github.com/eclipse-ee4j/cargotracker/pull/282.

m-reza-rahman commented 11 months ago

Liberty support merged to main here: https://github.com/eclipse-ee4j/cargotracker/pull/283

marcelomrwin commented 2 months ago

If anyone wants to see an example working in wildfly, You can do so through the https://github.com/marcelomrwin/cargo-tracker/tree/wildfly branch. Furthermore, there is a demonstration of how to use with containers and the simple insertion of integrated authentication with keycloak

m-reza-rahman commented 2 months ago

It would be helpful to contribute towards merging this work to the main branch: https://github.com/eclipse-ee4j/cargotracker/tree/wildfly-experimental.