Call to Java Method to Zip directory fails with error Invalid parameter 1
Hi all,
I try to translate the following Java Code to PeopleCode and I do not succeed in it.
Can somebody please help me out ?
On that website http://www3.ntu.edu.sg/home/ehchua/programming/java/J5b_IO.html I extracted the Java Code:
import java.io.File;
public class ListDirectoryRecusive {
public static void main(String[] args) {
File dir = new File("d:\\myproject\\test"); // Escape sequence needed for '\'
listRecursive(dir);
public static void listRecursive(File dir) {
if (dir.isDirectory()) {
File[] items = dir.listFiles();
for (File item : items) {
System.out.println(item.getAbsoluteFile());
if (item.isDirectory()) listRecursive(item); // Recursive call
PeopleCode
I want to get all the files included in the directory
Local string &SourceDirPath = S1_FS_RDCFG_AET.S1_CHMN_TODO;
Local JavaObject &Javadir = CreateJavaObject("java.io.File", &SourceDirPath);
Local array of any &StrArray;
&ArrayOfAny = CreateArrayAny();
Local JavaObject &JavaFilesArray = CreateJavaArray("java.lang.Object[]", 1024);
&JavaFilesArray = &Javadir.listFiles();
CopyFromJavaArray(&JavaFilesArray, &ArrayOfAny);
==> I alway get the error
Message:
Invalid parameter 1 for function CopyFromJavaArray. (2,116) S1_DSITE_ZIP.MAIN.GBL.default.1900-01-01 .DIRECTOR.OnExecute PCPC:511 Statement:9
I thank you in avance
Edited by: Meapri on Jan 23, 2013 9:33 AM
The Pcode I wrote to Zip Directories
Function AddFileToZip(&sDirSeparator, &zipInternalPath, &fileNameToZip, &zipFileName, &outFileStream, &zipStreamOut)
Local JavaObject &file = CreateJavaObject("java.io.File", &fileNameToZip);
Local JavaObject &inFileStream = CreateJavaObject("java.io.FileInputStream", &fileNameToZip);
Local JavaObject &zipEntry = CreateJavaObject("java.util.zip.ZipEntry", &fileNameToZip);
REM ** Créer le flux de sortie de données pour le fichier ZIP final;
REM ** We will read &fileNameToZip into a buffer and write it out to &zip;
Local string &ZippedfileName = &zipInternalPath | &sDirSeparator | &zipFileName;
REM ** Make sure zip entry retains original modified date;
&zipEntry.setTime(&file.lastModified());
&zipStreamOut.putNextEntry(&zipEntry);
Local JavaObject &buf = CreateJavaArray("byte[]", 1024);
Local number &byteCount;
&byteCount = &inFileStream.read(&buf);
While &byteCount > 0
&zipStreamOut.write(&buf, 0, &byteCount);
&byteCount = &inFileStream.read(&buf);
End-While;
&inFileStream.close();
MessageBox(0, "", 99000, 0, "Zipped File : " | &fileNameToZip);
End-Function;
Function getDirContent(&sDirSeparator, &parentFolder, &zipFileName, &outFileStream, &zipStreamOut)
MessageBox(0, "", 99000, 0, "Directory to scan : " | &parentFolder);
Local JavaObject &Folder = CreateJavaObject("java.io.File", &parentFolder);
Local JavaObject &jItems = &Folder.list();
/* Transformation en Array Pcode*/
Local array of any &items = CreateArrayAny();
Local number &idx = 1;
&items [&jItems.length] = Null;
CopyFromJavaArray(&jItems, &items);
For &idx = 1 To &jItems.length
Local string &Entry = &parentFolder | &sDirSeparator | &items [&idx];
Local JavaObject &FileOrFolder = CreateJavaObject("java.io.File", &Entry);
If &FileOrFolder.isDirectory() Then
getDirContent(&sDirSeparator, &Entry, &zipFileName, &outFileStream, &zipStreamOut);
Else
AddFileToZip(&sDirSeparator, &parentFolder, &Entry, &zipFileName, &outFileStream, &zipStreamOut);
End-If;
End-For;
End-Function;
Local string &RootName = "C:\TEMP\TEST";
Local string &sDirSeparator = "\";
REM ** Create Output Zip File ;
Local string &ZipFileName = &RootName | &sDirSeparator | "Temp2_Zip.zip";
Local JavaObject &OutFileStream = CreateJavaObject("java.io.FileOutputStream", &ZipFileName, True);
Local JavaObject &zipStreamOut = CreateJavaObject("java.util.zip.ZipOutputStream", &OutFileStream);
REM ** Create Zip File Entries found in the directory;
getDirContent(&sDirSeparator, &RootName, &ZipFileName, &OutFileStream, &zipStreamOut);
REM Close Output Zip File ;
&zipStreamOut.close();Edited by: Meapri on Feb 2, 2013 10:54 AM : copy and paste code that works!
Edited by: Meapri on Feb 2, 2013 10:56 AM
Edited by: Meapri on Feb 2, 2013 11:02 AM
Similar Messages
-
SQL Backup fails with error 87 parameter incorrect
I have a SQL Server 2008 R2 SP2 Standard instance working great, except upon attempts to use SQL backup to a UNC path hosted on Server 2012 R2, backup jobs fail with error 87 (the parameter is incorrect). When backing up to Server 2008 R2 and Server 2012
shares, everything seems to work normally.
Any experience with something like this? I've verified perms to the path and reachability in general, and it's clearly not an access denied error (which I've seen before).Thanks Alberto - I've verified that user (it's a domain user) has full access perms on that path, and tested outside of SSMS.
Detailed error:
System
- Provider
[ Name] MSSQLSERVER
- EventID 18210
[ Qualifiers] 49152
Level 2
Task 6
Keywords 0x80000000000000
- TimeCreated
[ SystemTime] 2014-05-13T15:57:52.000000000Z
EventRecordID 2083317
Channel Application
Computer GriffinSQL.[local domain here]
- Security
[ UserID] [guid here]
- EventData
BackupIoRequest::ReportIoError
write
\\storage\backups\sql\testggg.bak
87(The parameter is incorrect.)
22470000100000000B0000004700520049004600460049004E00530051004C00000000000000
Binary data:
In Words
0000: 00004722 00000010 0000000B 00520047
0008: 00460049 00490046 0053004E 004C0051
0010: 00000000 0000
In Bytes
0000: 22 47 00 00 10 00 00 00 "G......
0008: 0B 00 00 00 47 00 52 00 ....G.R.
0010: 49 00 46 00 46 00 49 00 I.F.F.I.
0018: 4E 00 53 00 51 00 4C 00 N.S.Q.L.
0020: 00 00 00 00 00 00 ...... -
NW BI-JAVA 7.01 SP6 deployment failed with error main_rules.ept
Dear all,
I've installed a new Web AS JAVA instance 7.01 SR1 with usage type BI-JAVA
I then patched this instance with SP6
At the end of the deployment process, I got a message from JSPM stating that the deployment failed but all the components had the status deployed.
I pushed further the investigation and found out in the file main_rules.ept.log the following problem
PCD auto-import file main_rules.ept in no-overwrite-mode ...FAILED
Import failed.
Object ID: pcd:portal_content/administrator/super_admin/main_rules
Transport File: D:\usr\sap\JD2\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\deployment\pcdContent\no_overwrite\main_rules.ept
at com.sapportals.portal.pcd.gl.transport.PcdGlTransportManager.handleXmlException(PcdGlTransportManager.java:984)
< a lot of error messages here ... taken out for the sake of clarity>
Original exception:
java.lang.NullPointerException
Though, the portal application is up and running! What can be the consequences of such an error? How to correct it?Hi everyone
I had the same problem as you. After the deployment of SP6 JSPM told me that there was an error during portal deployment although all components had the status "Deployed" (newly installed system).
PCD auto-import file main_rules.ept in no-overwrite-mode ...FAILED
Import failed.
Object ID: pcd:portal_content/administrator/super_admin/main_rules
I opened a customer message @SAP:
The solution is to rename the file "main_rules.ept.err" into "main_rules.ept" and restart the J2EE engine. If the file main_rules.ept was renamed to main_rules.ept.bak after the restart everything is OK acc. to SAP (-> note 1130469 ).
Best regards
Nik -
The task failed with error: Invalid BPM Object context key, can any one hel
The application works fine on version 5.7. I am trying to migrate to 10.3 angetting the error when tried to execute task. This is coming up from opening a jsp page; don't know exact code/line number as the error message is in a popup window and doesn't show it clearly in logs:
The task could not be successfully executed. Reason: 'fuego.xobject.util.InvalidContextKey: Invalid BPM Object context key'.
See log file for more information [Error code: workspace-1255544311265]
The log shows the below starting from just before the error upto the complete error msg:
ExecutionDispatcher.actionId: RUN_INSTANCE_TASK
WamJsp: commit prepare.
java.lang.NullPointerException
java.lang.NullPointerException
at fuegoblock.net.NewJSP$1.prepare(NewJSP.java:185)
at fuego.web.execution.InteractiveInvocation.retryExecution(InteractiveInvocation.java:72)
at fuego.web.execution.InteractiveExecution.retry(InteractiveExecution.java:246)
at fuego.web.papi.TaskExecutor.runInstanceTask(TaskExecutor.java:375)
at fuego.web.papi.TaskExecutor.execute(TaskExecutor.java:98)
at fuego.workspace.servlet.ExecutorServlet.doAction(ExecutorServlet.java:117)
at fuego.workspace.servlet.BaseServlet.doPost(BaseServlet.java:229)
at fuego.workspace.servlet.BaseServlet.doGet(BaseServlet.java:220)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at fuego.workspace.servlet.AuthenticatedServlet.service(AuthenticatedServlet.java:83)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at sun.reflect.GeneratedMethodAccessor201.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Unknown Source)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
at fuego.web.filter.SingleThreadPerSessionFilter.doFilter(SingleThreadPerSessionFilter.java:64)
at fuego.web.filter.BaseFilter.doFilter(BaseFilter.java:63)
at sun.reflect.GeneratedMethodAccessor94.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Unknown Source)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:217)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
at fuego.web.filter.CharsetFilter.doFilter(CharsetFilter.java:48)
at fuego.web.filter.BaseFilter.doFilter(BaseFilter.java:63)
at sun.reflect.GeneratedMethodAccessor94.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Unknown Source)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:217)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
Unexpected Error:The task could not be successfully executed.
Reason: 'fuego.xobject.util.InvalidContextKey: Invalid BPM Object context key'.
Can any one please help?
JavedHi Javed,
I'm having similar error. What was the root cause of your problem? How did you fix that?
Thanks,
Bharat -
Disc erase failed with error invalid request
HI,
I'm trying to get a new 2.5tb external wd hard drive to work with both my mac and my old pc - so i can backup my old data from the pc.
i have tried using disc utility, and erasing the disk and reformating to ms-dos (fat) format and recieve the following error message:
Disk erase failed with the following request: invalid request
i have also tried partitioning the hard drive, and recieve the same error message.
Any ideas on how to re-format this device?
Thanks!Had to reply just to say this.
Thank you Webdva
- OSX Yosemite -
Dynamic Select query is failing with error "Invalid Table Name"
OPEN rc FOR 'SELECT count(*) from :s' USING tab_name;
fetch rc into rec_count;
CLOSE rc;
my requirement is to build dynamic select query to retrieve the total count of rows in each table ( variable tab_name contains the table_name )
But I am getting stuck by this errror, not sure if there is any alternative !
ORA-00903: invalid table name
ORA-06512: at line 43OPEN rc FOR 'SELECT count(*) from '||tab_name;
fetch rc into rec_count;
CLOSE rc;
-- This will work
1. Create a sql statement.
2. Open ref cursor for that statement. -
Hi,
I run the following command:
PS C:\Users\Administrator> Set-PhysicalDisk -FriendlyName PhysicalDisk0 -MediaType SSD
Set-PhysicalDisk : A parameter cannot be found that matches parameter name 'MediaType'.
At line:1 char:46
+ Set-PhysicalDisk -FriendlyName PhysicalDisk0 -MediaType SSD
+ ~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-PhysicalDisk], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Set-PhysicalDisk
PS C:\Users\Administrator>
As you can see, it errors out, as if MediaType doesn't exist. Has something changed in this command?Hi,
As you said, it seems like MediaType is not supported as a parameter.
What's the OS version? It should be available in Windows Server 2012 R2, Windows 8.1 or PowerShell 4.0 installed.
In my Windows Server 2012 R2 it is supported.
Please provide the result of $PSVersionTable for comparing. Here is my version:
Name Value
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.34014
BuildVersion 6.3.9600.17400
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2
Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Support, contact [email protected] -
How to call a C function calling a Java Method from another C function ?
Hi everyone,
I'm just starting to learn JNI and my problem is that I don't know if it is possible to call a C function calling a Java Method (or doing anything else with JNI) from another C function.
In fact, after receiving datas in a socket made by a C function, I would like to create a class instance (and I don't know how to do it too ; ) ) and init this instance with the strings I received in the socket.
Is all that possible ?
Thank you very much for your help !Hard to understand the question, but by most interpretations the answer is going to be yes.
You do of course understand that JNI is the "API" that sits between Java and C and that every call between the two must go through that. You can't call it directly. -
I have a SSIS project that I am newly running on the SQL server (2005) . It was previously run on my PC. I am importing data from a DB2 server to the SQL server.
I am in the SA group on the server
My connection to DB2 works
When open the package and run it in preview mode, I can retrieve the data.
When I execute the package I get the below errors:
[MIDAS OLE DB Source [1]] Error: The AcquireConnection method call to the connection manager "NGMDSPA.alharris" failed with error code 0xC0202009.
[DTS.Pipeline] Error: component "MIDAS OLE DB Source" (1) failed validation and returned error code 0xC020801C.
What I have already done that has not worked:
The original Protection level was set to EncryptSensitiveWithPassword.
I have reset the Package Password.
I have set the protection level to DontSaveSensitive
I saved the package on the server and set a Package Password.
I created a new package, set the Protection level to DontSaveSensitive, set a package password in a configuration file using the Package Configuration Wizard.
Error continuesYes. The Drivers are installed and I have a successfull connection. I am trouble shooting the issue on the server in BIDS. I can connect to the DB2 server via the Connectionmanager. I can also preview the data in the OLE
DB source connection. Therefore I know that I have a proper connection
If you're setting option as DontSaveSensitive then you need to pass the connection information from configuration file/ config table. Otherwise it wont be able to use it for connecting to your source/destination servers. This is the recommended way as it
will enable you to change connection info at runtime.
If you want connection info to persist you need to use protection level as EncryptSensitiveUsingUserKey or EncryptSensitiveUsingPassword and set a password.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
The AcquireConnection method call failed with error code 0xC0202009.
I've seen the previous threads on this (although maybe not all of them). However, i don't think I'm getting the error for the same reason. The full error I'm getting is:
- Pre-execute (Error)
Messages
Error 0xc0202009: {F1B3B35C-FAE3-48F6-A169-4E4D8D99F9B6}: An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft JET Database Engine" Hresult: 0x80004005 Description: "Unspecified error".
(SQL Server Import and Export Wizard)
Error 0xc020801c: Data Flow Task: The AcquireConnection method call to the connection manager "DestinationConnectionExcel" failed with error code 0xC0202009.
(SQL Server Import and Export Wizard)
Error 0xc004701a: Data Flow Task: component "Destination 64 - production_effectivities" (7042) failed the pre-execute phase and returned error code 0xC020801C.
(SQL Server Import and Export Wizard)
The entire package is running on one machine. The data source is SQL Server 2005 and the destination (this happens with both of them) is Excel or Access. Either way I cannot get the package which the wizard generated to run at all. This error occurs after the first table is exported. I'm running on WinXP SP2 with 2005 Developer and ALL components installed except analysis services.
Anyone else have this problem or know the solution?
JeffI am getting the same error. My Destination and source both are on SQL Server 2005 on the same box.
I am using SQL- Code for Source and and table as destination. When the package runnes under Transaction- TransactionOption-Supported then the packages excuted fine but it fails when i change the Transaction- TransactionOption to Required.
It fails with following error code.
[OLE DB Destination [22]] Error: The AcquireConnection method call to the connection manager "FMFCLSQADB01.DWH_Rakesh" failed with error code 0xC0202009.
[DTS.Pipeline] Error: component "OLE DB Destination" (22) failed the pre-execute phase and returned error code 0xC020801C.
[Connection manager "FMFCLSQADB01.DWH_Rakesh"] Error: The SSIS Runtime has failed to enlist the OLE DB connection in a distributed transaction with error 0x8004D00A "Unable to enlist in the transaction.".
[Connection manager "FMFCLSQADB01.DWH_Rakesh"] Error: An OLE DB error has occurred. Error code: 0x8004D00A.
When i change the source SQL query to Table or View then it works fine.
Thanks for any suggestion.
Regards
Rakesh
Now, my issues related to “SSIS Runtime has failed to enlist the OLE DB connection in a distributed transaction with error 0x8004D00A "Unable to enlist in the transaction."…..”. are fixed.
This is one of the very common errors that comes up in SSIS (SQL Server Integration service)
I have faced this issue for at-least two occasions. Both of them have one common setting: “TransactionOption” was set to “Required”.
In first case, I had multiple dataflow tasks but there were no sequence given. There were no error if I ran the package with TransactionOption=Supported. But when I ran the package in TransactionOption= Required, it got failed.
To fix the issue I have changed my package and put the entire dataflow task one after another (connected thru Constraint).
In another case, where I was doing data transfer from one server to another, I had to configure the MSDTC. -
Internal warning: Decryption failed with error
OK, yesterday I did not receive this error when running this Job and all my other projects run fine and access the same Data Sources.
So why then am I receiving this error. I have checked the Data Sources for this job and all seem fine. I have rebooted my PC.
Sometimes when I run this Job trying to figure out the error it will give me an additional message that it cannot communicate with the data flow. (see second message)
5892 5336 RUN-305004 1/25/2012 10:22:26 AM |Session P2CFI03_JOB_1_VENDOR
5892
5336 5336 RUN-305004 1/25/2012 10:22:26 AM Internal warning: Decryption failed with error <Invalid message digest for data.>.
5892 5336 CON-120302 1/25/2012 10:22:26 AM |Session P2CFI03_JOB_1_VENDOR
5892
5336 5336 CON-120302 1/25/2012 10:22:26 AM ODBC call <SQLDriverConnect> for data source <mintoerpdw> failed: <[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed
5892 5336 CON-120302 1/25/2012 10:22:26 AM for user 'erp_migration'.>. Notify Customer Support.
2592 3260 RUN-050406 1/25/2012 9:54:43 AM |Session P2CFI03_JOB_1_VENDOR|Data flow New_DataFlow55
2592 3260 RUN-050406 1/25/2012 9:54:43 AM Data flow <New_DataFlow55> received a bad system message. Message text from the child process is < >. The process executing
2592 3260 RUN-050406 1/25/2012 9:54:43 AM data flow <New_DataFlow55> has died abnormally. For NT, check errorlog.txt. For HPUX, check stack_trace.txt. Also, notify
2592 3260 RUN-050406 1/25/2012 9:54:43 AM Technical Support.
2592 3260 RUN-050409 1/25/2012 9:54:43 AM |Session P2CFI03_JOB_1_VENDOR
2592 3260 RUN-050409 1/25/2012 9:54:43 AM The job process could not communicate with the data flow <New_DataFlow55> process. For details, see previously logged error
2592 3260 RUN-050409 1/25/2012 9:54:43 AM <50406>.Can anyone help with this?
-
How to call the java method in java script function in a portal application
Hi Friends,
I am developing one application where i need to fetch the data from KM content and displaying it on the screen in regular interval. I wrote one method in JSPdynpage for fetching data from KM content now I need to call that java method in java script function.
java method(IComponentRequest request)
//Coode for fetching the KM content
function()
<b>//Need to call the java method</b>
setTimeout(function, 5000);//setting the time interval for this function
<<htmlb display code>>
If anybody can help me in calling the java method in java script function that will be very helpful for me.
Thanks in advance,
Sandeep BonamHi,
Pls see if the following links could help.
http://www.rgagnon.com/javadetails/java-0170.html
http://www-128.ibm.com/developerworks/library/wa-resc/?dwzone=web
Regards -
How to call a java method in a Stored procedure
Hi.,
I was trying to call a method in a stored procedure
This was my procedure
CREATE OR REPLACE PROCEDURE proc_copy_file(sr_file VARCHAR2,dt_file VARCHAR2)
AS LANGUAGE JAVA
NAME 'FileCopy.copyfile(String,String)'; // calling a java method
/ this was my java method
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "FileCopy" as
import java.io.File;
import java.io.IOException;
import java.io.FileReader;
import java.io.FileWriter;
import javax.imageio.stream.FileImageInputStream;
import javax.imageio.stream.FileImageOutputStream;
import java.security.AccessControlException;
public class FileCopy {
// Define variable(s).
private static int c;
private static File file1,file2;
private static FileReader inTextFile;
private static FileWriter outTextFile;
private static FileImageInputStream inImageFile;
private static FileImageOutputStream outImageFile;
// Define copyText() method.
public static void copyfile(String fromFile,String toFile) throws AccessControlException
// Create files from canonical file names.
file1 = new File(fromFile);
file2 = new File(toFile);
// Copy file(s).
try
// Define and initialize FileReader(s).
inTextFile = new FileReader(file1);
outTextFile = new FileWriter(file2);
// Read character-by-character.
while ((c = inTextFile.read()) != -1) {
outTextFile.write(c); }
// Close Stream(s).
inTextFile.close();
outTextFile.close(); }
catch (IOException e) {
System.out.println ("-------"); }
// return 1;
public static void main(String[] args){
switch(args.length){
case 0: System.out.println("File has not mentioned.");
System.exit(0);
case 1: System.out.println("Destination file has not mentioned.");
System.exit(0);
case 2: copyfile(args[0],args[1]);
System.exit(0);
default : System.out.println("Multiple files are not allow.");
System.exit(0);
};while i am executing this method i m getting error as
ORA-29531: NO METHOD COPYFILE IN CLASS FILECOPY
ORA-06512: AT "RMVER721.PROC_COPY_FILE", LINE 1could anyone help meLooks like it is a matter of not quite the same namespace for String object.
I can get it to work by the java source containing:
public static void copyfile(java.lang.String fromFile,java.lang.String toFile) throws AccessControlExceptionAnd the PL/SQL source:
NAME 'FileCopy.copyfile(java.lang.String,java.lang.String)'; // calling a java methodSeems like when you just use "String", then the namespace resolving in the java source is not the same as the namespace resolving in the PL/SQL?
Addendum:
You do not need to put java.lang.String in the java source, String will do (java.lang is by default "imported"?)
But in the PL/SQL source java.lang namespace prefix is needed - java.lang is not "imported" here.
Edited by: Kim Berg Hansen on Nov 23, 2011 1:07 PM -
Error
[Load data from excel file [1]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009. There
may be error message
I am using BIDS Microsoft Visual Studio 2008 and running the package to load the data from excel .
My machine has 32 bit excel hence have set property to RUN64BITRUNTIME AS FALSE.
But the error still occurs .
I checked on Google and many have used Delay validation property at Data flow task level to true but even using it at both excel connection manager and DFT level it doesnt work
MudassarThats my connection string
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\SrcData\Feeds\Utilization.xlsx;Extended Properties="Excel 12.0;HDR=NO";
Excel 2010 installed and its 32 bit edition
Are you referring to install this component -AccessDatabaseEngine_x64.exe?
http://www.microsoft.com/en-us/download/details.aspx?id=13255
Mudassar
You can try an OLEDB provider in that case
see
http://dataintegrity.wordpress.com/2009/10/16/xlsx/
you might need to download and install ms access redistributable
http://www.microsoft.com/en-in/download/details.aspx?id=13255
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Rhino calling overloaded Java methods with Array parameters
Has anyone had any problems writing JavaScript code that calls overloaded Java methods?
I have two Java defined methods that differ in the arguments, one takes a string the other takes an array of strings. The problem is calling Java methods within the JavaScript always calls the method with the String argument...
/* Java Code Here */
public void function(String s) { /* Function A */ }
public void function(String[] sa) { /* Function B */ }
/* JavaScript Code Here */
param = java.lang.reflect.Array.newInstance(java.lang.String, 2);
param[0] = "test";
param[1] = "test2";
stringParam = "test3";
/* Both function calls below end up calling the Function A from above */
function(param);
function(stringParam);PS...in case you're not familiar with Rhino,
It is a mozilla package that embeds a JavaScript interpreter within a Java application...
http://www.mozilla.org/rhino/haha...I can't even find my other thread :(
Sorry about the double post...I'll go look for my other thread now
Maybe you are looking for
-
ORA-19505: failed to identify file - RMAN in creating standby DR database.
I got this error when creating standby database at remote target server. ORA-19505: failed to identify file "/backup/dxp1p/online/DXP1P_CF_c-2027711285-20131204-01" Here is what I did: 1. started the listener and created corresponding tnsnames ent
-
Hi, Power button not functioning properly for my iphone 5. Kindly give advice on what to do. Its warranty expired on 22nd november 2013.
-
i was updating my set 3500-c ..bt i disconnected it between the software updatation.so the phone was not updated properly.the phone was working fine as earlier,bt after some hours its display was blank.the phone is still working properly,bt there is
-
Reporting services Installation with Globalization Locale Settings
Hi Guys, We have a problem in report Subscription using File share date format rendering.The File share works properly.But the data showing in Subscription "pdf" like Date format not displaying properly based on different countries. It alwa
-
Flex plugins for NetBeans and JBuilder
There seems to be plugins only for Eclipse. How about NetBeans and JBuilder. Eclipse seems to have some serious memory leak problems.