I have used itext in the past where I have created a Java library with a class using the iText jars. This has worked perfectly in the past.
I now have some PDF's the gets corrupted when using setFormFlattening(true), therefor I have tried using the XFAFlattener, and this one works fine.
My problem is that I now need to load a license file via LicenseKey.loadLicenseFile and this works fine if I use my Java class from a Java agent. But if I try to use my Java class form a LotusScript agent, I get an "Certificate not found" error when LicenseKey.loadLicenseFile is called.
I can see that there is a itext.cer certificate inside the itext-licensekey-1.0.3.jar file. I guess it is this certificate that can't be found when running from a LotusScript agent.
Anyone knows how to get this to work?, maybe someone with deep iText knowledge know how this certificate is being loaded from the iText LicenceKey code, and can figure out what the problem can be.
There is no way to read a resource file in Java code if Java code is executed by LS2J.
As a workaround in my LS2J projects, I put the file content into a constant as base64 string and read this instead of resource file.
Another way is to put the code into an Java agent and to call the agent from LotusScript. This way Java code works as expected. Use an in-memory-document to "communicate" between LotusScript and Java.
Related
I'm trying to convert oracle forms FMB files to XML. To do this I'm using forms developer 10's native Java tool. This works fine on my local computer but I'm trying to automate the conversion process on a server.
I've taken the main folder "Dev10G" from my forms install directory and added it to the server, but I'm getting the error that you can see in the screenshot. I'm trying to avoid doing a full install of forms developer on the server if I can help it. Has anyone any suggestion on what I might try next.
Thanks
You need to exit the bat file in textpad.
You will then need to change the paths.
I you need extra help feel free to checkout my note how to do it here
https://oracleformsinfo.wordpress.com/2011/12/16/batch-script-for-fmb-to-xml-and-xml-to-fmb/
I have bumped into a weird problem in feature that works well on all other installations, but not for one particular client.
The "feature" involves an xpage with code in beforerenderrespons that picks up an uploaded file, gets filename etc and creates a context document. The context document is then passed as parameter to a java agent which process the file.
The java agent is set to Run as web user and has Allow restricted operations. As I said - it works in all installations at other clients, but fails all of sudden on one installation.
The only error message I get from beforerenderrespons event is "Error:Exception occurred calling method NotesAgent.runWithDocumentContext(lotus.domino.local.Document) null".
I have confirmed that the agent is found but it never gets called. I have also confirmed that the context document also exists.
The server console says nada.
I have tested calling the agent with different run methods as in agent.run() but it does not make a difference.
Now to the weird stuff - if I call a java agent that does not include a scriptlibrary it works! But as soon as I add a script library to the agent I get the error above.
Why is that? Any help or clue appreciated. It feels like I have missed a security setting somewhere.
The server doc includes the agent signer in "Sign agents to run on behalf of someone else", "Sign or run unrestricted methods and operations" and "Sign or run restricted LotusScript/Java agents"
edit:
Tested using a "pass-thru" agent that calls my original java agent that contains script libraries and that works! The pass-thru agent doesnt contain any scriptlibrary and simply calls my java agent and passes on the context document.
Even so - I still want to know why calling a java agent directy fails if it contains a script library.
/Katarina
One possiblity is the server version. That would explain why it works in some installations and not another. runWithDocumentContext() was only added in 8.5.2 http://blog.nashcom.de/nashcomblog.nsf/dx/passing-a-document-to-an-agent-without-saving-it-first.htm
Since your agent is Java anyway, you can save the trouble of spinning up a new class loader and jvm environment. Move the code into a jar and call it directly from the XPage.
I can't think of a good reason to use the agent (because it was there isn't a good reason in this case)
I want to use PDFbox with PHP/Java bridge, because the only other option after a lot of research involves XPDF and my host won't allow shell_exec(). I have managed to setup the PHP/Java bridge and I have downloaded the PDFbox library but I have no idea what to do with the library to be able to use its API in PHP - how do I include it?
The current folder structure I have with the bridge is:
JavaBridge
java (containing Java.inc and JavaProxy.php)
WEB-INF
index.php (containing the code to test that I can use the bridge)
I have no idea how Java works in details, I just want to use the APIs to parse PDF documents (something similar to this example but parsing instead of merging). So do I need to build, do I need to just copy the files in one of the folders...?
And a second question: following the instructions on the PHP/Java bridge I've setup tomcat. But it only works on localhost so far, when I copy the JavaBridge folder on my PHP server I get the following error:
Fatal error: Uncaught Could not connect to the JEE server 127.0.0.1:8080. Please start it. Or define('JAVA_HOSTS',9267); define('JAVA_SERVLET',false); before including 'Java.inc' and try again.
How do I get a JEE server then? If I use a java host will I be able to connect to it?
Thanks in advance!
How can I run a java class from VBA. I am trying to post to a server using Excel VBA. I can do this only with VBA on a PC but when using a MAC the DomDocument object returns a compile error. So what I did was create a java class which will post and get a response from the server. Now what I am trying to do is get the VBA to run the java class wait for a return code and process the return. If this can be done in a different language (then Java) I am also open to that. But we prefer Java.
I tried using
Dim obj as Object
Set obj = GetObject("java:SendXML") '(sendXML is class name)
but get a run-time error that automation failed.
There should be no need to use Java for doing HTTP POST, you can use standard VBA libraries. See How can I send an HTTP POST request to a server from Excel using VBA?.
Edit: If you can't get the Mac answer working, I would advise using CURL which is available for lots of platforms: http://curl.haxx.se/download.html.
I tried a similar thing myself, but to me it appeared as if there is (almost) "no way out" of Excel 2012 for Mac. One solution I considered is to use AppleScript, there are a few examples here: http://www.rondebruin.nl/mac.htm
If you could use OpenOffice / LibreOffice you could try Obba (Java Object Handler for Excel and OpenOffice). This works for Excel on Windows too and I tried to add Mac support to Obba, but so far found no solution.
I have a program, written in Java, which originally used its directory in Program Files to write files accessible to all users of this program. This required our users to run as administrator all the time. In an effort to alleviate that, we decided to move files which needed to be written during regular usage to the ProgramData folder using the %ALLUSERSPROFILE% environment variable. Using a subfolder in this directory for our application works great if it is designated as writable during the installation process, which works fine using NSIS.
The problem comes with upgrading existing users. The Java File API provides setWritable but this does not appear to work after testing on development machines. It looks as though the new file API with Java 7 would solve this problem, but with no release date on the horizon I would rather not wait.
It seems the simplest solution would be to use JNA to call the appropriate Windows API call to set this directory writable. Since upgrading the software necessitates admin rights, similar to installing, it should let this change go through fine. However, I'm unsure where to start, having never used JNA before or the Windows API. Suggestions as to which Windows library to load and what functions to call would be appreciated, especially if someone has encountered a similar problem before.
Well, I'm glad you gave some background...You could use JNA, but the easier way would be to execute a call to the command-line utility cacls. It's included by default in Windows XP installations, I believe, so it should do the trick for you. Try Runtime.getRuntime().exec("C:\\Windows\\System32\\cacls.exe"+options)
Check out the documentation here -> http://technet.microsoft.com/en-us/library/bb490872.aspx
I use the follow line:
Runtime.getRuntime().exec( "C:\\Windows\\System32\\icacls.exe \"%ProgramData%\my application" /grant *S-1-5-32-545:(OI)(CI)(W,M)" );
S-1-5-32-545 is the SID for BUILTIN\Users because the name work only on English systems. https://support.microsoft.com/de-de/kb/163846
This give the BUILTIN\Users write access to all files in the given directory independent which user has create it.