I'm learning about Java EE (EE 6 specifically) and find the differences between EJB and EJB Lite a little confusing.
Java EE6 web profile only supports EJB Lite.
My understanding of "EJB Lite" is that it is a simpler subset of EJB (I can find those differences documented easily enough) and you package your EJB classes in a WAR.
So will I only able to access those EJB classes from the webapp contained in the same WAR (or another webapp if I put both of them in the same EAR) ?
I assume that this means that the EJB Lite classes are deployed to the web container. Does this mean that there is no EJB container in the EE6 web profile ?
(also do we need a web-profile tag?)
Note that EJB lite is shared by both the web profile and the EJB embeddable container.
1.
So will I only able to access those
EJB classes from the webapp contained
in the same WAR (or another webapp if
I put both of them in the same EAR) ?
Section 20.4.3 of the EJB 3.1 spec:
The local client view(including the
no-interface view) of an enterprise
bean component defined within a .war
file is only required to be accessible
to components within the same .war
file. Applications needing access to
the local client view of an enterprise
bean from a different module in the
same application should use an ejb-jar
file to define the enterprise bean
that exposes the local client view.
Note, the spec allows vendor extensions so that other modules can use the EJBs, but relying on that won't be portable.
2.
assume that this means that the EJB
Lite classes are deployed to the web
container. Does this mean that there
is no EJB container in the EE6 web
profile ?
This is implementation specific, but given the existence of an embeddable EJB container, I suspect most implementations will ship either the full EJB container or a subset.
3.
(also do we need a web-profile tag?)
No.
Related
We have a plain java web project with some servlets, some JPAs and our logic.
We want to move to Cloud Foundry . I have learnt that Spring boot comes up with a lot of nice cloud foundry features out of the box like support for CF environment variables parsing, CF service broker API implementation.
Now i don't want to move to Spring MVC since we already have the application running with plain java web framework.
Can i still use Spring cloud foundry related projects to take advantage of Cloud Foundry related features like parsing of env variables ?
Are they internally dependent on Spring core, spring mvc projects ? Will including the Spring Cloud Foundry project bloat my total deployable war size due to all internal spring dependencies.
Best Regards,
Saurav
A lot of this depends on exactly which features you want to use. The awesomeness you get from Spring Boot requires Spring & so it won't transfer to your app unless you embrace & use Spring. The same goes for Spring Cloud.
You specifically mentioned parsing service information from environment variables (i.e. VCAP_SERVICES & VCAP_APPLICATION). This is the one exception that comes to mind. You can use Spring Cloud Connectors in a limited capacity without Spring. See this link for details. It's not as full-featured as what you'd get if you were using Spring & Spring Boot, but it will give you some help.
If you don't want to use SCC, you can always parse the environment variables yourself and use the data. It's conceptually very easy. Both VCAP_APPLICATION & VCAP_SERVICES are environment variables and the value is a JSON blob so all you need to do is parse the JSON and locate the information that you need.
Hope that helps!
Is there, from an architectural point of view, a design pattern to migrate an existing web api component (realizing BL usign EJB integration with a backend component) into mobile first adapters (I think the java native type) in order to serve mobilefirst mobile apps?
EJB is not supported by MobileFirst Java adapters (and adapters in general)
However, if you consider to upgrade to MobileFirst 8.0, there is a simple way to use the Spring framework in Java adapters (see: https://mobilefirstplatform.ibmcloud.com/blog/2016/04/24/MobileFirst-spring-integration-in-java-adapters/)
In many cases, EJB application can be migrated to spring, depends on which EJB features are used in it.
according to this guide! I run servlet successfully, but some of actions of the servlet failed, because they need servlet-api 2.5+ support. how can I use my own servlet-api library instead of domino web server's old version.
thanks!
David Taieb (software architect at IBM) stated in a comment to a blog post:
In 8.5.2, Domino introduced support for Equinox Http Service which allows you to create lightweight servlets registered via extension points. I say lightweight because these servlets are not run within the context of a traditional J2EE Web App with web.xml support. However, the Equinox Http Service lets you associate an http context to different servlets so that they share the same http session object.
Starting in 8.5.3, Domino will start supporting the XPD Web Container which is a full fledged J2EE Web Container (although it does not support things like EJBs). With the XPD Web Container, you can transform almost any WAR into a WAB (Web Archive bundle) and run it in Domino.
You maybe also want to take a look at Servlet Sample at OpenNTF.
Otherwise, please state the version of Domino, you are currently using.
We have an old project written with EJB 2.1. Now we need to extend the project with the new requirements. But i don't want to use the old complicated EJB 2 again.
Is it possible to use EJB3.1/JPA in an existing project written with EJB 2.1.
P.S. Application Server is WebSphere
Yes, it is possible to reference EJB 3 from EJB 2. The older EJB applications can be deployed as is on EJB3.0 container since pre-EJB3.0 APIs are available in EJB3.0. Check these links out for detailed information:
http://www.coderanch.com/t/321218/EJB-JEE/java/EJB-call-EJB
https://community.jboss.org/wiki/ReferenceEJB3BeansFromEJB2Beans
A clean migration from EJB 2 to EJB 3 would be a better design choice though.
Using JDeveloper as my IDE, I have a web application which calls services provided by annotated EJB 3.0 beans packaged in third party jar. How do I configure the web application project to deploy the beans to the embedded OC4J container when I run the application?
The jar file is referenced by the project, and I have a META-INF/application.xml referencing those jar files as EJB modules. I've set the EJB Version property to 3.0, but the Annotated EJB 3.0 Bean Classes list remains empty, presumably because I have no beans defined in the sources of the web application I'm running. When running the project, the embedded oc4j container warns that the EJB module contains no beans. I'd like to deploy the beans in the jar file, but can't figure out how.
JDeveloper 10.1.3.4
Windows Vista
The answer came from an OTN Discussion Forum:
Re: Deploying third party EJB 3.0 jar in web application
Posted: Nov 2, 2009 8:15 AM in response to: user10375549
Hi,
We've used ejb-jar.xml to register EJB3 session beans from third-party jars in JDeveloer 11g TP4 (which was using oc4j). The only difference was that beside third-party beans we had our own session beans (which didn't need to be registered in ejb-jar.xml).
Here is how we did it
<session>
<display-name>MySessionBean</display-name>
<ejb-name>MySessionBean</ejb-name>
<remote>some.package.MySessionBeanRemote</remote>
<ejb-class>some.package.MySessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
I hope this helps you a bit.
Pedja