How to use RMI objects in a servlet

Hi,
I have just run the example RMI program in the java tutorial in my linux pc. Also I have another method to just echo a string back. It works fine when calling from command line.
Now I want to write a servlet that get a string when POSTed and call the RMI objects echo method and display the returned string.
I use Tomcat-5.0 which is installed in /usr/local. I moved the remote object interface jar to the common/lib folder and import the interface in my Servlet. I use the following statements inside the servlet to get the RMI object reference.
            Registry registry = LocateRegistry.getRegistry("localhost");
            Rser comp = (Rser) registry.lookup("rmiser");When i use this in my servlet the tomcat stops working.
Also I don't know how to specify the code base and security policy which I use in command prompt when calling RMI object.
Pls suggest me what to do and also specify any resources that explain this task step by step.
Thanks.

restarted the system and caught the following exception while calling the servlet.
Apr 30, 2009 12:24:15 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3861 ms
java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
     at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
     at java.security.AccessController.checkPermission(AccessController.java:546)
     at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
     at java.lang.SecurityManager.checkConnect(SecurityManager.java:1034)
     at java.net.Socket.connect(Socket.java:513)
     at java.net.Socket.connect(Socket.java:469)
     at java.net.Socket.<init>(Socket.java:366)
     at java.net.Socket.<init>(Socket.java:180)
     at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
     at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
     at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
     at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
     at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
     at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
     at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
     at RequestParamExample1.doGet(RequestParamExample1.java:94)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
     at filters.ExampleFilter.doFilter(ExampleFilter.java:101)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
     at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
     at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
     at java.lang.Thread.run(Thread.java:619)
Apr 30, 2009 12:25:19 PM org.apache.coyote.tomcat5.CoyoteAdapter service
SEVERE: An exception or error occurred in the container during the request processing
java.security.AccessControlException: access denied (java.lang.RuntimePermission setContextClassLoader)
     at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
     at java.security.AccessController.checkPermission(AccessController.java:546)
     at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
     at java.lang.Thread.setContextClassLoader(Thread.java:1351)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
     at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
     at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
     at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
     at java.lang.Thread.run(Thread.java:619)
Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.security.AccessControlException: access denied (java.lang.RuntimePermission setContextClassLoader)
     at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
     at java.security.AccessController.checkPermission(AccessController.java:546)
     at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
     at java.lang.Thread.setContextClassLoader(Thread.java:1351)
     at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1623)
     at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1608)
     at java.lang.Thread.run(Thread.java:619)
Hope u can find it now.
the line
at RequestParamExample1.doGet(RequestParamExample1.java:94)
is the file I am editing and using to call RMI.
Edited by: itsraja on Apr 30, 2009 12:06 AM

