JNI via Server-Side Language

I'd like to use the following post as a reference: http://72.5.124.102/thread.jspa?threadID=788137&messageID=4479784
"The DLL will remain loaded between calls, so if you use a global variable to store the connection then it should be ok. "
Of course this makes logical sense. However, JNI doesn't have a handle from my understanding... JNI looks like this:
private native void nativeMethodInvoke();
static {
    System.load(path+dllName) // many alts to this, but yea.
// somewhere in main thread....
SelfClass varRefToSelf=new SelfClass();
// where SelfClass is the current class running.
// This doesn't make sense to me, considering usage of 'this' - so if anyone can explain that, I would greatly appreciate it.
varRefToSelf.nativeMethodInvoke();So.... am I supposed to keep a global reference within my class, to itself?!?
The actual problem is that I'm using a server-side language to invoke Java, and thus C++ via JNI. However, the server-side language is creating a new instance of the JAR upon each invocation. So my plan was to pass a reference to the module handle, and somehow manage to get that back to server-side language, and then furthermore back to Java JNI. Am thinking about moving to a servlet instead, since this doesn't appear to be possible - as unfortunate as that is.
Would SingleThreadModel work in this case? Or should I have C++ thread itself, so when Java makes a call, I can let C++ handle data by forwarding to correct module in memory? Assuming the above mentioned post is accurate, then the DLL, when loaded by Java, will stay in memory until unloaded. If the jvm is exiting after each server-side invocation, I must assume multiple instances of the dll are being created. So, am thinking this prospect will work... servlets aside...
Any help is appreciated. I clearly do not understand JNI as well as I should.
*Edit:
I have already tried this, and found that C++ DLL's thread is definitely active in memory post-jvm exit. The DLL also appears to be loaded multiple times, as the data I'm dealing with appears to be unique, in that it's not "stepping into itself" and overwriting pointers, or anything.
Am I going to have to create an instance of my class, via itself, to launch itself in the jvm manually - to keep the reference to dll in memory?
Although that statement sounds terribly redundant... I believe it's accurate...
1.) Create instance of class that's called by server-side, launch it under new jvm
2.) Have orig class return to server-side as normal, and forward any new requests to the jvm-launched "self"; based on detection of class/jvm in memory...
For being cross-platform "magical", Java sure makes it difficult to perform pretty basic tasks....

