How to use custom reasteasy instead of jboss standard one - maven

I am working with jboss 6.2 that has resteasy standard version set to 2.3.7.
I need to use resteasy 3.0.8 and currently I am trying to achieve this result using maven and specifying that version in the pom, the correct resteasy is put in the war but seems like jboss keeps on using 2.3.7.
I am wondering if I am following the right path and if somebody can provide me some web resources to solve my issues.

I had the same issue.
This link could be usefull, it works great for me.

Related

Is there a version of postmark java client library which uses jersey 1.x instead of 2.x?

I have a RESTful web service application in java deployed on google app-engine which uses jersey 1.18.6.
I want to use postmark java client to send transactional emails from it.
When I integrated it, i was seeing the following exception:
javax.ws.rs.core.Response$Status$Family.familyOf(I)Ljavax/ws/rs/core/Response$Status$Family
From what I could find, I think this error was because of there were two different (and probably incompatible) version of jersey being used ,1.18.6 for jersey-server, jersey-guice and jersey-bundle and 2.25.1 for jersey-client (by postmark).
Then I tried to make the jersey version 1.18,6 throughout, so in the my main project pom, while including the dependency for postmark, I excluded the jersey-client (by added exclusions header) and separately added jersey-client dependency in my main project .
But then I got the following error:
java.lang.NoClassDefFoundError: javax/ws/rs/core/MultivaluedHashMap
This is I think the class MultivaluedHashMap is present only in jax-rs 2.x versions (which is compatible with jersey 2.x versions)
So my questions are:
Is there a version of postmark java client library which uses jersey 1.x instead of jersey 2.x?
If no then what options do I have other than migrating my main project from jersey 1.x to jersey 2.x. I don't want to do that since we will have to migrate not just the jersey dependencies but I think some other things like guice, shiro etc. which would be time consuming. Also it doesn't really seem optimal to modify multiple existing dependencies just to include one additional module.
There isn't. The very first commit of the project's pom.xml already used Jersey 2.25.1
as Mureinik mentioned above, when we worked on the library, our plan at Postmark was to use newer library versions, since they are better options in long run.
On our Github page Rupert made good suggestions, from which I find separate ClassLoader a good choice. I will play a bit with the library code in next couple of days on compatibility, however we are always in favour of using newer libraries for our codebase.
please check out my latest comment on Github issues page for possible solution for using older Jersey version https://github.com/wildbit/postmark-java/issues/11
It should be pretty easy to port the library to Jersey 1.x by porting only the HttpClient class on your side.

How to override weblogic application libraries?

I am developing a plugin for an application that is deployed in Weblogic 10.3.6. I need to use jersey 2.25 api in the plugin. The application ships jersey 1.8 in its APP-INF/lib folder. So, when I deploy the plugin the classes are all mixed up and throws class cast exception. I cannot modify the application. I have deployed the jersey 2.25 jars in DOMAIN_HOME/lib folder. Is there a way to use the new libraries instead of the supplied one in the application? If it is not possible can you suggest me any workaround to do so?
Do you deploy a share-lib which is based on jersey related jars. Remove that share lib. And try again, you may be success. But 10.3.6 don't support jersey 2.25.

Spring loaded 1.2.5 + Spring Boot 1.3.2. can't seem to get it to work