Similar Messages

  • How to use RMI Stub class in programming?

    Hi all,
    I'm new on RMI.
    Is there anyone can explain to me how to use RMI Stub class which is generated by invoking rmic command?
    For my testing, I can only invoke rmi object nethod via its remote interface. Then what is stub used for when we are coding?
    I do appreciate anyone's help.
    Thanks very much,
    Xianyi.Ye

    When the remote object binds itself to the registry, what is actually bound is the stub.
    So when the client does a registry lookup, what it gets is the stub. However from the client's point of view it is just some mystery object that implements the remote interface.
    So you never have to use it directly, it is all automatic.

  • How to use lock object? what we lock either total ztable or only record?

    Hi
    How to use lock object? what we lock either total ztable or only particular record?
    Don't tell create lock object on se11 with E letter & acll it in program with eENQUEUE & DEQUEUE.
    just tell me we will lock only particular record or total ztable?
    specify with example.
    Thanks.

    Hi
      Go to SE11, in the option 'Lock object' enter the name of your lock,
    begin with 'E', suppose 'EXXXX' And create. In tab 'Tables' fill the
    table name where the record you want to lock exist and select the
    lock mode. Lock mode can be shared and exclusive. If 'shared',
    when you lock the record, other can also read data, but can not
    modify. If 'exclusive', when you lock the record, other can neither
    read nor modify the record. After save and activate, you will get two
    function module.'ENQUEUE_EXXXX' to lock record,
    'DEQUEUE_EXXXX' to release lock on one record.
    When use this function module it only lock one record at a time. It
    does not lock the table.

  • How to use swf object

    Hi have been trying to get my head around how to use swf object, I know very little javascript and so am having difficulty in modifying the code to suit my needs.  This is my page which I have used dreamweaver cs3 and have used insert>media>flash and it is working well but does not validate.  I would really appreciate if somebody could write the exact html code I need to convert this to swf object.
    http://www.kimberleywebdesign.com.au/Links.html

    You should be able to just declare a variable outside of the onComplete function and assign it the loaded object when the file loads...
    var loadedSWF:MovieClip;
    function loadComplete(e:Event):void {
         removeChild(old_mc);
         addChild( DisplayObject(LoaderInfo(e.target).content) );
         loadedSWF = MovieClip(e.currentTarget.content);
    function doStuffToSWF(){
          loadedSWF.something....

  • How to use  Business Object like Vendor or PurchasingInfo

    Hi,
    How to use Business Object ( like Vendor or PurchasingInfo ) from my Object?
    For example:
    CLASS myEntity DEFINITION.
              PUBLIC SECTION.
                   METHODS: getVendor EXPORTING pVendor TYPE Vendor.
               PRIVATE SECTION.
               DATA: aVendor TYPE REF TO Vendor.
    ENDCLASS.
    CLASS myEntity IMPLEMENTATION.
    METHOD getVendor
               pVendor = aVendor .
    ENDMETHOD.
    ENDCLASS

    Hi,
    I am giving u a demo Program for ur doubt.
    REPORT demo_class_counter .
    CLASS counter DEFINITION.
      PUBLIC SECTION.
        METHODS: set IMPORTING value(set_value) TYPE i,
                 increment,
                 get EXPORTING value(get_value) TYPE i.
      PRIVATE SECTION.
        DATA count TYPE i.
    ENDCLASS.
    CLASS counter IMPLEMENTATION.
      METHOD set.
        count = set_value.
      ENDMETHOD.
      METHOD increment.
        ADD 1 TO count.
      ENDMETHOD.
      METHOD get.
        get_value = count.
      ENDMETHOD.
    ENDCLASS.
    DATA number TYPE i VALUE 5.
    DATA cnt TYPE REF TO counter.
    START-OF-SELECTION.
      CREATE OBJECT cnt.
      CALL METHOD cnt->set EXPORTING set_value = number.
      DO 3 TIMES.
        CALL METHOD cnt->increment.
      ENDDO.
      CALL METHOD cnt->get IMPORTING get_value = number.
      WRITE number.
    For more demo programs type 'abapdocu' in the command field
    U will be getting some demo programs.
    There select the abap objects.
    Regards,
    Jagadish

  • How to use an IFrame with my servlet?

    Hello, my question is this (basically, I'm building a "social" application for one of the social networks out there,
    but I'm using a java servlet as my back-end server, though I don't know if it matters to my question) -
    I want to insert an iframe to my application, but I didn't find good material on how to use this, and what to add to my servlet
    for completing the communication with the iframe - can anyone give an example maybe, or a link to a good piece of code.
    Basically, what I want for my application is to simply allow a user to record a voice message, and save it somewhere,
    and for that I need to use a java library, and this is why I thought building it with an iframe that will directly communicate with my java servlet. - IS THIS A GOOD IDEA?
    thanks :)
    Kogan.

    IFrame is just a HTML element. You normally embed HTML elements in a JSP file. How to use an IFrame is covered by every average HTML tutorial.
    What's your actual problem?

  • How to use a object(in MXML - in FLEX 4) in multiple way.

    This is my object in MXML:
    <mx1:Canvas id="menuElement" visible="true" rotationY="-15">
         <mx1:Canvas mask="{imageMask}">
              <mx1:Image id="menuImage" visible="true"/>
              <s:BorderContainer id="menuBackground" width="70" visible="true"  borderVisible="false">
                    <s:Label id="menuDescription" fontSize="30" fontWeight="bold" rotation="-90" />
                        <s:backgroundFill>
                             <s:LinearGradient rotation="90">
                                  <s:entries>
                                       <s:GradientEntry  id="backgroundColor" color="0x000010" alpha="0.6"/>
                                  </s:entries>
                             </s:LinearGradient>
                        </s:backgroundFill>
                   </s:BorderContainer>
              </mx1:Canvas>
         <mx1:Canvas id="imageMask" backgroundColor="#FF0000"/>
    </mx1:Canvas>
    I use this object (one time) with configuration in actionscript (positions, source of picture etc.) and I receive something like on a picture below:
    Now, I need to create 4 elements like below. I don't wan't to copy 4 times this block of program. Anybody have idea how can I make it and how can
    I recall of each element from actionscript?
    Regards

    if you run nw04s SP8, it's a limitation. you can create your own simple types and use them in your entities. but the custom data structures you create in the dictionary don't show in list of available structures when you want to create a new complex attribute

  • How to use Logger object in Lookout 5.0

    I am now trying to log data using Logger object. I use Switch1 for activating LogContinuously mode and Switch2  for breaking logging process. If I turn off Switch1, the logging process stops, its ok. My problem is if Switch1 is still on and I turn off Switch2, the logging process is still running. I seems different from what I have read from Help file. Anyone has the solution for it?Please give me an advice! Thanks a lot. Its better if someone post an example about using Logger object here for reference.
    Regards, 

    I think the behaviour you described is correct. If you turn on switch2, the logging process will stop, even when switch1 is on. If you turn off switch2, the process will be running.
    Here is an example of logger object.
    http://zone.ni.com/devzone/cda/epd/p/id/3816
    you can change the "log break" button into a switch, which can better show you how it works.
    Ryan Shi
    National Instruments

  • How to use Generic Object Services(GOS) for each table control record.

    Dear Expert,
                       I am using generic object services for document attachment but i am facing a problem while attaching document to a table control row. my requirement is to attach separate document for each and every row of table control but  i am unable to attach document row wise of the table control.for each row GOS should display corresponding attached document not all the attached document.
    Thanks in Advanced
    Bhuwan Tiwari
    Edited by: BHUWAN TIWARI on Feb 8, 2011 4:16 PM
    Edited by: BHUWAN TIWARI on Feb 8, 2011 4:16 PM

    You haven't explained what object and object key you're using, nor have you provided any indication of how you implemented the GOS attachment functionality.  You need to provide more information to resolve an issue like this.

  • How to use session object in jsp

    hi all
    marry christmas
    can anyone plz tell me how to use session obect in jsp
    rachna
    Message was edited by:
    rachna_arora82

    hi rachna,
    JSP has a default(implicit) session object...... use the getSession(true) method on the session object and then going u can either get or set attributes depending on the requirement
    That was in general and now with the issue u have got..... what u can do is that the u can create session for every user who logs in and when he/she tries to login again then u can probably check for the existing session object in the JSP and perform the logic as required..... any clarifications plzzzzzzz let me know
    Thanks n Regards
    Naveen M
    Message was edited by:
    Novice_inJAVA
    Message was edited by:
    Novice_inJAVA

  • How to use a javaBean in a servlet without FORMS...

    Hi,
    I would like to use a javaBean in a Servlet.
    I know how you can do this with the code
    HttpSession session = request.getSession();
    in your servlet.
    However, by using this code you have to call the servlet by a FORM. Is it possible to call the servlet (which calls the javaBean) in your JSP file without a FORM?
    Greetings
    Tigi

    Thanks Anthony,
    I'm working with Tigi on the same project and now I can tell you that the problem is solved.
    request.getRequestDisptacher("/myServlet");hehe, you switched the 't' and the 'a'
    <%@ include file="/myServlet" %>this is the one we use :)
    But what is the difference between the first one and the last one? Now We are using the last one because that's the shortest :) not a pretty good reason huh :)
    cheers,
    Soep

  • How to use std object RFBIBL00

    Dear All,
    For uploading open item of vendor and customer std lsmw RFBIBL00 is available.
    I know how to do recording in lsmw for new object but any one can help how to use std lsmw available in SAP. For eg.RFBIBL00
    Regards,
    Bhadresh

    You'll find that the RFBIBL00 program, suprisingly, has extensive documentation attached - or you could try
    http://help.sap.com/saphelp_45b/helpdata/en/35/a47e63763e0392e10000009b38f9b7/content.htm
    or the print documentation at
    help.sap.com/printdocu/core/Print46c/en/data/pdf/CAGTFADM/CAGTFADM-FI.pdf
    cheers
    Jonathan

  • How to use ConnectionPoolDataSource object?

    i use embedded OC4J server,
    build in data-source.xml file the information about DataSource object
    and try to organized ConnectionPoolDataSource object,
    but a java.lang.ClassCastException rises.
    The problem is, i need to use a pooled connection datasource,
    to do this i get the information about datasource object
    throw lookup in JNDI tree the "pooled-location" name,
    so the type of my datasource object became com.evermind.sql.OrionPooledDataSource.
    but in my jsp code i can use only DataSource object,but not ConnectionPoolDataSource object because of java.lang.ClassCastException.
    Hlp me please to understand how to use ConnectionPoolDataSource.
    thank you

    Please post this question on the application server forum at:
    http://forums.oracle.com/forums/forum.jsp?id=486963
    Thanks,
    JR

  • How to use an object's paint method

    I have created a class imagePanel which extends a jPanel to display an image. When I create a new imagePanel object I pass it an image argument which is used to paint my image on the jPanel, so far so good. I don't wish to have to continuously create new ImamePanels to display new images so I thought I could make a set_Image method that would set a new image in an exising imagePanel object. This is where I run into problems how to use the existing object paint method to replace the image. I tried this without success:
    public Image setMyImage (Image myImage)
    imageX = myImage; // imageX is the image that is painted by the imagePanel object's paint method
    paint(g);
    Something must be wrong on how I access the paint method. Thanks for any help.
    Jack

    Yahoooo, got it. This was the code I needed and thanks for your help:
    public void setImage (Image myImage)
    imageX = myImage;
    repaint(300);
    }

  • How to use BOR object?

    Hello,
    We have never used a BOR object. We want use FIPP object. How can we do it? How can we call the Post method?
    Thanks a lot.
    Edited by: LM on Sep 8, 2008 11:07 AM

    Hi
    Refer to the links,
    Probel with POST method of FIPP
    FIPP Workflow
    Regards
    Sumit Agarwal

Maybe you are looking for

  • Can you have 2 iphones on one itune account

    My wife and i both have a iphone now and we currently have them both under one itunes account.  We have noticed that both of our contacts show up in each of our phones.  is there a way to keep this from happening?  Or do we need to set up two differe

  • Connection to Oracle Los!

    I have application which connect to Oracle 8.1.7. though LAN. The problem is that when the application is idle for 1-2 hours it looses connection to Oracle. Can somebody tell me is there any parameter that I can change to fix this?

  • Replace RFFOEDI1 in transaction F110

    Hello I have made a copy of RFFOEDI1 which adds some custom functionality. Is it possible to replace RFFOEDI1 in transaction F110 in general or for a given payment method? As second best solution I would set the program in payment method/country (FBZ

  • Can't download Apps on my Apple ID? Error on Postcode invalid

    Hi All, Can somebody tell me why I can't enter the billing address Postcode? i have enter the correct postcode of my country but still show invalid. My country: Malaysia, Penang, Gelugor, Postcode: 11700 Thank You in Advance

  • How do I install and work the speaktext for ebooks app?

    I just downloaded the speaktext for ebooks, and I'm haveing a hard time understanding the instructions. I want this app to read the book while I'm doing something else.