Thanks for the great information jschell, this clears up alot. I'll play around with these new prospects and see if I can get this running properly.
Also, let me define more what I'm actually doing.
I'm using Railo, and a CFX "tag" to invoke a JAR. This Jar contains the JNI to execute a DLL's code. This dll's code is merely in place to perform some server tasks - mostly routine file maintenance, and checks to ensure normal operation. Some of this includes db queries. Yes this can be done in Java for the most part, but we plan to use the DLL exports later in a deployment scenario.
So, "Did you mean it is loading the jar each time?", I do believe so. However, the instances appear to be different. If i were to create a thread within the JNI invoking class, which i have tried by the way, and create a global variable with some value, the second calling of the JAR file reports that it has not been defined yet on class initialization. Additionally, the thread I mentioned also halts, and does not exist within the second calling.
Let me show some actual code...
Test.cfm...
<cfx_mytag Library="myLibrary.dll" task="function1">
<cfscript>
... // do some stuff.
</cfscript>If I were to alter that to:
<cfx_mytag Library="myLibrary.dll" task="function1">
<cfx_mytag Library="myLibrary.dll" task="function2">
<cfscript>
... // do some stuff.
</cfscript>I found that function2 in the same JAR, loaded via "cfx_mytag", reports inexistance of function1's execution - which registered a value into a global var.
This is why I must assume that the JAR is being loaded independantly - each time. Correct me if wrong. Perhaps my terminology is off - the class within the jar file is multi-instanced, as far as I can tell. Or rather... Railo is creating mutliple instances of this class - and thus I lose my handle to my dll - every call... Seemingly at least.
//Java...
import com.allaire.cfx.*;
public final class myClass implements CustomTag {
     private Request req;
     private Response res;
        public boolean igetresetoften;
     private native void gogoGadgetDLL();
     public myClass() {
    public void processRequest(Request request,Response response) throws Exception {
         this.req=request;this.res=response;
          if (!this.igetresetoften) {
                 igetresetoften=true;
                 res.write("yea... this is annoying");
            // in actual code - function1() assigns global var.
            // and function2() reports to response buffer the value of the global var , which is constantly false each run.
}Notice the similarity to a servlet (request/response buffers). I've dealt with servlets, so I know that all requests are threaded.. but the global vars in a servlet are, in fact, ... global. Not in this case, it would seem.
Thanks again, I'll let you know of my results, late tonight.
Edited by: jSD7 on Nov 13, 2009 4:20 PM

Similar Messages

  • When php is the server side language...

    Can SQL injection happen to a flash website which uses php as the server side language?
    (Highly appreciate your input)

    you're welcome.
    and, it's easy to prevent using mysql_real_escape_string():  http://www.tizag.com/mysqlTutorial/mysql-php-sql-injection.php
    i always use a for-loop to convert all the variables to php variables and while i'm at it, prevent injection:
    foreach ($_POST as $key => $value) {
       $$key = $value;
       $$key = mysql_real_escape_string($$key);

  • Synchronization issues about FMS server side language!

    My FMS applicaiton(FMS4.5) use a Array on the main.asc ,
    anyone who connect to the server will change(remove/add) item of the Array,
    i'm worry about that if there is a synchronization issues with that?
    Is there any class i can use to lock/unlock the Array when i  modify the Array?
    THX!

    You can have synchronization issues. For using lock/unlock, you can use server side Shared Objects. For more details about Shared Object, check the below link:
    http://help.adobe.com/en_US/adobemediaserver/ssaslr/WS5b3ccc516d4fbf351e63e3d11a11afc95e-7 e63SSASLR.2.3.html

  • HTTP SERVICE - How to get the value of my params on the server side

    I am new to flex and with the url limitation i was trying to
    do the following ....send a bunch of ids... using params variable
    var myservice:HTTPService = new HTTPService();
    myservice.url = url;
    myservice.method = "POST";
    myservice.resultFormat = "e4x";
    myservice.send(params);
    The question is how do i get the value i passed on using
    params on the server side? can the variable params be a string or
    array or does it have to be object type?
    Any help would be greatly appreciated.

    Most server side languages have a function or an array where
    you extract the variables. in PHP they arrive in global arrays
    called $_POST and $_GET.
    Other languages have methods like request.formvars or
    request.query. Check your serverside language on how that is
    done.

  • Edit Save Server Side XML [HELP]

    I have an XML that is keeping a few scores. ( 5 entries ).
    I need a Flash interface to be able to edit these nodes and save the XML back to the server.
    Has anyone done anything like this ?  I am open to using PHP with it to make it work.
    Any guidance with this is appreciated.

    Exactly you need a server side language to do it, PHP is good option.
    You need save the scores to a database (using PHP) then load the data from the Data base (using PHP) in a XML format
    To call the PHP files from Flash use URLLoader
    http://library.creativecow.net/articles/brimelow_lee/php_mysql.php

  • Error while saving a workflow via sharepoint designer: Server-side activities have been updated. You need to restart SharePoint Designer to use the updated version of activities.

    While saving a workflow using SharePoint designer on a SharePoint site, I get the following error: 
    Server-side activities have been updated. You need to restart SharePoint Designer to use the updated version of activities.
    Steps to recreate error:
    Login to the WFE server hosting IIS and workflow manager, open SharePoint Designer 2013 and login to a SharePoint site.
    Access the list using SharePoint Designer 2013, in the workflow section, click new workflow. 
    In the new workflow dialog, enter workflow details, click save (see screenshot below).
    Error message is displayed as below:
    After restarting SharePoint Designer, the saved workflow is not seen in the site/workflows or list/workflow section.
    Workaround
    When the above steps are repeated while accessing the site via SPD from any other box besides the WFE/Workflow manager host server, the error is not encountered and its possible to save/publish workflows.
    Notes
    Workflow Manager 1.0 is installed.
    The site has been registered with Workflow manager using Register-SPWorkflowService
    cmdlet.
    Any clue on why is this happening?

    Hi Vivek,
    Please close your SharePoint Designer application, clear/delete the cached files and folders under the following directories from your server installed SharePoint Designer, then check results again.
    <user profile>\appdata\roaming\microsoft\SharePoint Designer\ProxyAssemblyCache
    <user profile>\appdata\local\microsoft\websitecache\<sitename>
    http://www.andreasthumfart.com/2013/08/sharepoint-designer-2013-server-side-activities-have-been-updated/
    Thanks
    We are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Need Help Writing Server side to submit form via API

    Hey
    I need help writing a serverside application to submit
    information via API to a separate server.
    I have a client that uses constant contact for email
    campaigns. We want to add to her website a form taht submits the
    information needed to subscribe to her email list, to constant
    contact via API.
    FORM.asp :: (i got this one under control)
    name
    email
    and submits to serverside.asp
    SERVERSIDE.ASP
    In serverside.asp i need to have
    the API URL
    (https://api.constantcontact.com/0.1/API_AddSiteVisitor.jsp)
    username (of the constant contact account)
    password (of the constant contact account)
    name (submited from form.asp)
    email (submitted from form.asp)
    redirect URL (confirm.asp)
    Can anyone help get me going in the right direction?
    i have tried several things i found on the net and just cant
    get anyone to work correctly.
    One main issue i keep having is that if i get it to submit to
    the API url correctly - i get a success code, it doesnt redirect to
    the page i am trying to redirect to.
    ASP or ASP.NET code would be find.
    THANKS
    sam

    > This does require server side programming.
    > if you dont know what that is, then you dont know the
    answer to my question. I
    > know what i need to do - i just dont know HOW to do it.
    If you are submitting a form to a script on a remote server,
    and letting
    that script load content to the browser, YOU have no control
    over what it
    loads UNLESS there is some command you can send it that it
    will understand.
    No amount of ASP on your server is going to change what the
    remote script
    does.
    http://www.constantcontact.com/services/api/index.jsp
    they only allow their customers to see the instructions for
    the API so i
    can't search to see IF there is a redirect you can send with
    the form info.
    But posts on their support board say that there is.
    Alan
    Adobe Community Expert, dreamweaver
    http://www.adobe.com/communities/experts/

  • Submit report to Oracle 6i Report Server via dbms_jobs or server side pl/sq

    Is there a way to submit an Oracle report to an Oracle 6i Report Server from a dbms_job or a server-side pl/sql package?

    Is there a way to submit an Oracle report to an Oracle 6i Report Server from a dbms_job or a server-side pl/sql package?

  • Server Side Trust and Webi Report Scheduling via Portal

    Hello,
    I have opened a similar  thread about Server Side Trust and webintelligence reporting through the portal a few months ago.
    At the time, we had some complaints about users that were getting SSO errors after 8 hours when scheduling WeBi Report through the SAP Portal.
    Basically, the users connect to the Portal and then FROM the Portal, to a BOI view pointing to the Infoview.
    Then, after investigatinon, it was my understanding that the WebI Reports should be scheduled through an Infoview token and not a portal token. In concrete terms Server Side Trust had to be implemented between the SAP BW Backend and the BOE 3.1 Server.
    And after that the users who wanted to schedule WebI reports should connect to the Infoview directly (using their SAP BW credentials) to generate an Infoview Token.
    Scheduling Webi reports from the Portal will not be solved by implementing Server Side Trust, since it is only a matter of time before the  the Portal token expires ( 8 hour by default).
    Now, I have configured the server side Trust between our BOE 3.1 SP2 and our BW 701 system, SNC configuration, PSE generation, exchange of certificats , etc ...
    I did some scheduling tests connecting directly to the BO Infoview and it works.
    But of course, now I am being told by the users that this solution is not acceptable.
    The Portal being the entry point of our Infrastructure, they don't want to connect to the Infoview to schedule their reports.
    So I opened a SAP customer call to try to have an official and clear statement from SAP but I never obtained it.
    I had a look at my SAP BO courses but I am still confused
    For example according to SAP BO100 , server side trust should be implemented when ;
    "BOE client session authenticated using Single sign on using SAP token
    (Enterprise Portal) and SAP reports are being scheduled at a future point in
    time (after token expiry date)."
    Anyone can help me to clear my mind ?
    Thank you
    Best Regards

    Hi,
    first of all lets separate the UI portion from the technical portion.
    on the technical side:
    yes for scheduling the Web Intelligence document you will need Server side trust
    on the UI side:
    - scheduling is part of InfoView
    - scheduling is part of the KM integration with the portal
    if that is not accepted from a UI point of view from the user you can create your own application to schedule documents using the SDK.
    ingo

  • Editing server-side Sieve via IMAP... does Messaging Server support RFC 5804?

    The Sieve Addon for Thunderird https://addons.mozilla.org/en-us/thunderbird/addon/sieve/ (https://github.com/thsmi/sieve) mentions the sieve management protocol (RFC 5804) accessible over IMAP. I did not find any mention of this on the CommSuite Wiki, so I guess it is not supported at the moment... or just not published?
    Apparently, most users of this addon use it in conjunction with Dovecot server which does support Sieve server-side filtering, and/or with projects like this to translate between client-side Mozilla filters and server-side Sieve filters: Mozilla filter to sieve converter | Free Communications software downloads at SourceForge.net
    I am not sure yet if there is an addon to automatically replicate client-side rules onto the server-side rules as the users edit them in their GUI... but this would be the next logical step
    //Jim

    Hello, thanks for the update despite the lack of forbidden details.. at least, the feature is in the pipeline
    Could you please clarify: did I understand correctly that the managesieve RFC and implementation by the Messaging Server are not compatible with the user's Sieve rules as maintained by Convergence (as of today)? I did not really dig deep into the RFC definition, but does it define that the IMAP server maintains one big script only (and not something like an IMAP mailbox with numerous small scripts, possibly ordered by some attribute)?
    Conversely, would the Messaging Server be able to use large singular sieve scripts pushed by an email client, and would these be useless or invisible to Convergence client?
    Thanks.
    //Jim

  • What language should I use if I am a beginner to using SSI (server side includes)?

    I want to start using server side includes and understand how to also code them by hand.  What is the easiest way to begin?  Do I just php?
    -Kate

    First question you need to ask your Host is if they support server-side includes and which document extensions you can use.
    Common extensions:
    .shtml, .shtm, .php, .asp, .cf.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics |  Print | Media Specialists
    www.alt-web.com/
    www.twitter.com/altweb

  • Bw web report plugin http session hangs at the server side

    Hi,
    I am having problems when closing the browser of a BW web report. After I closed the browser by going File->close, I ran SM04 and found out the Plugin HTTP session hangs at the server side.
    How can we terminate the Plugin HTTP session at the server side when user closes the internet browser?
    I did implement a logoff function at my web template, if user clicks on the logoff, the Plugin HTTP session is terminated at server side correctly. But As you know, 50% of time user will close the report by closing the internet browser instead of clicking the logoff. That leaves lots of hanging Plugin HTTP sessions at our server side.
    By the way, we actived our BEX service at the SICF.
    Thanks for help!
    JA

    Hi
    If you want to avoid a blank page with logoff button, add opener=0
    <a href="<SAP_BW_URL CMD='LOG_OFF' ~command='logoff'
    >" onClick="javascript:window.close(opener=0);">Log off</a>
    If you want to close the session via X, use this code:
    create a sapscript function
    function closeSession()
    logoff()
    window.unload=CloseSession()
    However, the Plugin HTTP session isn't killed.
    Regards

  • How to access a JS changed attribute on the server side?

    hi all;
    if i change an attribute on a custom component via java script on the client side.
    how can i access the changed value on the server side?
    in what method will i have the access to this changed field?
    thanks in advance.

    You can hardcode the ID of the component in the backingbean (or some propertiesfile) and use ViewRoot.findComponent(componentId). Using the binding is (much!) more elegant anyway.

  • Insert data 32K into a column of type LONG using the oracle server side jdbc driver

    Hi,
    I need to insert data of more than 32k into a
    column of type LONG.
    I use the following code:
    String s = "larger then 32K";
    PreparedStatement pstmt = dbcon.prepareStatement(
    "INSERT INTO TEST (LO) VALUES (?)");
    pstmt.setCharacterStream(1, new StringReader(s), s.length());
    pstmt.executeUpdate();
    dbcon.commit();
    If I use the "standard" oracle thin client driver from classes_12.zip ("jdbc:oracle:thin:@kn7:1521:kn7a") every thing is working fine. But if I use the oracle server side jdbc driver ("jdbc:default:connection:") I get the exception java.sql.SQLException:
    Datasize larger then max. datasize for this type: oracle.jdbc.kprb.KprbDBStatement@50f4f46c
    even if the string s exceeds a length of 32767 bytes.
    I'm afraid it has something to do with the 32K limitation in PL/SQL but in fact we do not use any PL/SQL code in this case.
    What can we do? Using LOB's is not an option because we have client software written in 3rd party 4gl language that is unable to handle LOB's.
    Any idea would be appreciated.
    Thomas Stiegler
    null

    In rdbms 8.1.7 "relnotes" folder, there is a "Readme_JDBC.txt" file (on win nt) stating
    Known Problems/Limitations In This Release
    <entries 1 through 3 omiited for brevity >
    4. The Server-side Internal Driver has the following limitation:
    - Data access for LONG and LONG RAW types is limited to 32K of
    data.

  • Server Side activties have been updated. You need to restart SharePoint Designer to use the updated version of activities.

    Hello,
    I have the following scenario for the installation of EPM 2013 environment:
    1 Server running Windows 2008 R2 SQL Server 2008 R2 Service Pack 2
    1 Windows Server 2008 R2 Standard SP1, running Sharepoint 2013 Enterprise (Standard Initially installed and then migrated to the Enterprise in order to install Project Server 2013), Project Server 2013 and Workflow 1.0 (2013).
    After configuring and validating the configuration of Workflow 1.0 by http://server_name.example.com:12291 page and also check the Application Services in Central Administration and receive the Workflow Status = Connected.
    Alright, but when I run the SPD 2013 RTM to test the creation of Sharepoint Workflow 2013, I get the following warning:
    "Server Side activties have been updated. You need to restart SharePoint Designer to use the updated version of activities."
    I've tried:
    a. Restart SPD2013;
    b. Restart Server 2013 and Sharepoint Workflow 1.0;
    c. Reinstall and reconfigure Workflow 1.0
    And the message is always displayed, preventing the use of Workflow Sharepoint 2013.
    Can anyone help me, I'm in the middle of a deployment to a customer.
    Print of alert

    How did you uninstalledLanguage Pack from SharePoint 2013 ? when I googled it I found that language pack cannot be uninstall@
    http://technet.microsoft.com/en-us/library/cc262108.aspx
    "If you no longer have to support a language for which you have installed a language pack, you can remove the language pack by using the Control Panel. Removing a language pack removes the language-specific site
    templates from the computer. All sites that were created that have those language-specific site templates will no longer work (the URL will produce a HTTP 500 - Internal server error page). Reinstalling the language pack will make the site functional again.
    You cannot remove the language pack for the version of SharePoint 2013 that you have installed on the server. For example, if you are running the Japanese version of SharePoint 2013, you cannot uninstall the Japanese language support for SharePoint 2013."

Maybe you are looking for

  • Redirected when opening Apps Store to iTunes Store on iTouch. Help, please?

    Recently after updating my 3rd Gen iTouch with the 4.0 software, I get redirected to ITUNES store when I try to access the APP store from it. I have tried rebooting and I have restored my device several times. Nothing has made a difference. I do not

  • Adblock doesn't work

    Hello, In safari on 10.9. I get an ad, which is in a form of a Safari webpage, and it is an unwanted publicity This announcement appears permanently, without any order in time or where I am clicking on any safari page. Here is a link to this webpage

  • How do I open an excel encrypted file using numbers?

    I have a USB memory stick that contains an .xlsx that is encrypted. I have the password. Can I open it with numbers? Thanks.

  • GT60 Downgrade from Windows 8 to 7

    Just got my new GT60 and love it so far. My only complaint is well Windows 8 and I want to downgrade it to 7. Any problems I should be aware of if someone has done this before?

  • Calling of an observer method in ActionComponent

    Hi I like to call a method of an observer of a panel in my ActionComponent class. - How can I do that? - Have I to write an Interface to the observer class, get this interface via the boss of the panel and call then the method? If yes how can I get t