Deploying war file in Payara 4 with Ejb components dependencies - annotations

Can we deploy a war file in Payara 4 having #Ejb annotated components in it?

Yes, you can.
Any annotations that are part of any Java EE 7 specification are processed by Payara and should work.

Related

EJB stateless beans are not injected properly after migration to JBOSS 7.4 and Java11

Recently we migrated our application from Jboss 6 to JBoss 7.4 version.
I have a XXXFilter which implements javax.servlet.Filter. XXXFilter uses #Inject annotation to inject some EJB stateless beans. But the problem is the beans are not getting injected into XXXFilter. It's working fine in jboss 6 and jdk8 but NOT working after we migrated to jboss7.4 and jdk11.
Any ideas?
You need to use the #EJB annotation.

Migrate EJB + WAR to Jboss EAP6

I have a .jar with EJBs and a .war that invokes these EJBs.
They used to be deployed in a Jboss SOA Platform 5 and now must be in a Jboss EAP 6.
The .war is looking up the EJBs with ejbname/remote. This is hardcoded (I checked with a decomplier).
I know that, in EAP 6, the EJBs are registered in the JNDI like [/<application-name>]/<module-name>/<bean-name>[!<full-qualified-interface-name>].
Is there any way for me to change the JNDI registry name of the EJBs. Maybe via Jboss CLI?
I only have the binaries and have no access to the source.

Is there any way to have a fully portable Java EE 6 deployment?

Is it possible to make a Java EE 6 application deployable on any Java EE 6 Container (like JBoss or GlassFish, etc) without using their modules / libraries?
If for example I want Hibernate or Weld then add these in my Maven pom.
In other words, is there any "vanilla" container or can JBoss or GlassFish be made "vanilla"?
I´m sorry... but to be honest I don´t understand your question.
Java EE applications are in most cases deployable an all containers - as long as they are not using packages or configurations which are specific to the chosen container.
Even if you add libraries in your POM and the applications are packaged as WAR or EAR this should work.
Weld is not needed because the API is part of Java EE 6. If you want to use JPA you also don´t need hibernate.

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