Calling JBean from Servlet

Have a java bea located at \web-inf\classes\mybeans called UserData.java
And would like to call it from my servlet to pass data located at \web-inf\classesHow would I do that?

If your using webLogic server, then the below link may help you.
http://edocs.bea.com/workshop/docs81/doc/en/core/index.html

Similar Messages

  • Calling class from servlet gives 500

    I have a servlet that works fine by itself, and another class that works fine by itself. However, when I try to create a new instance of the class using the servlet and access a method in the class such as:
    Servlet code
    Object a = new Object()
    a.method
    the server returns 500.
    Is there some security aspect to calling classes from servlets that may be causing this?

    Thanks for the replies which have tracked the problem down.
    The Server log says:
    NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
    This class is needed by the class being called by the servlet.
    The missing class is in a jar file which is put on the classpath when running the class in a standalone environment. I don't know if it's possible to put this jar on the classpath in the Server environment.
    However a solution is to explode the jar file and put the exploded classes in the WEB-INF/classes of the Server. The only disadvantage is that they get wiped out every time I re-deploy the application war file.

  • How to call JSp from Servlet??

    Hello,
    I want to call JSP page from servlet.I am using Visual Age For java 3.4. What is wrong in my code??
    if (userExists) {
    f.setErrors("userName","Duplicate User: Try a different username");
    getServletConfig().getServletContext().
    getRequestDispatcher("/jsp/forms/retry.jsp").
    forward(request, response);
    I am not able to get the o/p. Pls help.

    I can't see anything obvious, but did you take any steps towards doing output before this code (like openning an output stream)?
    Not clear what f.setErrors does - presumably stuffs the error message in an attribute of the request.

  • Calling method from servlet

    hi,
    I want to call a method of an object that is available in a program already running, with parameters passed from the servlet.
    How to do it .
    Thanks.

    Pls be patient with me. I tried my best and couldn't achieve what I want.
    I provide the skeleton of what I have done and what I want to do.
    I have my core part in /home/raja/Service/Core.java, the only java file in Service folder. When I compile it I get some four class files(which are used in Core.java file internally). I don't compile it as a package but as a single file.
    I run the program in the same folder and in main method I use an infinite loop to keep the program running infinitely.
    And I have a html as, usr/local/jakartaTomcat../webapps/servlets-examples/input.html. which simply gets an input string and submits to /servlet/Insert servlet class which is in ../servlets-examples/classes/Insert.class.
    It put the string in DB which works fine. Also I made a package in ...servlet-examples/classes/Service in which I uploaded Core.java and compiled it and got the class files in it as a package.
    In Insert class file I imported Service.*. In Insert class file I put a line like this. Core.putInPool(submittedString) which is a static method.
    When I submit input.html , the string is put in DB, but it is not submitting to the program already running.
    What I want to do is, I want to submit the string to the program that is running in /home/raja/Service/.
    This is the program running in /home/raja/Service.
    public class Core {
         static ThreadPool bc= new ThreadPool(10);
         public static void putString(String someStr) {
              bc.putInPool(someStr);
         public static void main(String args[]) throws InterruptedException {
              BufferedReader dataIn = new BufferedReader(new InputStreamReader( System.in) );
              while(true) {
                   System.out.println("\f 1.Insert\n2.option2Enter Ur choice:");
                   try{
                        ch = Integer.parseInt(dataIn.readLine());
                                   String string="";
                        switch(ch) {
                             case 1: System.out.println("\nEnter the String:");
                                  string = dataIn.readLine();
                                  bc.putInPool(string);
                                 .....In Insert.class servlet,
                                    string = req.getParameter("userInputString");
                                    out.println("Submitted");
                        Core.putInPool(string);

  • Calling SessionBean from Servlet

    Hi ,
    I am using Weblogic11g server .
    In my application I am calling SessionBean (EJB3.0) from my servlet using MappedName#PackageName.RemoteBean Name , its working fine .
    But Can you please tell me if i can use @EJB in servlets for this purpose .
    Thanks in advance

    for now that is server specific. I believe in the EJB 3.1 standard it is specified that you should be able to inject EJBs into servlets, but for now it is not mandatory. If any application server is able to do it, it would be Glassfish.

  • Calling Exe from Servlet

    I need to call 1 exe from a servlet. I tried giving <FORM ACTION="Path for that Exe">
    But its not working. Can't I call exe or any other file other than .class file ?
    Help me out.

    I need to call 1 exe from a servlet. I tried giving
    <FORM ACTION="Path for that Exe">
    But its not working. Can't I call exe or any other
    file other than .class file ?
    Help me out.Here goes my Code
    import java.io.*;
    import java.util.Hashtable;
    import java.util.Date.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    * Date Servlet
    * This is a simple servlet to demonstrate server-side include
    * It returns a string representation of the current time. And also client IP and Name
    * @author
    * 16 Oct. 2003
    public class PrintDate extends HttpServlet{
         public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException{
              response.setContentType("text/plain");
              PrintWriter out = response.getWriter();
              //ServletOutputStream out = response.getOutputStream();
              String host = request.getRemoteAddr();
              //out.println("I am printing the host:" + host);
              out.println("<HTML>");
              out.println("<HEAD></HEAD>");
              out.println("<BODY>");
              out.println("<FORM METHOD=get ACTION=/servlet/Kudremukh_pan>");
              out.println("<INPUT TYPE=text SIZE=15>");
              out.println("<INPUT TYPE=submit VALUE=submit>");
              out.println("</FORM></BODY></HTML>");

  • Calling URL from servlet

    Hi!
    I am trying to find a solution to this scenario:
    1) A cron job will call a servlet.
    2) Servlet calls a URL on remote server.
    3) Remote server returns an XML document.
    4) Servlet processes/parses the XML document.
    5) Servlet stores XML fields into DB.
    6) Servlet response (entry to log file) indicates status of transaction.
    I'm stuck @ #2. What mechanism can I use to make a call to remote URL? I do not want the returning XML document to display on the client's browser; I want to process it on the back-end.
    Thx!

    http://java.sun.com/docs/books/tutorial/networking/urls/readingURL.html

  • Calling apps from servlet

    Hi. Had a quite challenging issue here. I had a web portal that can be accessed by others just like any other web site, and this portal is done in java servlet. Whenever someone access the portal, it'll call an application to do some checking and validation. But the application is being run 24 hours non stop whereas the portal can be dead or alive depending of the user. How should i be able to pass the information to the application as i cannot recall or restart it everytime?? I can't use socket as well due to some limitation. Is it possible that i can call the application's function within my portal??
    Another point is that although i can have many portal being accessed at the same time but there'll only be one validating application running, how should i configure in the portal so that it'll 'recognize' the same application and calls the same application for all the portals??
    Really appreciate some advice and information. Thanx!

    Questions
    Do you have a webapp(portal) running on an application server(i.e. tomcat)?
    Sometimes it can be dead or alive, this means the app. server in shutdown sometimes?
    You have a validation application, which validates data running outside the app. server?
    Is the validatation application a java app or windows/other app?
    How do you start/stop the validation app?(i.e. start.exe)
    Do you mean have instead of had?

  • Error in calling EJB from servlet

    I've create a servlet as a client bean to call EJB
              I deploy the EJB, copy the servlet class (in .class format)
              (\config\<domain>\serverclass) and
              jsp to Weblogic 6.0
              When I run the JSP, It said that the EJB class not found.
              Please help
              Fannie
              

    Additional information :
              I added the path where ejb jar file located to the calsspath in
              startWebLogic.sh
              Thanks!!
              Fannie
              Fannie <[email protected]> wrote in message
              news:3ac84447$[email protected]..
              > I've create a servlet as a client bean to call EJB
              > I deploy the EJB, copy the servlet class (in .class format)
              > (\config\<domain>\serverclass) and
              > jsp to Weblogic 6.0
              > When I run the JSP, It said that the EJB class not found.
              >
              > Please help
              >
              > Fannie
              >
              >
              >
              >
              

  • Calling ejbs from servlets without using web apps.

    i am trying to instantiate and ejb from a servlet but it gives me the
              following error. the configuration and code that generated this error is
              attached below.
              oddly enough the same chunk of code works fine in a stand alone client if
              j2ee.jar;weblogic\classes and weblogicaux.jar are included in the classpath.
              any help would be appreciated.
              peter
              -8787844: in servlet.Webmedx.init
              -8787844: null
              java.lang.ClassCastException
              at
              com.sun.corba.ee.internal.javax.rmi.PortableRemoteObject.narrow(Porta
              bleRemoteObject.java:296)
              at
              javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
              at webmedx.servlet.Webmedx.init(Webmedx.java:23)
              at javax.servlet.GenericServlet.init(GenericServlet.java:258)
              at
              weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
              pl.java:474)
              at
              weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStub
              Impl.java, Compiled Code)
              at
              weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
              mpl.java:422)
              at
              weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.
              java:187)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              pl.java:118)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
              textImpl.java:760)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
              textImpl.java:707)
              at
              weblogic.servlet.internal.ServletContextManager.invokeServlet(Servlet
              ContextManager.java:251)
              at
              weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.jav
              a:369)
              at
              weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:269)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
              Code)
              configuration:
              WebLogic startup settings are presently:
              CLASSPATH Prefix
              \weblogic\lib\weblogic510sp5boot.jar;\j2ee\lib\j2ee.jar;\web
              logic\lib\servlet.jar;\weblogic\lib\jaxp.jar;\weblogic\lib\parser.jar
              CLASSPATH
              \weblogic\lib\weblogic510sp5boot.jar;\j2ee\lib\j2ee.jar;\web
              logic\lib\servlet.jar;\weblogic\lib\jaxp.jar;\weblogic\lib\parser.jar;\weblo
              gic\
              jre1_2\lib\tools.jar;\weblogic\jre1_2\jre\lib\rt.jar;\weblogic\jre1_2\jre\li
              b\i1
              8n.jar;C:\weblogic\license;C:\weblogic\classes\boot;C:\weblogic\classes;C:\w
              eblo
              gic\lib\weblogicaux.jar;C:\weblogic\eval\cloudscape\lib\cloudscape.jar
              JAVA_HOME \weblogic\jre1_2
              WEBLOGIC_LICENSEDIR C:\weblogic\license
              WEBLOGIC_HOME C:\weblogic
              system properties:
              java.security.manager
              java.security.policy=\weblogic\weblogic.policy
              weblogic.system.home=\weblogic
              java.compiler=symcjit
              weblogic.class.path=\weblogic\lib\weblogic510sp5.jar;\weblog
              ic\license;\weblogic\classes;\weblogic\lib\weblogicaux.jar
              INITIAL_HEAP 64 MB
              MAX_HEAP 64 MB
              SERVERCLASSPATH
              \weblogic\lib\weblogic510sp5boot.jar;\j2ee\lib\j2ee.jar;\web
              logic\lib\servlet.jar;\weblogic\lib\jaxp.jar;\weblogic\lib\parser.jar;\weblo
              gic\
              jre1_2\jre\lib\rt.jar;\weblogic\jre1_2\jre\lib\i18n.jar;C:\weblogic\classes\
              boot
              ;C:\weblogic\eval\cloudscape\lib\cloudscape.jar
              Type "wlconfig -help" for program usage.
              code:
              public void init() throws ServletException{
              try{
              Log.debug("in servlet.Webmedx.init");
              Properties h = new Properties();
              h.put(Context.INITIAL_CONTEXT_FACTORY,
              "weblogic.jndi.WLInitialContextFactory");
              h.put(Context.PROVIDER_URL, "t3://localhost:7001");
              Context initial = new InitialContext(h);
              Object objref = initial.lookup("webmedx/pool");
              webmedxpoolhome =
              (WebmedxPoolHome)PortableRemoteObject.narrow(objref,WebmedxPoolHome.class);
              }catch(Exception ex){
              Log.error(ex);
              

    The problem before was that you were trying to load the same class from
              2 different class paths. The ClassCastException is very un-intuitive in this
              case.
              Peter Ghosh wrote:
              > however, when i added it to the classpath prefix (not the
              > weblogic.classpath) it seemed to do the trick. very odd.
              > thanks,
              > peter
              >
              > "Peter Ghosh" <[email protected]> wrote in message
              > news:[email protected]...
              > > i tried that but no luck. any other suggestions?
              > > peter
              > >
              > > "Ohad Shany" <[email protected]> wrote in message
              > > news:[email protected]...
              > > > Is your EJB classes on the servlet classpath?
              > > > (weblogic.httpd.servlet.classpath property)
              > > >
              > > > I had some strange casting problem when my EJB classes was on the
              > servlet
              > > > classpath
              > > > and it was gone when i moved them to the weblogic.class.path . Worth a
              > > try.
              > > >
              > > > OHAD
              > > >
              > > > Peter Ghosh wrote:
              > > >
              > > > > i am trying to instantiate and ejb from a servlet but it gives me the
              > > > > following error. the configuration and code that generated this error
              > is
              > > > > attached below.
              > > > > oddly enough the same chunk of code works fine in a stand alone client
              > > if
              > > > > j2ee.jar;weblogic\classes and weblogicaux.jar are included in the
              > > classpath.
              > > > > any help would be appreciated.
              > > > > peter
              > > > >
              > > > > -8787844: in servlet.Webmedx.init
              > > > > -8787844: null
              > > > > java.lang.ClassCastException
              > > > > at
              > > > > com.sun.corba.ee.internal.javax.rmi.PortableRemoteObject.narrow(Porta
              > > > > bleRemoteObject.java:296)
              > > > > at
              > > > > javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
              > > > > at webmedx.servlet.Webmedx.init(Webmedx.java:23)
              > > > > at javax.servlet.GenericServlet.init(GenericServlet.java:258)
              > > > > at
              > > > > weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
              > > > > pl.java:474)
              > > > > at
              > > > > weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStub
              > > > > Impl.java, Compiled Code)
              > > > > at
              > > > > weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
              > > > > mpl.java:422)
              > > > > at
              > > > > weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.
              > > > > java:187)
              > > > > at
              > > > > weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              > > > > pl.java:118)
              > > > > at
              > > > > weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
              > > > > textImpl.java:760)
              > > > > at
              > > > > weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletCon
              > > > > textImpl.java:707)
              > > > > at
              > > > > weblogic.servlet.internal.ServletContextManager.invokeServlet(Servlet
              > > > > ContextManager.java:251)
              > > > > at
              > > > > weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.jav
              > > > > a:369)
              > > > > at
              > > > > weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:269)
              > > > >
              > > > > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
              > > > > Code)
              > > > >
              > > > > configuration:
              > > > >
              > > > > WebLogic startup settings are presently:
              > > > >
              > > > > CLASSPATH Prefix
              > > > > \weblogic\lib\weblogic510sp5boot.jar;\j2ee\lib\j2ee.jar;\web
              > > > > logic\lib\servlet.jar;\weblogic\lib\jaxp.jar;\weblogic\lib\parser.jar
              > > > > CLASSPATH
              > > > > \weblogic\lib\weblogic510sp5boot.jar;\j2ee\lib\j2ee.jar;\web
              > > > >
              > >
              > logic\lib\servlet.jar;\weblogic\lib\jaxp.jar;\weblogic\lib\parser.jar;\weblo
              > > > > gic\
              > > > >
              > >
              > jre1_2\lib\tools.jar;\weblogic\jre1_2\jre\lib\rt.jar;\weblogic\jre1_2\jre\li
              > > > > b\i1
              > > > >
              > >
              > 8n.jar;C:\weblogic\license;C:\weblogic\classes\boot;C:\weblogic\classes;C:\w
              > > > > eblo
              > > > > gic\lib\weblogicaux.jar;C:\weblogic\eval\cloudscape\lib\cloudscape.jar
              > > > > JAVA_HOME \weblogic\jre1_2
              > > > > WEBLOGIC_LICENSEDIR C:\weblogic\license
              > > > > WEBLOGIC_HOME C:\weblogic
              > > > > system properties:
              > > > > java.security.manager
              > > > > java.security.policy=\weblogic\weblogic.policy
              > > > > weblogic.system.home=\weblogic
              > > > > java.compiler=symcjit
              > > > >
              > > > > weblogic.class.path=\weblogic\lib\weblogic510sp5.jar;\weblog
              > > > > ic\license;\weblogic\classes;\weblogic\lib\weblogicaux.jar
              > > > > INITIAL_HEAP 64 MB
              > > > > MAX_HEAP 64 MB
              > > > > SERVERCLASSPATH
              > > > > \weblogic\lib\weblogic510sp5boot.jar;\j2ee\lib\j2ee.jar;\web
              > > > >
              > >
              > logic\lib\servlet.jar;\weblogic\lib\jaxp.jar;\weblogic\lib\parser.jar;\weblo
              > > > > gic\
              > > > >
              > >
              > jre1_2\jre\lib\rt.jar;\weblogic\jre1_2\jre\lib\i18n.jar;C:\weblogic\classes\
              > > > > boot
              > > > > ;C:\weblogic\eval\cloudscape\lib\cloudscape.jar
              > > > >
              > > > > Type "wlconfig -help" for program usage.
              > > > >
              > > > > code:
              > > > >
              > > > > public void init() throws ServletException{
              > > > > try{
              > > > > Log.debug("in servlet.Webmedx.init");
              > > > > Properties h = new Properties();
              > > > > h.put(Context.INITIAL_CONTEXT_FACTORY,
              > > > > "weblogic.jndi.WLInitialContextFactory");
              > > > > h.put(Context.PROVIDER_URL, "t3://localhost:7001");
              > > > > Context initial = new InitialContext(h);
              > > > > Object objref = initial.lookup("webmedx/pool");
              > > > > webmedxpoolhome =
              > > > >
              > > > >
              > >
              > (WebmedxPoolHome)PortableRemoteObject.narrow(objref,WebmedxPoolHome.class);
              > > > > }catch(Exception ex){
              > > > > Log.error(ex);
              > > > > }
              > > > > }
              > > >
              > >
              > >
              

  • Unable to call EJB from servlet

    Fillowing is my ejb module
    package univesity;
    import java.rmi.RemoteException;
    import javax.ejb.*;
    public interface EnrollmentCartHome extends javax.ejb.EJBHome
         EnrollementCartObject create() throws CreateException,RemoteException;
    package univesity;
    import java.rmi.RemoteException;
    public interface EnrollementCartObject extends javax.ejb.EJBObject
         public void addCourse(int courseID) throws RemoteException;
    package univesity;
    import java.rmi.RemoteException;
    import javax.ejb.CreateException;
    import javax.ejb.EJBException;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    public class EnrollementCartEJBBean implements SessionBean
         int courseID;
         public void ejbActivate() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
         public void ejbPassivate() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
         public void ejbRemove() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
         public void setSessionContext(SessionContext arg0) throws EJBException,
                   RemoteException {
              // TODO Auto-generated method stub
         public void addCourse(int courseID)
              System.out.println("i am in add course");
              System.out.println("i am in add course--->"+courseID);
         public void ejbCreate() throws CreateException
              System.out.println("i am in ejbCreate");
              courseID=0;
    }ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
              "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
              <jndi-name>ejb/EnrollmentCartHome</jndi-name>
    <ejb-jar>
         <description>Simplest Statefull Session Bean</description>
         <display-name>University EJB</display-name>
         <enterprise-beans>
           <session>
             <ejb-name>Enrollement</ejb-name>
             <home>university.EnrollementCartHome</home>
             <remote>university.EnrollementCartObject</remote>
             <ejb-class>university.EnrollementCartEJBBean</ejb-class>
             <session-type>Statefull</session-type>
             <transaction-type>Bean</transaction-type>
           </session>
         </enterprise-beans>
    </ejb-jar>here is my servlet
    package university;
    import javax.naming.InitialContext;
    import javax.servlet.*;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class EnrollCourse extends javax.servlet.http. HttpServlet
         public void doGet(HttpServletRequest req,HttpServletResponse res)
         public void doPost(HttpServletRequest req,HttpServletResponse res)
              try {
                        InitialContext ic = new InitialContext();
                        Object objRef = ic.lookup("ejb/EnrollmentCartHome");
                        university.EnrollementCartHome home=(university.EnrollementCartHome)javax.rmi.PortableRemoteObject.narrow(objref, university.EnrollementCartHome.class);
                        university.EnrollementCartObject obj=(university.EnrollementCartObject)home.create();
                        obj.addCourse(5);
              catch (Exception ex)
              { ex.printStackTrace(); }
    }i am getting following error
    java.lang.Error: Unresolved compilation problems:
         university.EnrollementCartHome cannot be resolved to a type
         university.EnrollementCartHome cannot be resolved to a type
         objref cannot be resolved
         university.EnrollementCartHome cannot be resolved to a type
         university.EnrollementCartObject cannot be resolved to a type
         university.EnrollementCartObject cannot be resolved to a type
         university.EnrollCourse.doPost(EnrollCourse.java:24)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

    Thanks for your continuous reply
    i solved all problems i have posted but now i am facing new problem that "EJB is already registerd"
    giving you stack trace
    15:21:22,109 WARN  [ServiceController] Problem creating service jboss.j2ee:module=UniversityProjectEJBModule.jar,uid=22223562,service=EjbModule
    javax.management.InstanceAlreadyExistsException: jboss.j2ee:jndiName=ejb/EnrollmentCartHome,service=EJB already registered.
         at org.jboss.mx.server.registry.BasicMBeanRegistry.add(BasicMBeanRegistry.java:761)
         at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:225)
         at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
         at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
         at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
         at org.jboss.mx.server.MBeanServerImpl$3.run(MBeanServerImpl.java:1422)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1417)
         at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:376)
         at org.jboss.ejb.EjbModule.createService(EjbModule.java:373)
         at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
         at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:243)
         at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
         

  • Calling an applet from servlet

    Hi
    I'm devoloping a server side java software(on netbeans 6) and I want my gui classes(Designed as swing japplet application) to be executed on server side.
    I mean I have database operations on my applet and some logging functions and I want them to execute on server side not client side
    Is it possible to call applets from servlet and so its executed on server if it is possible how can i do that is there a tutorial for that ?
    If it is not is there any other solution? Its really urgent for me
    Thanks

    tolgatanriverdi wrote:
    I'm devoloping a server side java software(on netbeans 6) and I want my gui classes(Designed as swing japplet application) to be executed on server side.Call a company named Citrix, they do stuff like that using a special client.
    I mean I have database operations on my applet and some logging functions and I want them to execute on server side not client sideSo it's not the GUI classes but the rest of the business logic.
    Is it possible to call applets from servlet and so its executed on server if it is possible how can i do that is there a tutorial for that ?It's possible for a servlet to call any class. It's not easily possible for a servlet to connect to a certain applet instance running on a certain client, and neither should it. Hello - it's the server. It's supposed to answer to requests. It's not supposed to issue requests to the client. And considering your set-up as I understood it, you don't ned that anyway. Let the applet just tell the servlet to do action X or Y or Z.
    Its really urgent for meGood Thing that you wrote it here. If you had written it at the beginning of your post, I wouldn't have bothered to answer.

  • How can I display the HTML page from servlet which is called by an applet

    How can I display the HTML page from servlet which is called by an
    applet using the doPost method. If I print the response i can able to see the html document. How I can display it in the browser.
    I am calling my struts action class from the applet. I want to show the response in the same browser.
    Code samples will be appreciated.

    hi
    I got one way for this .
    call a javascript in showDocument() to submit the form

  • Calling 3 different servlets from a single servlet

    hi all,
    i am in lot of soup...i am new to servlets,etc....so help me pls.
    i need to call 3 different servlets from one servlet. all 3 servlets that i want to call perform different functions and execute queries on the database.
    what i am trying to do is:
    there is an html page that call a servlet called authenticate.java.(whose code is at the bottom of this page).
    the servlet authenticate.java should authenticate a user according to the password and username supplied in the html page.
    MAINLY:-
    i need to display 3 buttons to the authenticted user. those 3 buttons each should call 3 different servlets, which do different things.
    now in authenticte.java i set certain information in the session using session.putValue();
    further, whatever servlet is called, i need to use that information i set into the session...using session.getValue().
    PLS TELL ME HOW TO DO THAT...ALSO C IF THE BELOW CODE IS OK.
    ALSO TELL ME HOW TO END A SESSION. ALSO DO SERVLETS SUPPORT SESSIONS?
    I AM USING jdk1.3 and jsdk2.0.
    * Authenticate.java
    // this places all user variables in session
    //to access use session.getAttribute
    //dispatcher stuff
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.servlet.http.HttpSession;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    * @author Gudiya
    * @version
    public class Authenticate extends HttpServlet {
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    HttpSession session = request.getSession(true);
    Connection con=null;
    String sessionid;
    String deptcode;
    String desig;
    String add1;
    String add2;
    String contname;
    PrintWriter out = response.getWriter();
    try
    {System.out.println(1);
    response.setContentType("text/html");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("jdbc:odbc:SACFA","","");
    System.out.println("connection established");
    catch(ClassNotFoundException e){
    System.out.println("database driver not found");
    System.out.println(e.toString());
    catch(Exception e){System.out.println(e.toString());
    String username=request.getParameter("username");
    String password=request.getParameter("password");
    try{
    System.out.println(2);
    PreparedStatement stmt=con.prepareStatement("SELECT * FROM AUTHENTICATION,mb_add where AUTHENTICATION.NAME=? AND AUTHENTICATION.PASSWORD=? AND mb_add.DEPT_NAME=?");
    stmt.setString(1,username);
    stmt.setString(2,password);
    stmt.setString(3,username);
    ResultSet rs=stmt.executeQuery();
    System.out.println(3);
    boolean rowfound=false;
    rowfound=rs.next();
    if (rowfound==true)
    sessionid=session.getId();
    System.out.println(sessionid);
    System.out.println(4);
    session.putValue("user",username);
    rs.beforeFirst();
    while (rs.next())
    System.out.println(5);
    deptcode=rs.getString("DEPT_CODE");
    desig=rs.getString("DESIGNATION");
    add1=rs.getString("ADDRESS1");
    add2=rs.getString("ADDRESS2");
    contname=rs.getString("NAME");
    session.putValue("dept_code",deptcode);
    session.putValue("designation",desig);
    session.putValue("address1",add1);
    session.putValue("address2",add2);
    session.putValue("cont_name",contname);
    System.out.println(6);
    }          out.println("<html>");
              out.println("<head>");
              out.println("<title>Successful Login Screen</title>");
              out.println("</head>");
              out.println("<body bgcolor='ORANGE'>");
    out.println("WELCOME SACFA MEMBERS FROM "+ username);
    //print decorative html statements here
              out.println(" SELECT ANY ONE ACTION:-");
    //out.println("<form Action="+"\"servlet/noc\""+" method =post>");//call for your noc servlet
    //print decorative html statements here
    out.println("<INPUT TYPE=submit VALUE='GENERATE NOC' NAME='NOC'>");
    out.println("</form>");
    //print decorative html statements here
    //out.println("<form Action="+"\"servlet/comments\""+" method =post>");//call for your comment servlet
    out.println("<INPUT TYPE=submit VALUE='ENTER/ MODIFY COMMENTS' NAME='COMMENTS' >");
    out.println("</form>");
    //print decorative html statements here
    // out.println("<form Action="+"\"servlet/bye\""+" method = post>");
    out.println("<INPUT TYPE=submit VALUE=EXIT NAME=EXIT >"); //place javascript fucction for exiting window
    out.println("</form>");
              out.println("</body>");
              out.println("</html>");
    con.close();
    } catch( SQLException e){ }
    out.close();}
    THANK YOU,
    REGARDS,
    ASHNA

    Hi Ashna,
    You have use three different forms for three buttons. But I think all are commented one.It will also work if you uncomment it.
    Else you can use only one Form without giving action in form tag. Use normal buttons instead of submit type buttons & call different JavaScript functions on onClick event for each button.
    Try this out.
    Ajay

  • Getting error while calling ejb business methods from servlet

    Hi
    Iam getting error when i try to call a ejb method from servlet.Error is
    "com.netscape.server.eb.UncheckedException: unchecked exception nested exception is:java.lang.NullPointerException".
    I build the application and deployed it successfully.Iam using IAS 6.O with windows NT 4.0.
    This is just a method which takes values from database and return as an array of bean to servlet.
    Any help on this.Thanks Shank

    Hi
    I was using the session bean.Your suggestion helped me a lot.Perfect.
    I debug my program and found that from ejbCreate()exception is getting.
    I was getting the datasource object thro ejb create() initialisation.
    Somehow the look up jndi which i mentioned was not interpretting from ejb-jar.xml ias-ejb-jar.xml and datasource ref .Due to this iam getting jndi Namenotfound exception which in turns to null pointer as datasource is getting null.
    when i hardcoded in the ejb the the jndi name for datasource it is working fine.Bit worried all the existing ejbs working with the xml referenced datasource and jndi,but when i added a new ejb with same properties it is failing to get the jndi name.
    Piece of code from ias-ejb-jar.xml
    <resource-ref>
              <res-ref-name>myDataSource</res-ref-name>
              <jndi-name>jdbc/nb/myData</jndi-name>
    </resource-ref>
    Piece of code from ejb-jar.xml
    <resource-ref>
              <res-ref-name>myDataSource</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
    </resource-ref>
    Thanks a lot meka

Maybe you are looking for