EJB Servlet Bridge
I've come across suggestions a couple of times to use a Servlet bridge to an
EJB. One such situation was invoking an EJB running in WebLogic 6.1 from an
application running in WebLogic 5.1. Other situations have been for applets
invoking EJB's.
Two questions. When should you implement a Servlet bridge rather than using
RMI over HTTP or some other method? Are there other situations where a
Servlet bridge would be useful?
In the case of applets, it seem like a Servlet bridge would be nice because
you wouldn't need to provide the EJB client classes to the applet. For
example the InitialContext class wasn't included in the standard edition
until 1.3.
Thanks,
Bob
Bob Lee <[email protected]> wrote:
I've come across suggestions a couple of times to use a Servlet bridge to an
EJB. One such situation was invoking an EJB running in WebLogic 6.1 from an
application running in WebLogic 5.1. Other situations have been for applets
invoking EJB's.
Two questions. When should you implement a Servlet bridge rather than using
RMI over HTTP or some other method? Are there other situations where a
Servlet bridge would be useful?
In the case of applets, it seem like a Servlet bridge would be nice because
you wouldn't need to provide the EJB client classes to the applet. For
example the InitialContext class wasn't included in the standard edition
until 1.3.You wouldn't need to provide WebLogic classes - you need several megabytes of them
on the client side in order to use T3.
Thanks,
Bob--
Dimitri
Similar Messages
-
Best way to call EJB - Servlet or Tag Library
Hi,
What is the best way to call an EJB from a JSP? We are using Weblogic 7.0(moving to 8.1 beta). WE have a form on a JSP that needs to get data from an EJB. Our flow goes from JSP --> Controller servlet or tag library -->EJB "Bean" Controller ---> EJB. The specfic EJB we need to populate drop downs and fields will be called by a bean controller. Is it better to call the bean controller using a tag library in the jsp or go to the controller servlet to get the data? If servlet is the answer, where do I lookup the EJB Home and call the create from within the servlet? Any help would be greatly appreciated!!
Thanks!IMO, if you are following some design patterns, like the MVC framework, the best thing is to populate the model(entities that contain the business data) and call the respective getXX methods from the model on the JSP page. The reason for doing so is to keep JSP pages away from any other work other than to just display the business data contained in the respective business entities.
The model can be populated in the servlet and either set in the request or session attribute as per the requirement.
The EJB can be looked up in the servlet as and when required. I would suggest to make use of the Service Locator Pattern to do a look up for the EJB Remote Interface and accordingly make the business calls.
Hopefully this answers some of your questions. -
How to debug with EJB+Servlet+J2ME at the same time?
I am setting up an environment to compile Sun's Smart Ticket J2ME application. However, it run with application exception in the servlet or EJB. I tried to debug. But if I debug the servlet with Embedded AS in JDeveloper, I cannot debug the EJB since the EJB cannot deployed to the embedded AS. (EJB and Servlet must be co-existed in the same AS, at least using same JNDI)
So is there any good approach to debug?
email: [email protected]Hi Marvin,
If the EJB cannot be deployed to the embedded AS, then you should probably use remote debugging to debug the servlet and EJB in the stand-alone AS.
Look in the Help for topics about remote debugging the OC4J application server. (I'd give you the exact topic title, but I'm at home for the holidays and I don't have the latest JDev on this machine.)
The Help topic describes it in more details, but the basic steps are as follows:
1. Launch the AS in debug mode by inserting some debugging options on the command line used to start up the AS.
If you are using OJVM, then the debugging options are
-XXdebug,port4000,detached
If you are using another JVM (for example HotSpot), then the debugging options are
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=4000,suspend=n
2. Set your project for remote debugging by checking the Remote Debugging checkbox on the Debugging - Remote panel of the Project Settings dialog. Also you should select the "Attach to OJVM" radio button if you are using OJVM or the "Attach to JPDA" radio button if you are using another JVM (for example HotSpot).
3. Click the debug button in JDev and enter the host and port where the AS is running (leave host blank if the AS is on the same machine as J[i]Long postings are being truncated to ~1 kB at this time. -
Ejb, servlets, & customer libraries
Hello,
I'm in the process of upgrading from 5.1 to 6.1 and having some
interesting issues regarding the various interdependent chunks of code.
In 5.1 I have most of my shared code under <server>/serverclasses, and
the servlet code under <server>/servletclasses. I've also got an EJB
that uses some of the code in the serverclasses directory, and its being
there seems to make it available at runtime to the EJB's classloader.
Meanwhile, in order to make the EJB's home interface available to the
servlet code at run time, the only solution I found was to include the
jar file in the classpath handed to the java runtime in the startup
shell script.
Now, in 6.1 things have changed somewhat and i'm frankly not sure what
the hell to do. I found someone had posted an article talking about
bundling things in a .ear file. Honestly, I didn't really get it. I
don't see why changing the extension on the jarfile is going to help at
all.
Anyway, this is my question: How can I make code available as a custom
library that is available to the servlet run time, and to my EJB
deployments?
Here's my other question: If the EJB code is only in the .jar ( or
whatever ) file that the EJB is packaged in, how exactly does the
servlet runtime know about the home interface? Just deploying the bean
doesn't seem to do the trick. Honestly, this seems like a pretty big
design flaw in the EJB spec to me.
thanks
noahYou may find these 2 articles helpful:
http://www.onjava.com/pub/a/onjava/2001/06/26/ejb.html
http://www.onjava.com/pub/a/onjava/2001/07/25/ejb.html
Noah Couture <[email protected]> wrote:
Hello,
I'm in the process of upgrading from 5.1 to 6.1 and having some
interesting issues regarding the various interdependent chunks of code.
In 5.1 I have most of my shared code under <server>/serverclasses, and
the servlet code under <server>/servletclasses. I've also got an EJB
that uses some of the code in the serverclasses directory, and its being
there seems to make it available at runtime to the EJB's classloader.
Meanwhile, in order to make the EJB's home interface available to the
servlet code at run time, the only solution I found was to include the
jar file in the classpath handed to the java runtime in the startup
shell script.
Now, in 6.1 things have changed somewhat and i'm frankly not sure what
the hell to do. I found someone had posted an article talking about
bundling things in a .ear file. Honestly, I didn't really get it. I
don't see why changing the extension on the jarfile is going to help at
all.
Anyway, this is my question: How can I make code available as a custom
library that is available to the servlet run time, and to my EJB
deployments?
Here's my other question: If the EJB code is only in the .jar ( or
whatever ) file that the EJB is packaged in, how exactly does the
servlet runtime know about the home interface? Just deploying the bean
doesn't seem to do the trick. Honestly, this seems like a pretty big
design flaw in the EJB spec to me.
thanks
noah--
Dimitri -
Best IDE to develop EJB/Servlet development with WebLogic
Hi,
I am prepearing a recommendation for our company's standard Java development
environment. I would appriciate any comment you guys might have on the best
IDE that supports J2EE and EJB and Servlet development that integrates with
WebLogic. I guess the best are Visual Age or Visual Cafe, anybody have any
experince/comment on any of those ?
Thanks
FarhangI would recommend the products coming from Webgain. They offer the product
suite surrounding visual cafe.
Thanks,
Michael
Michael Girdley
Product Manager, WebLogic Server & Express
BEA Systems Inc
Farhang Kassaei <[email protected]> wrote in message
news:8fs706$643$[email protected]..
Hi,
I am prepearing a recommendation for our company's standard Javadevelopment
environment. I would appriciate any comment you guys might have on thebest
IDE that supports J2EE and EJB and Servlet development that integrateswith
WebLogic. I guess the best are Visual Age or Visual Cafe, anybody have any
experince/comment on any of those ?
Thanks
Farhang -
i am using orion.
i have an ejb app running.. i can connect to it from an external client.
however, as soon as i turn the client into another ejb app that is just a servlet, i get ClassCastException when getting the remote interface.
any ideas?i think it's due to the fact that your Home is not only in the classpath of the container but in the classpath of the servlet engine too. so when you're trying to get the home, a ClassCastException is thrown bcz the home you got has not the same version as the home in servlet engine (uid).
hope it helps. -
Hallo everybody,
i try to develop an application with servlet jsp and ejbs but i don't have enough information about this thema.
for example i want to make a simple login szenario :
user type the name and passwd and the system contact with the db and show a wellcome page if the login is succesfull and an error page if the login is unsuccessfull.
which component does was??
the first page can be a html form and post the name and passwd to a servlet.
in this case servlet can make a connection with the DB and can forward the user to next page or error page. BUT where should i use EJB? can i realize the db connection with ejb ? if yes how can interact the servlet with the ejb and how can i store the information (for example address of user) which i have taken from the DB?
thanks a lotThanks for the antwort
this means that the servlet connected to DB and execute the sql to authenticate user??
and the second part is my bigger problem :)
what does it mean "it will pass the control
to the enterprise java bean which will be housing the business logic for your application."
what does a java bean really do? how can i find information about them?
and is ther an example in which i can see how servlets, jsps and beans interact??
thanks -
EJB, Servlet, JSP help
I have built a small application which creates/maintains company divisions following the MVC design pattern.
I now want to move the methods which create,update, add objects out of the controller possibly into the Model servlet. This I hope would allow other parts of the application (not yet built) to manipulate division objects and not have to do this through the Contrroller which is used to call the JSP and present data.
I am wondering whether I should do this, or whether i should just move straight to Entity Java Beans, which I believe handle all interfaces with the database.
If you reckon this is the correct way forward can you tell me where I can see a good example i.e. has EJB which handle all dtabase communication and can talk to the controller servlet and the jsp.Hi,
We cover these issues in our book Core J2EE Patterns and also include some basic refactorings for J2EE, including moving from a non-EJB to EJB environment in phases.
Good luck,
Dan
I have built a small application which
creates/maintains company divisions following the MVC
design pattern.
I now want to move the methods which create,update,
add objects out of the controller possibly into the
Model servlet. This I hope would allow other parts of
the application (not yet built) to manipulate division
objects and not have to do this through the
Contrroller which is used to call the JSP and present
data.
I am wondering whether I should do this, or whether i
should just move straight to Entity Java Beans, which
I believe handle all interfaces with the database.
If you reckon this is the correct way forward can you
tell me where I can see a good example i.e. has EJB
which handle all dtabase communication and can talk to
the controller servlet and the jsp. -
EJB & Servlet deployment in Clustered Env.
Hi,
I have made a cluster of 3 weblogic servers. I would like to send a request to one
server (e.g. http://myserver1:7001/TestServlet). The servlet utilizes an EJB which
is not located and not deployed on myserver1 , but on other 2 servers in the cluster.
The algorithm is round-robin. It gives me a lot of errors (Impl... classes not found
etc etc).
Do I have to deploy everything on all the servers?
If I do that, the request is not routed to other servers. Since the servlet finds
the EJB locally, it never goes to the other servers, regardless of the algorithm.
I have set up the "home-is-clusterable" and all other relevant properties for EJB
deployment.
Any ideas??
Sharad
If the ejb is deployed on the server that is looking for the ejb, then it
won't go network to use the ejb. That is a "big" WL optimization, and helps
quite a bit for most apps.
If you want to segregate the ejb and web functionality, you should probably
consider running two distinct clusters (in 5.1 parlance).
I suggest putting web and ejb together though and clustering that. Latency
is lower. Scalability is not particularly affected. Configuration is much
simpler.
Peace,
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com
+1.617.623.5782
WebLogic Consulting Available
"Sharad Joshi" <[email protected]> wrote in message
news:[email protected]...
>
> Hi,
>
> I have made a cluster of 3 weblogic servers. I would like to send a
request to one
> server (e.g. http://myserver1:7001/TestServlet). The servlet utilizes an
EJB which
> is not located and not deployed on myserver1 , but on other 2 servers in
the cluster.
> The algorithm is round-robin. It gives me a lot of errors (Impl... classes
not found
> etc etc).
>
> Do I have to deploy everything on all the servers?
> If I do that, the request is not routed to other servers. Since the
servlet finds
> the EJB locally, it never goes to the other servers, regardless of the
algorithm.
> I have set up the "home-is-clusterable" and all other relevant properties
for EJB
> deployment.
>
> Any ideas??
>
> Sharad
-
hi
i search for a servlet php bridge.
I want to start php skript from a servlet and I should work with a servlet php bridge.
So i don t want to start the php skript with a java code from a servlet.
I want to connect the bridge, with api functionality, to start the php skript.
I think there is a bridge. But i don t find any think about it.
Does anybody knows something about this bridge.
So sorry for my english. I hope you understand, what i want.
ThanksI thanks for reply.
I found someting about a bridge.
It the protocl jsr 223.
Jsr223 provides a bridge between php und servlets on a tomcat.
But you can only start php sides and no methodes in php sides.
Here is a code :
ublic class HelloWorld {
public static void main(String[] args) throws Exception {
//Initiate ScriptEngineManager
ScriptEngineManager manager = new ScriptEngineManager();
//Return script engine by name
ScriptEngine myEngine = manager.getEngineByName("php");
//Execute the HelloWorld script
myEngine.eval(new FileReader("./HelloWorld.php"));
}But i found nothing about, that you can start methodes like :
myEnginge.....(helloWolrd.php)
execute.writeHelloWorld();
<php
class HelloWorld {
writeHelloWorld() {
echo "hello World"
?> so i do not find anything about more. I think you can only start the php side.
But you can not start any methods in the php skript.
I thought, a bridge should have more functionality :-)
Does anybody has more infos or links about this issue ? with examples ?
Thanks -
Web service / XML-RPC: SMTP inbound to OC4J/BC4J XML servlet bridge??
A new business problem just landed on my desk for a possible solution.
One way XML documents coming in from a Novel mail server doing SMTP forward to something
in the OC4J, BC4J, side to receive and parse the XML.
It would be great of course if the JDev / BC4J / OC4J web services tools had a SMTP service
that would route inbound SMTP messages at email address to a particular Servlet.post().
Any other ideas??
Thanks much,
curtFor others, here is a start of a response to Curtis's message talking about the BC4J Web services features combined with the BC4J readXML and writeXML capabilities:
Re: Can we find when was a table dropped?
Not sure if other folks have a solution to dealing with the SMTP part - a snippet of code that works with readXML and writeXML methods of BC4J, for example.
Mike. -
Web Service/XML-RPC: SMTP inbound to BC4J Xml Servlet bridge idea??
A new business problem just landed on my desk for a possible solution.
One way XML documents coming in from a Novel mail server doing SMTP forward to something
in the OC4J, BC4J, side to receive and parse the XML.
It would be great of course if the JDev / OC4J web services tools had a SMTP service
that would route inbound SMTP messages at email address to a particular Servlet.post().
Any other ideas??
Thanks much,
curtFor others, here is a start of a response to Curtis's message talking about the BC4J Web services features combined with the BC4J readXML and writeXML capabilities:
Re: Can we find when was a table dropped?
Not sure if other folks have a solution to dealing with the SMTP part - a snippet of code that works with readXML and writeXML methods of BC4J, for example.
Mike. -
Servlet jndi lookup to remote EJB, servlet and EJB not in the same application
Hi,
I think that the subject explain my problem.
I have Oracle IAS9i 9.0.2.0.0, and JDeveloper 9.0.2.829
I have deployed and EJB in IAS9i and i want to use from the developer machines, which have JDeveloper.
how can i to do remote calls from JDeveloper?.
I have modifed the orion-application.xml, and added remote=true.
I have modifed the rmi.xml and added the hosts where the Jdeveloper placed.
Any ideas?
Thanks and cheers
P.D The app server and jdeveloper are in the same net.
if it is posible replys me to [email protected] too.Steps to access a remote EJB from within OC4J
++++++++++++++++++++++++++++++++++++++++++++++
1) Deploy EJB application (ApplicationRemote) to remote container (REMOTE)
"java -jar admin.jar -deploy ormi://REMOTE.hostname:REMOTE.port REMOTE.username REMOTE.password -deploy -file ApplicationRemote.ear
-deploymentName ApplicationRemote"
2) Ensure that local application (ApplicationLocal) has ejb-ref tags for remote EJBs accessed (in web.xml or ejb-jar.xml)
3) Deploy to local container (LOCAL) an empty application (ApplicationEmpty) with the same name as the remote application (ApplicationRemote)
"java -jar admin.jar -deploy ormi://LOCAL.hostname:LOCAL.port LOCAL.username LOCAL.password -deploy -file ApplicationEmpty.ear -deploymentName
ApplicationRemote"
5) Deploy local application (ApplicationLocal) to local container (LOCAL)
"java -jar admin.jar -deploy ormi://LOCAL.hostname:LOCAL.port LOCAL.username LOCAL.password -deploy -file ApplicationLocal.ear -deploymentName
ApplicationLocal"
4)Restart local container
ApplicationEmpty should consist of just an application.xml file - no modules. The same file can be deployed with different application names for all the remote
applications that must be accessed.
ApplicationLocal should access the remote EJB by using the following JNDI properties
java.naming.factory.initial = "com.evermind.server.rmi.RMIInitialContextFactory"
java.naming.provider.url = "ormi://REMOTE.hostname:REMOTE.port/ApplicationRemote"
java.naming.security.principal = "REMOTE.username"
java.naming.security.credentials = "REMOTE.password"
regards
Debu Panda -
JNDI tree access for code outside servlets and EJBs and JSPs
Can code outside EJBs, Servlets and JSPs have access to the JNDI tree?
For example, in a web application, web.xml has a env-entry declaration which I want to access from a POJO which is called by a JSP in the web app. Is this permissible?Can code outside EJBs, Servlets and JSPs have access
to the JNDI tree?
For example, in a web application, web.xml has a
env-entry declaration which I want to access from a
POJO which is called by a JSP in the web app. Is
this permissible?Yes. Read the JNDI tutorial. -
Hi,
I don't know if this is an appropriate question to ask for this class as it's not
workshop
specific. I was wondering how will I decide when it is appropriate to use a web
service as opposed to say servlet or an EJB for my application? What is a good
rationale to use?
Thanks,
SadhanaHi Adam,
Thanks a lot for giving such a lucid explanation of my vague question!
I understand now the difference between when to use EJBs/Servlets/Web Services.
Thanks again!
Sadhana
"Adam FitzGerald" <[email protected]> wrote:
>
Hi Sadhana,
Web service versus Servlet versus EJB. Which one to use? That is a very
good question.
EJBs should be the core desription and processing of your business rules.
They generally
have good performance, are easy to integrate into your security set up but
they require
access using the RMI-IIOP protocol. This means that generally EJBs are not
accessible
outside of your firewall and their clients have to be written in Java (other
enterprise
objects or applets or GUI applications).
Servlets often form a web-based front end to EJBs. They also have good performance,
integrate into security and only require HTTP access. This means they are
accessible
outside your firewall and any client with a HTTP or web API can call on
them, however,
there is no standard contract or rules for this type of interaction so you
will need
provide direct input into development of the client.
Web services are also accessible via HTTP and so can be accessed from outside
your
firewall. In fact, Web services internally within Workshop and WebLogic
actually
operate by using servlets and EJBs but the main advantage is that the mechanism/contract
for interacting with the web service is a well defined standard (WSDL) and
can actually
be registered or retreived dynamically (UDDI). Since web service standards
are open,
most popular programming languages already provide client APIs to interact
with them
thus freeing the web service developer from direct interaction with the
client developer
and letting the client be developed on any platform. The penalty for this
openness
is a small performance hit (XML translation) and a slowly maturing security
model.
So in summary, use EJBs for business operations that have Java clients within
your
enterprise, use servlets to provide web style access to your business operations
(like web pages) and use web services to enable automated clients that can
be written
on any platform either inside or outside your enterprise (firewall). In
fact, it
is common to write the EJB first and then to expose some parts of it outside
of your
enterprise by writing a web service wrapper (maybe using the EJB controls
that we
saw in class).
I hope this helps.
Adam
"Sadhana Jain" <[email protected]> wrote:
Hi,
I don't know if this is an appropriate question to ask for this class as
it's not
workshop
specific. I was wondering how will I decide when it is appropriate to use
a web
service as opposed to say servlet or an EJB for my application? What is
a good
rationale to use?
Thanks,
Sadhana
Maybe you are looking for
-
Values are not populated to backing session bean from editable table!
I have a table which has drop down list and checkbox columns. I binded table row group to an object list and binded selected properties of these columns to corresponding fields of object (#{currentRow.value['selected']}). However selected properties
-
Nudging audio in very small increments
Hello, First, full disclosure, total n00b to video editing in general. I've done a lot of audio mixing and edit over the years. In some ways I'm getting ahead of myself on this particular little project, I have not (yet) put in the time I should in
-
Can someone take the eyes of one photo and move it to the other? . we took family photos and his eyes are all squinting except in 1 photo and my wife wants those eyes on the a different picture. please email me at Dunworth.m Gmail and i will send you
-
How to replace original submit_mc?
Hello I have an FLA file which came with an online tutorial on how to send emails from Flash MX 2004. I wish to incorporate it into my own site and have done most of the work which this involves. However, the original came with a huge, ugly 'Submit'
-
BI Deshboard are not connected
hi guys, i have installed BI EE for the first time but my BI Schedular service is not yet been started.I have followed all the 8 stpes and chages the .xml files. Is there any way that my Dashboards are connect without starting the BI Schedular serive