How to connect EJB by JSP??

I kowm,EJB1.1 hadn't been connect by JSP.Now,How to connect EJB2.0 by jsp.
EJB'container/server is woblogic.Thanks for your replaying!!

Hi,everyone,I hava found out its anwsers.
The method :
Now,if we hava writted a EJB,using IAS for conainer/server.
JNDI named "happy".
CODE:
<%@page import="javax.naming.*;"%> //jndi
<%@page import="javax.rmi.PortabieRemoteObject;"%>
//rmi
<%page import="happy.*;%>
//EJB's home/remoteInterface
<%
InitialContext ctx=new InitialConrect();
//Init
Object ref=ctx.lookup("Happy");
//using JNDI,you get Object'sinterface
HappyHome hoppyhome;
happyhome=(SampleHome)PortableRemoteObject.narrow(ref.HappyHome.class);
HappyRemote remote=happyremote.creat();
//forllowing,you can use EJB's method by remote calling.
%>
WELCOME FOR YOUE ADVISE!!!

Similar Messages

  • How to use EJB in JSP...urgent!!!

    hello,
    i am novice programmer in EJB.
    i am using weblogic 6.1 ...
    my problem is how to use EJB in jsp page.
    my code is as follow..but its not displaying any result.
    <%@ page import="javax.naming.InitialContext,
    javax.naming.Context,
    java.util.Properties,
    firstEJB.First,
    firstEJB.FirstHome"%>
    <%
         long t1 = System.currentTimeMillis();
         System.out.println(t1);
         Properties props = new Properties();
         p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.TengahInitialContextFactory");
         props.put(Context.PROVIDER_URL, "localhost:7001");
         Context ctx = new InitialContext(props);
         FirstHome home = (FirstHome)ctx.lookup("FirstEJB");
         First bean = home.create();
         String time = bean.getTime();
         bean.remove();
         ctx.close();
         long t2 = System.currentTimeMillis();
    %>
    <html>
         <head>
              <style>p { font-family:Verdana;font-size:12px; }</style>
         </head>
         <body>
              <p>Message received from bean = "<%= time %>".<br>Time taken :
              <%= (t2 - t1) %> ms.</p>
         </body>
    </html>
    please tell me the solution.

    Hi, I don't know if it may be the cuase of your problems, but you should narrow the Object obtained doing the lookup, like this:
    FirstHome home = (FirstHome) PortableRemoteObject.narrow(ctx.lookup("FirstEJB"), FirstHome.class);

  • How To Use EJB in JSP

    I've used beans in JSP.. but how to use EJB's in beans ??
    EJB's are deployed in Oracle 8i
    Please Help
    Thank You.

    Please find the answer in this HOWTO:
    http://technet.oracle.com:89/ubb/Forum2/HTML/006404.html
    HOWTO's are archived on the JDeveloper Documentation page:
    http://technet.oracle.com/docs/products/jdev/listing.htm (Click on Documentation Tab)
    Thanks,
    -Roel.

  • How to understand EJB and JSP

    just now i read some articles about EJB and it make me a little confused in what i have understood about EJB and JSP ( at least i thought i understood them, but now ....()
    1. i found that in most JSP examples, the javabeans are used but not the EJB, right? so i have a qustion, an EJB can be used in JSP or not? and how if it can? why if it can not?
    ...still have a lot of question ....
    thanks a lot

    Hi,
    1. i found that in most JSP examples, the javabeans
    are used but not the EJB, right? so i have a qustion,
    an EJB can be used in JSP or not? and how if it can?
    why if it can not?It can be there for more of the examples,but you can invoke the EJB from the JSP also .Actual EJB is entirely the different concept whose foundation is build on the Distributed Technology.I advice you to read the Mastering EJB which is freely available at http://theserverside.com
    before starting coding.The EJB is a vast concept and requires time and strong core foundation to understand,once it is clear then you understand it true potential...
    ...still have a lot of question ....You queries are welcome here!!!
    regards
    Vicky

  • How to connect Oracle with Jsp?

    Hi,
    I am student and I am trying to use Jsp to connect oracle. Do you have any sample to show how to do it?
    Thanks a lot.
    Amy

    In JSP, you connect to the Oracle in a same way as you would do it in any Java application, using JDBC. Please refer to Java Tutorial -> JDBC on sun site and you will get easy and straight forward concepts.

  • How to connect MySQL in JSP?

    I applied a JSP web hosting, but cannot connect the MySQL server.
    Error message is:
    java.sql.SQLException: Server configuration denies access to data source
    My code is correct, because I have used the similar code to connect some other MySQL server.
    Can anyone help?

    you may also want to check the username, password and database you are connection to

  • Newbie-how to use EJB in JSP?

    Can some one please point me to any sources, tutorials, examples on using
              enterprise javabeans in JSP?
              How can I use an entity bean home interface or findByprimaryKey methods in
              JSP?
              Thanks in advance.
              

    look at /examples/jsp/EJBeanManagedClient.jsp in your WLS distribution.
              Kumar
              Manmari wrote:
              > Can some one please point me to any sources, tutorials, examples on using
              > enterprise javabeans in JSP?
              > How can I use an entity bean home interface or findByprimaryKey methods in
              > JSP?
              >
              > Thanks in advance.
              

  • How to run EJB with JSP as client on TOMCAT - JBOSS server

    Hi all,
    I am having my EJB component successfully deployed on JBOSS server. My core-java client is able to access the same. But when I use the JSP page which is on Tomcat server, I am getting following exception. Please help me out.
    Exception Report:
    org.apache.jasper.JasperException: sealing violation
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.load(JspServlet.java:125)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:161)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:171)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:328)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:407)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:251)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:196)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2041)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
         at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:414)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:159)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:818)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:897)
         at java.lang.Thread.run(Thread.java:484)
    Root Cause:
    java.lang.SecurityException: sealing violation
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:234)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at org.apache.catalina.loader.StandardClassLoader.findClass(StandardClassLoader.java:648)
         at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:987)
         at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:906)
         at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:136)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
         at java.lang.Class.newInstance0(Native Method)
         at java.lang.Class.newInstance(Class.java:237)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.load(JspServlet.java:123)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:161)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:171)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:328)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:407)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:251)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:196)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2041)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
         at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:414)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:975)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:159)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:818)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:897)
         at java.lang.Thread.run(Thread.java:484)
    Please let me know what the problem is as I am new to EJB.
    Thanx a lot
    Unmesh

    Hi
    Even i have the same problem...
    i have deployed the ejb in jboss..
    but i cannot even run the core-java client program
    can u pls mail me the code...
    and the directory path
    thanks a lot
    cheers
    simreen

  • How to connect JSP with MySql Database?

    HI All...
    I want to know or How to connect Mysql with JSP or JSF any other software is available? please help me.....

    I want to know or How to connect Mysql
    with JSP or JSF any other software isavailable?
    please help me.....First you need to find 25 m of a CatV cable and...The DB files need to be located on the ninth device of a SCSI Daisy Chain with the total SCSI cable length being over 150 m (and the devices (and cables) need to be mix of Differential and Non-Differential).
    Edit: And forget the terminator, who needs it?

  • How to connect particular BAPIs to  jsp page

    HI ALL,
    I NEED HOW TO CONNECT BAPI TO JSP? I NEED EXAMPLE PROGRAM.
    ALREADY ONE TASK IS COMPLETED IN WEBDYNPRO...MY AIM IS CONVERT INTO FULLY JSP PAGE....PLEASE FIND THE SOLUTION..

    HI ALL,
         Please anyone tell how to connect bapi to pure jsp page in NDS...
       and how to run pure jsp page in NDS...

  • How to connect portal with msaccess database

    we have to develop oracle portal applications with msaccess as a back end.how to connect portal to access.
    thanks in anticipation.

    I want to know or How to connect Mysql
    with JSP or JSF any other software isavailable?
    please help me.....First you need to find 25 m of a CatV cable and...The DB files need to be located on the ninth device of a SCSI Daisy Chain with the total SCSI cable length being over 150 m (and the devices (and cables) need to be mix of Differential and Non-Differential).
    Edit: And forget the terminator, who needs it?

  • How to run ejb application OC4J J2EE Container

    Hi all,
    I unable run ejb applications in OC4J J2EE Container.
    I have configure following files.
    in config directory
    Server.xml
    I have .ear file if configured in server.xml. this .ear copied into home/application directory
    I have create following deployment discriptor file.
    in META-INF for ejb.
    ejb-jar.xml
    application.xml
    I have specify all ejb classes details in ejb-jar.xml
    Please help me .How to run ejbs with jsp and application client.Which files shall i configure.
    Thnaks,

    Hi all,
    I unable run ejb applications in OC4J J2EE Container.
    I have configure following files.
    in config directory
    Server.xml
    I have .ear file if configured in server.xml. this .ear copied into home/application directory
    I have create following deployment discriptor file.
    in META-INF for ejb.
    ejb-jar.xml
    application.xml
    I have specify all ejb classes details in ejb-jar.xml
    Please help me .How to run ejbs with jsp and application client.Which files shall i configure.
    Thnaks,

  • Re: Accessing EJB through JSP

              Can anyone guide me to a tuorial thru which I can learn how to invoke EJBs thru
              JSP pages.
              Thanks..Kevin
              

    EJB to JSP Integration
              http://edocs.bea.com/wls/docs61/jsp/ejb2jsp.html
              Kevin wrote:
              > Can anyone guide me to a tuorial thru which I can learn how to invoke EJBs thru
              > JSP pages.
              >
              > Thanks..Kevin
              

  • How to connect to database in JSP

    Hi, all.
    I am using J2EE and cloudscape. I have written all the EJB classes. But now i have no idea that how to connect to database in jsp such as i get user ID from portal, then i connect to database check the existence of user ID and the password then return true or false value. how to write all this in jsp?
    Thanks very much!
    yayun

    this is the required code
    i hope this will help u
    <html>
    <head>
    </head>
    <body>
    <%@ page import="java.sql.*" %>
    <%
    try
    String fu=request.getParameter("username");
    String fp=request.getParameter("password");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection Con=DriverManager.getConnection("jdbc:odbc:wind","","");
    Statement stmt=Con.createStatement();
    ResultSet rs=stmt.executeQuery("select * from table1 where username='"+fu+"' and password='"+fp+"'");
    if(rs.next())
    %>
    <jsp:forward page="success.jsp"/>
    <%
    else{
    %>
    <jsp:forward page="unsuccess.jsp"/>
    <%
    catch(Exception e)
    %>
    </body>
    </html>

  • How to connect MySql database with JSP

    Dear everyone,
    how to connect MySql database with JSP......

    It's too bad that nobody has ever asked this question before...

Maybe you are looking for