Deploying annotated EJB 3.0 beans from third party jar to JDeveloper embedded oc4j container - jar

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

Related

Spring Boot jar into existing Spring Project

We have an existing Spring MVC based application. I was asked to plug-in a customization/utility to this project. I am not supposed to do any changes to the existing application.
For the new utility, I thought of doing it through a Spring boot jar. I created a Spring boot jar and placed in the lib folder of the existing application. However, I am facing few issues with this approach and wanted to know if this is the correct approach and if there are any suggestions out there. The issues are:
The logging level of the Spring boot affects the logging level of the existing application. How can I avoid that?
The Spring MVC application and the Spring boot jar both are based on different versions of Spring. What if there are some common class files or packages in both Spring MVC application and the Spring boot jar but with different versions? Will this create any conflicts or will it affect the functionality? I don't want my Spring boot jar to affect the functionality/logging of the existing application. I just want the Spring boot jar to work whenever it is being called explicitly.
For logging issue, I have tried to use something like below in application.properties file but the issue with that is that those settings are considered only if you run the application through #SpringBootApplication main class. But if you just want to package your functionality in a jar file then the application.properties file is not considered.
logging.level.org.springframework = OFF

Is webapp folder required in projects configured using java-config

Typical Spring MVC Application structure as follows:
src/main/java
src/main/resources
src/main/webapp
src/test/java
webapp contains the web-inf folder and configuration files such as web.xml, dispatcher-servlet.xml.
Servlet 3.0 replaces xml configurations with java config. For example, instead web.xml, configuration can be done using java class extending AbstractAnnotationConfigDispatcherServletInitializer.
If there is no html/js content needed and it is meant to be used as only a Restful service, do we need the webapp folder ?
Yes , You can remove the webapps folder from your project still your project will works fine.
If you want to develop restful application you can use apache cxf or jersey framework.

servlet-listener and MIME type support for equinox

I have embedded equinox framework in tomcat 7.x using bridge.war and steps given at
http://www.eclipse.org/equinox/server/http_in_container.php
I have developed an osgi bundle which contains servlet registration code and as expected this servlet runs over the bridge.
My goal is to support servlet apis and web.xml functionality in this osgi bundle so that I can port an existing web application in osgi.
For now,I am using "org.eclipse.equinox.http.servlet.ExtendedHttpService" to register servlet filters and servlets.
However,ExtendedHttpService does not have a method to register a servlet-listener.
Can anyone suggest me how can I support/register servlet listeners and MIME types in an osgi bundle which contains my servlet registration code.

Is it possible to use EJB2.1 and EJB 3.1 in the same project

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.

EE6 web profile ... no EJB container?

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.

Resources