We have a standalone desktop client that connects to a JBoss server. For version 6 of JBoss the maven dependency used by the desktop client project was
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
</dependency>
For JBoss 7.1.1 no such dependency exists. What is the correct maven dependency that should be used when developing a standalone desktop client?
If you directly connect to EJB you need the EJB client libs.In earlier versions of JBoss AS7 there were a bunch of individual dependencies required. Starting (AFAIK) from 7.1.1-Final a BOM (bill of materials) is available:
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-ejb-client-bom</artifactId>
<version>7.1.1.Final</version>
<type>pom</type>
</dependency>
</dependencies>
You will find here detailed information on JNDI lookups and invoking methods.
I'm not too familiar with the JBoss AS 6 client, but for the JBoss AS 7 one you would need the following.
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-controller-client</artifactId>
<version>${as.version}</version>
</dependency>
</dependencies>
You'll be using the org.jboss.as.controller.client.ModelControllerClient for standalone or org.jboss.as.controller.client.helpers.domain.DomainClient for domain mode.
Related
I am using below Red Hat Fuse BOM for my camel application to get the camel dependencies for my project. It returns camel dependencies version 2.23.x
<dependencyManagement>
<dependency>
<groupId>org.jboss.redhat-fuse</groupId>
<artifactId>fuse-springboot-bom</artifactId>
<version>7.7.0.fuse-sb2-770010-redhat-00001</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependencyManagement>
My Maven is set to get the dependency through JFrog, which blocks camel-spring-2.23.x version due to some vulnerability found in this version of jar as per our client security policy. My question is, Will it be correct to specify the camel-spring dependency in pom.xml as below to download 2.25.x version and let the other camel lib dependencies as 2.23.x ? Is it going to cause any issue in amy camel application due to different camel library versions?
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>2.25.2</version>
</dependency>
I'm working with Spring Boot 2.4.4 and I would change the default web server Tomcat to undertow orJHetty but I find it very difficult using both Gradle or Maven.
An old documentation exposes how do it but I'm sure all is changed because now tomcat, undertow and jetty configuration is embedded in the core library:
https://docs.spring.io/spring-boot/docs/2.1.9.RELEASE/reference/html/howto-embedded-web-servers.html
How do it in the 2.4.4 version?
There are no changes between the versions. This is well described right at the Spring Boot 2.4.4 Reference guide, right in 3.1. Use Another Web Server section. Basically, the change consists of two steps:
Exclude embedded Tomcat server dependency from the spring-boot-starter-web artifact:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<!-- Exclude the Tomcat dependency -->
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
Include your embedded server as a separate dependency instead:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
Just don't forget to notice the following quote from the reference guide in the very same section which might or might not be relevant to you:
The version of the Servlet API has been overridden as, unlike Tomcat 9 and Undertow 2.0, Jetty 9.4 does not support Servlet 4.0.
follow three steps to change the default web server, change configuration in pom.xml.
1.exclude the default web server.
2.Include the necessary web server.
3.Maven update.
For example,
Instead of this
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
Add this one
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
for the necessary server add the appropriate web server dependency.
Here is the relevant portion of pom.xml
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-all-5.0</artifactId>
<scope>provided</scope>
</dependency>
Why is the scope of resteasy compile (which is default, when none is provided) but that of javax.servlet is provided. I am deploying this on Jboss which ships with resteasy. so shouldn't the scope of resteasy be provided as well?
and btw, I do not see any version mentioned. so what is the default version that gets picked up?
If you are using jboss 7, resteasy-jackson-provider is included, so it would be correct to use a provided scope.
I guess default version is being picked up from a bom declared in the dependencyManagement section of your pom, could that be right?
For older jboss versions, resteasy is not included, so you will have to add the jars to your WEB-INF/lib directory.
Necessary jars can be obtained using maven (compile scope) or check out this link http://www.mastertheboss.com/jboss-frameworks/resteasy/resteasy-tutorial
The RESTEasy API and runtime is provided by newer versions of JBoss. Usually you import a Java EE-spec pom in the dependencyManagaement section and add the needed APIs in the dependency section, e.g for JBoss AS7:
<dependencyManagement>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>3.0.2.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
The runtime will use the JSON-Provider which is found on the classpath. So it makes sense to add them with scope compile to your project. If you want to use Jettison you'd add following to your pom:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jettison-provider</artifactId>
</dependency>
If you don't add one your application server may provide a default one. JBoss AS7 / Wildfly for instance will use resteasy-jackson-provider if you don't add a provider to the classpath.
JBoss 5 does not provide the JAX-RS libs as far as I know so there it makes sense to add the resteasy-jackson-provider with scope compile.
How can I deploy a web-app (war) on different GlassFish standalone instances, while using different Mojarra versions on every instance.
We are planning to update the used Mojarra version from 2.1.6 used default by GF 3.1.2.2 to Mojarra 2.1.24. In our JSF Applications we are using PrimeFaces from version 2.2 to 3.5. Before we go in production with our application, after Mojarra update, we want to test it on a standalone GlassFish instance within the same Node.
How can we accomplish, that the app deployed on this standalone instance is using different Mojarra version then available on the domain administration server. The project is build with maven.
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.1.24</version>
<scope>runtime</scope>
</dependency>
Tried scope of the dependency with compile, provided and runtime. While deploying
[#|2013-10-25T13:11:25.122+0200|INFO|glassfish3.1.2|javax.enterprise.resource.webcontainer.jsf.config|_ThreadID=150;_ThreadName=Thread-2;|Mojarra 2.1.6 (SNAPSHOT 20111206) für Kontext '/TestApp'
Even putting javax.jaces.jar in instance-root/lib/applibs and setting --libraries option while deploying dowsn't work.
Thanks for any ideas.
Well, what you can do is using Maven profiles to include conditional dependencies. Glassfish contains jsf API and implementation out of the box. So what you need for your project is to specify what API you want to code against, marking it as provided as you don't need to deploy them:
<profiles>
<profile>
<id>old-glassfish</id>
<dependencies>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>new-glassfish</id>
<dependencies>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>
I don't do Glassfish, but also you should change the provided JSF libraries to stablish the one you're interested in. There are some threads here at SO which explain what you have to do to update them.
Otherways, you could also use your own JSF implementation for each application, configuring the server properly not to use its bundled libraries.
See also:
How to update Mojarra version in GlassFish
I'm developing CXF web services with JDK 7 + Eclipse Juno + Maven 3 and deploying on a WebSphere 7 Application Server.
I've spent hours to fiund the right configuration of dependencies (a complex mix of runtime, system, compile and provided scopes) that the WAS accepts without conflicts, but with this configuration my jetty plug in does not work anymore.
How can I specify a classpath specific only for the Jetty plugin (hopefully a maven configuration)?
AFAIK, the only way to make the jetty plugin working properly regarding all those dependency issues is to specify all dependencies that are <provided> in your webapp as direct dependencies of the jetty plugin (and unfortunately, this brings kind of redundancy):
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.0.0.v20130308</version>
...
<dependencies>
<!-- put here all your dependencies with scope provided in your webapp -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0</version>
</dependency>
...
</dependencies>
</plugin>