I came across a video on youtube ( https://www.youtube.com/watch?v=GTrNkhVnJBU ) where it demos Spring Loaded.
I'm trying to duplicate the same behavior but am still unsuccessful so far.
What I'm using:
Spring Tool Suite 3.7.2
Spring Boot 1.3.2-RELEASE
Spring loaded 1.2.5-RELEASE
Maven version 3.1.0
JDK 1.8.0_71
I tried the same thing as the guy does in the video (except for the versions being more up to date of course) but it doesn't work.
I also tried the "maven plugin" way as described in the spring docs here -> https://docs.spring.io/spring-boot/docs/current/reference/html/howto-hotswapping.html#howto-reload-springloaded-maven
But that also did not work.
I tried changing the versions of spring loaded to 1.2.0 (docs use that version) but that didn't do anything either.
I ran the app in STS itself, and also tried mvn spring-boot:run from command line, but both simply don't get the desired result.
When using mvn spring-boot:run I see that it is attaching the agent:
[INFO] Attaching agents: [C:\Users\ron.m2\repository\org\springframework\springloaded\1.2.5.RELEASE\springloaded-1.2.5.RELEASE.jar]
But changing RequestMappings or method signatures do not get picked up by spring loaded and thus the change is not reflected.
I'm a little out of ideas why I can't get this to work and any help would be greatly appreciated.
Spring loaded does not yet support spring 4.2. See https://github.com/spring-projects/spring-loaded/issues/139
So you either stick with DevTools which definitely speeds up the development process (although not as fast as spring-loaded), use JRebel (which supports the latest spring version) or downgrade to spring 4.1.
As an alternative you could also try the automatic restart feature of Spring Boot Devtools: https://spring.io/blog/2015/06/17/devtools-in-spring-boot-1-3. It restarts just the app and it is much quicker than restarting the whole JVM. You are loosing application state though, but it might be an alternative.

spring-boot tomcat security vulnerabilities patching

Since spring-boot comes with embedded tomcat containers, I was wondering how is the patching being done. If I decide to go for using embedded approach and a security vulnerability has been found out and the tomcat community has released a patch, how do I apply that patch to the embedded tomcat container which comes with the Spring-boot.
Any help would be greatly appreciated since it will help to decide to go the traditional route of standalone tomcats v's embedded.
According to this Spring blog post, you can specify any version of Tomcat you want. As long as it's released to the Maven repo, just add the following property to your Maven build properties specifying whatever version you like: <tomcat.version>8.0.3</tomcat.version>.
See http://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-core for versions currently available in Maven Central.

Is it possible to run Mule 2.2.1 on spring 3?

We have an application that is currently running spring 2.5.6 and mule 2.2.1. We have decided to go ahead and upgrade the app to use spring 3.2 we also upgraded spring security to 3.1. I understand that Mule 2.2.1 uses spring 2.5.6 for configuration and so forth. We were to re-factor our code and build the entire project. However after deploying the application and starting the server, my server started in about 6 seconds instead of the normal 30 seconds and then I noticed that none of my services were not loaded. Unfortunately after days of investigating I cannot find where everything fails, as there are no errors in any of the logs including spring and mule logs. My question is it possible to get these to play together or should I just forget about getting this to work.
I read this post http://lifeinide.blogspot.com/2012/07/spring-3-and-mule-2-initialized-by.html and followed these instruction and still was not able to get it work. Mule says it started up just fine without any errors but I can hit any of my services. Any help? Thanks
Thanks #genjosanzo for the pointer. It helped met dig into this issue better and eventually make it work.
#mtanzania,
We had a similar need like yours - need to make Mule 2.2.1 work with Spring 3.2.x releases. Upgrade to Mule 3 involved rewrite of Mule extensions such as exception handling strategies, a RabbitMQ Mule transport etc. Upgrade to Mule 3 was therefore ruled out.
In order to make this work, you need to rewrite/update 3 java files from your module:
groupId:org.mule.modules
artifactId:mule-module-spring-config
version:2.2.1
with implementations from :
groupId:org.mule.modules
artifactId:mule-module-spring-config
version:3.4.0
To be more specific, you need these classes to be updated/upgraded: MuleBeanDefinitionDocumentReader.java, MuleApplicationContext.java and SpringXmlConfigurationBuilder.java
With these updated versions, you can continue to create the MuleContext like:
SpringXmlConfigurationBuilder springConfigBuilder = new SpringXmlConfigurationBuilder(muleConfigPaths);
MuleContext context = new DefaultMuleContextFactory().createMuleContext(springConfigBuilder)
The modified implementations are here : Mule in Trooper and sample class that uses this is here : Trooper Mule container
Mule uses some internal spring API to parse the mule configuration and creates the correspondent beans.
For this reason the upgrade might work with spring 3.0.x but I'm pretty sure that something got broken with spring 3.1.x (i.e. this code has been introduced to maintain backward compatibility).
How about upgrading mule as well? Most of the 2.2.x syntax is still supported and many new feature has been introduced in newer mule versions.
FWIW, the above answer from #regunathb is right on. Patching in those three classes works. However, it is important to note that the 3.4 version of those classes from mule-module-spring-config will not work as-is. You must get the modified versions of the classes that #regunathb posted on GitHub, otherwise you'll end up with various incompatibilities between 3.4 and 2.2.1.

Resources