Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
JSP - A mailing list about Java Server Pages specification and reference
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Connecting applet with ejb ?

Connecting applet with ejb ?

2004-12-21       - By Partha Ranjan Das

 Back
Reply:     1     2     3     4     5  

Hi,

If you need to connect to an EJB from an applet you need to manually create the
InitialContext instance usign a code like below:
Properties p = new Properties();

p.put(Context.PROVIDER_URL, "<your_url>");

p.put(Context.INITIAL_CONTEXT_FACTORY, "<your _factory_details>");

context = new InitialContext(p);

(See the details of your EJB tier spec for these strings.)

And then use this context to call the lookup() method for getting the ejb home.

But in this way you need to communicate to the EJB using RMI in which case you
may have problem with your firewall or similar set-ups. Even the HTTP
tunnelling makes certain areas vulnerable to security risks. So I propose you
put either a servlet between your applet and ejb or expose the ejb methods
through webservices.

Regards,

Partha

-- --Original Message-- --
From: A mailing list for Java(tm) 2 Platform, Enterprise Edition [mailto:J2EE
-INTEREST@(protected)]On Behalf Of Dudi Gil
Sent: Tuesday, December 21, 2004 10:09 AM
To: J2EE-INTEREST@(protected)
Subject: Connecting applet with ejb ?


Hellow,

Can anyone show me an example of how to connect applet with ejb ?
All the JNDI procedure in particular ?
If someone can show me an example of how to to it, I'll be very grateful.

THankd
David
=========================================================================== To
unsubscribe, send email to listserv@(protected) and include in the body of the
message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected)
.sun.com and include in the body of the message "help".




===========================================================================
To unsubscribe, send email to listserv@(protected) and include in the body
of the message "signoff J2EE-INTEREST".  For general help, send email to
listserv@(protected) and include in the body of the message "help".


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1255 (See http://ows-1255.ora-code.com)">


<META content="MSHTML 5.00.3700.6699" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=683285704-21122004>Hi,</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=683285704-21122004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=683285704-21122004>If
you
need to connect to an EJB from an applet you need to manually create the
InitialContext instance usign a code like below:</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff><SPAN class=683285704-21122004><FONT face=Arial><FONT
color=#000000><FONT size=2>
<P>Properties</FONT> <FONT color=#000000>p</FONT> <FONT
color=#000000>=</FONT>&nbsp;<FONT color=#000000><SPAN
class=683285704-21122004>new </SPAN>Properties();</FONT></FONT></P></FONT>
<P><FONT face=Arial><FONT size=2><FONT color=#000000><SPAN
class=683285704-21122004>p</SPAN>.put(Context.PROVIDER_URL,</FONT>&nbsp;<FONT
color=#000000><SPAN
class=683285704-21122004>"&lt;your_url&gt;"</SPAN>);</FONT></FONT></P></FONT>
<P><FONT size=2><FONT face=Arial><FONT
color=#000000>p.put(Context.INITIAL_CONTEXT_FACTORY,</FONT> <FONT
color=#000000><FONT color=#000000><SPAN class=683285704-21122004>"&lt;your
_factory_details&gt;"</SPAN></FONT>);</P></FONT></FONT></FONT>
<P><FONT size=2><FONT face=Arial><FONT color=#000000>context</FONT> <FONT
color=#000000>=</FONT>&nbsp;<FONT color=#000000><SPAN
class=683285704-21122004>new</SPAN></FONT> <FONT
color=#000000>InitialContext(p);</FONT></FONT></FONT></P>
<P><FONT color=#000000 face=Arial size=2><SPAN class=683285704-21122004>(See
the
details of your EJB tier spec for these strings.)</SPAN></FONT></P>
<P><FONT color=#000000 face=Arial size=2><SPAN class=683285704-21122004>And
then
use this context to call the lookup() method for getting the ejb
home.</SPAN></FONT></P>
<P><FONT color=#000000 face=Arial size=2><SPAN class=683285704-21122004>But in
this way you need to communicate to the EJB using RMI in which case you may
have
problem with your firewall or similar set-ups. Even the HTTP tunnelling
makes&nbsp;certain areas vulnerable to security risks. So I propose you put
either a servlet between your applet and ejb or expose the ejb methods through
webservices.</SPAN></FONT></P>
<P><FONT color=#000000 face=Arial size=2><SPAN
class=683285704-21122004>Regards,</SPAN></FONT></P>
<P><FONT color=#000000 face=Arial size=2><SPAN
class=683285704-21122004>Partha</SPAN></FONT></P></SPAN></FONT></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
 <DIV align=left class=OutlookMessageHeader dir=ltr><FONT face=Tahoma
 size=2>-- --Original Message-- --<BR><B>From:</B> A mailing list for Java(tm)
 2 Platform, Enterprise Edition [mailto:J2EE-INTEREST@(protected)]<B>On
Behalf
 Of </B>Dudi Gil<BR><B>Sent:</B> Tuesday, December 21, 2004 10:09
 AM<BR><B>To:</B> J2EE-INTEREST@(protected)<BR><B>Subject:</B> Connecting
 applet with ejb ?<BR><BR></DIV></FONT>
 <DIV><FONT face=Arial size=2>Hellow,</FONT></DIV>
 <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
 <DIV><FONT face=Arial size=2>Can anyone show me an example of how to connect
 applet with ejb ?</FONT></DIV>
 <DIV><FONT face=Arial size=2>All the JNDI procedure in particular
 ?</FONT></DIV>
 <DIV><FONT face=Arial size=2>If someone can show me an example of how to to
 it, I'll be very grateful.</FONT></DIV>
 <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
 <DIV><FONT face=Arial size=2>THankd</FONT></DIV>
 <DIV><FONT face=Arial
 size=2>David</FONT>&nbsp;</DIV>==============================================
=============================
 To unsubscribe, send email to listserv@(protected) and include in the body
of
 the message "signoff J2EE-INTEREST". For general help, send email to
 listserv@(protected) and include in the body of the message "help".
 <P></P></BLOCKQUOTE></BODY></HTML>
===========================================================================
To unsubscribe, send email to listserv@(protected) and include in the body
of the message "signoff J2EE-INTEREST".  For general help, send email to
listserv@(protected) and include in the body of the message "help".
<p>

©2008 junlu.com - Jax Systems, LLC, U.S.A.