Eclipse STS WildFly deployment - Target runtimes disabled - eclipse

We have a java web application deployed in a Tomcat 9 container and running successfully. We wanted to change the application deployment to Wildfly 27 application server. The direct deployment of app.war used in tomcat container to WildFly standalone folder showed deployment as failed.
So we did the following to create a deployment war by building source from IDE by using JBoss tools.
-Installed WildFly 27
-Imported application source code in Spring Tool Suite (STS)
-Installed JBoss tools in STS
-Added WildFly server in STS. With no projects added, I can start the server successfully.
In Project Properties, I have the following configuration:
Properties -> Java Build Path
Here I removed the previously existing Server Runtime[Tomcat] and added WildFly 27.0 Runtime.
Properties -> Java Compiler
Properties -> Server
Properties -> Project Facets
In Runtimes tab, WildFly 27.0 Runtime is disabled.
Properties -> Targeted Runtimes
Here also, WildFly 27.0 Runtime is disabled. So I can’t change from Tomcat to WildFly.
How can I select WildFly 27.0 Runtime for the project? The instruction says to uninstall certain Facets to activate disabled runtimes. Which facets to uninstall?
When I started the WildFly server with the application, it shows errors
java.lang.IllegalArgumentException: UT010009:
class org.springframework.web.servlet.DispatcherServlet does not implement jakarta.servlet.Servlet
service jboss.deployment.unit."app.war".undertow-deployment.UndertowDeploymentInfoService: Failed to start service
Please help.

WildFly 27 is a Jakarta EE 10 server. You cannot run a Jakarta EE 8 based, javax namespace, in WildFly 27. You'd need to either upgrade your dependencies to be Jakarta EE 10 based and Spring 6 or use WildFly 26.

Related

How do I upgrade from CDI1.0 to CDI 1.1

For Java EE project I use JBoss AS7.1 and Eclipse IDE. In Eclipse I can see the current version of CDI under: Project -> Properties -> ProjectFacets -> CDI
How do I change the version to CDI 1.1 ?
If you are prepared to upgrade your application server, then make the switch to WildFly 8 or higher (WildFly is the new name of JBoss AS). CDI 1.1 is part of the Java EE 7 spec, which is implemented in WildFly 8.*, GlassFish 4.*, et al. If you are not able to upgrade your application server, you might be able to drop a JAR of an implementation of CDI 1.1 into your build, but it would probably be better to upgrade to EE 7 if you can.

How to deploy Jboss7 on eclipse?

My eclipse doesnt not show Jboss 7 under File -> New -> Other -> server
Instead shows only Jboss 5 , which I cannot use to deploy my project since the error reads The server does not support version 3.0 of the J2EE Web module specification.
Download the "Development" version of JBoss tools, which includes the latest Jboss AS Adapter for JBoss 7, by pasting this URL into
Eclipse --> Help menu --> install new software:
http://download.jboss.org/jbosstools/updates/development/indigo/

Spring Petclinic (2013 version) doesn't work in JBoss AS 7

I'm trying to run the Spring Petclinic example on JBoss AS 7.1.1. I've imported the maven project from https://github.com/SpringSource/spring-petclinic/ to Eclipse Juno and successfully deployed it, but http://localhost:8080/petclinic/ gives me HTTP Status 404 error.
The only problem I can see from the log is
JBAS011006: Not installing optional component
org.springframework.web.context.request.async.StandardServletAsyncWebRequest
due to exception:
org.jboss.as.server.deployment.DeploymentUnitProcessingException:
JBAS011054: Could not find default constructor for class
org.springframework.web.context.request.async.StandardServletAsyncWebRequest
but according to Spring3.2 and jboss as 7 it's normal behavior.
I've found some advices about modifying the Petclinic sample for JBoss, but all of them are for the old version of the sample, not the updated 2013 version (http://blog.springsource.org/2013/03/21/spring-petclinic-is-on-github/).
The sample works fine with Tomcat 7.0.39.
Update:
The problem only occurs when I run the sample from Eclipse using JBoss. As Andrzej said, building the app with standalone maven and deploying the resulting war works fine.
The problem is JBoss/JBoss Tools use incorrect war name and context root when deploying from Eclipse.
In pom.xml the war name is specified as <warName>petclinic</warName>, but JBoss uses "spring-petclinic" instead. Tomcat, Glassfish, and Weblogic don't have this problem and work correctly with deployment from Eclipse.
The workaround is either to use http://localhost:8080/spring-petclinic/ instead of http://localhost:8080/petclinic/ or configure the context root via WEB-INF/jboss-web.xml:
<jboss-web>
<context-root>petclinic</context-root>
</jboss-web>
The Spring Petclinic (2013 version) works well with Jboss AS7. Tried it with two Jboss versions. What you need is to build app with maven and deploy it to standalone/deployments folder.
Problem is running it from Eclipse Juno.

Problems deploying Java EE 6 application from netbeans to JBoss 6

I have a Java EE 6 application developed on Netbeans 7 and try to deploy it on a JBoss 6 instance. The application makes use of JAX-RS but I am not using any Jersey specific aspects, just standard JAX-RS features.
Deployments as a WAR fails because of some missing Jersey classes and deployment as an EAR fails due to org.jboss.deployers.spi.DeploymentException: Only one JAX-RS Application Class allowed
Any idea what the cause of this might be?
What I do not want to do is disable RESTEasy in JBoss, I'd rather produce an application that runs on any Java EE 6 container without tweaks.
Glassfish silently adds Jersey JAX-RS packages to the build. If you uncheck the 'Package' checkbox in the project's lib configuration, the application is packaged without Jersey.
This makes sense, because after all, the target of the deployment might be a non-Java EE 6 container such as Tomcat.

How to deploy EJB on server?

I am learning EJB3 from last few days. I have many questions regarding EJB, application servers and deployment of EJB.
To start with, I have created one simple helloworld stateless session bean but I don't know how to deploy it on server. It has single bean class, bean interface and one servlet client. I have used eclipse to develop this project.
None of the books that I read gives step by step details about how to put EJB on server and how to access those beans.
I have JBoss 6 server and I also have Java EE budle downloaded from sun website. Does this Java EE bundle contains Glassfish server? or do I need to download it separately?
Can anyone please give me step by step details of how to put my bean and its client on server (JBoss or Java EE)?
And why do we need to include bean interface class in EJB client code? I mean either we need to keep client and bean in same package or if we keep them in seperate packages we need to import bean interfaces in client code. Am I right?
With Java EE 6, you can package your Servlet and your EJB in a WAR (either package your EJB in a JAR and put it in WEB-INF/lib or simply put all classes in WEB-INF/classes). And to deploy this WAR, copy it to:
$GLASSFISH_HOME/domains/<domain1>/autodeploy for GlassFish v3*
$JBOSS_HOME/server/default/deploy for JBoss 6
With Java EE 5, you'll have to package your code in a EAR.
And if you want to deploy your application from Eclipse (using the Eclipse WTP), you'll have to install the appropriate server adapter. For Eclipse Galileo and GlassFish (there is currently no adapter for JBoss 6 AFAIK), right-click the server view, select New > Server, click on Download additional server adapters and select the GlassFish adapter. Finish to define your new GlassFish v3 Java EE 6 server and deploy your application on it (right-click on your application then Run As > Run on Server). For Eclipse Helios and GlassFish, you can follow the link given by #VonC (manual install) or check this answer (install via the Update Site).
You need to add GlassFish to your Eclipse installation (see GlassFish plugin for Eclipse).
The full process is described here (with the latest Eclipse Helios 3.6M6)
You should export as EJB into your jboss<version>\server/default/deploy folder and then add the build path for it on the servlet's web project. You can "Run on Server" and choose an application server just like you would in any project, no need to export the WAR although if you do that, you're gonna have to re-export your WAR every time you modify your code
AFAIK there's no Eclipse plugin for JBoss 6 but Eclipse provides one for 5.1