Java works stand alone does not when called from PL/SQL
I have this piece of code, which works as a standalone program: It takes in the en_var and returns a path.
But it wont work when called from a store procedure the line of code p = rt.exec("echo "+envar); returns a path as a standalone program returns null when called from a Oracle store procedure.
Thanks for any help just going around and round in circles.
import java.util.*;
class translate
public static String translatePath(String envar)
Runtime rt = Runtime.getRuntime();
int bufSize = 4096;
byte buffer[] = new byte[bufSize];
String path = null;
Process p = null;
String os = null;
String name = null;
String home = null;
String dir = null;
SecurityManager sm = null;
int len = 0;
try
System.out.println("Calling echo "+envar);
os = System.getProperty("os.name");
name = System.getProperty("user.name");
home = System.getProperty("user.home");
dir = System.getProperty("user.dir");
sm = System.getSecurityManager();
p = rt.exec("echo "+envar);
BufferedInputStream bis = new BufferedInputStream(p.getInputStream());
while ((len = bis.read(buffer, 0, bufSize)) != -1)
System.out.write(buffer, 0, len);
path = new String(buffer);
//p.waitFor();
bis.close();
return path;
catch(Exception e)
System.out.println("Exception "+e);
return "ProcessProblem";
//path = "/rims/live/log";
Still cant get it to work, it doesnt fall over anymore, but when I input $PATH, it will output $PATH instead of the path for $PATH i.e /rims/live: What does your program output please:
Here is my code:
import java.io.*;
import java.util.*;
class translate
public static String translatePath(String envar)
Runtime rt = Runtime.getRuntime();
Process p = null;
String echoOutput = null;
int len = 0;
try
System.out.println("Calling echo "+envar);
p = rt.exec(new String[]{"/bin/echo",envar});
InputStreamReader isr = new InputStreamReader(p.getInputStream());
BufferedReader br = new BufferedReader(isr);
echoOutput = br.readLine();
br.close();
isr.close();
return echoOutput;
catch(Exception e)
System.out.println("Exception "+e);
return "ProcessProblem";
//path = "/rims/live/log";
Thanks for all your help so far.
Tony
Similar Messages
-
Wifi works at home but not when away from home
My Wifi works at home but not when away from home, what is wrong? I thought with a phone plan I didn't need to have a wifi connection.
You either need WiFi or Cellular (or both). If you have neither, you can't connect to the internet.
Most people use WiFi at home and Cellular while away from home, or connect to public WiFi networks where there are some. -
UIImpersonator tests work in FlashBuilder, but not when run from Ant
I'm in the process of converting a Flex 3 project to use FlexUnit4 tests.
Everything compiles in Flashbuilder 4.5 and runs nicely. I've converted all the tests
to use flexunit 4, which highlighted a few issues, but nothing too major, and all the
tests now pass when run in Flashbuilder.
So... now, I'm trying to convert the CI build to use the 4.5 SDK and flexunit4. So far,
so good. Everything runs and I get a nicely formatted JUnit report. Unfortunately, though,
any test that uses the UIImpersonator fails with an async method timeout, suggesting that
the CreationComplete event hasn't fired.
Here's a typical example of one of my UI test cases:
[Test(async, ui)]
public function testAvailableProductsSetupAdminForSell() : void {
var view:OrderBasketView = new OrderBasketView();
var user:CfxUser = new CfxUser();
user.admin = true;
ModelLocator.instance.userDetails = user;
view.buyOrSell = OrderType.SELL;
helper.createComponentAndAddListener(view, this, availableProductSetupAdminForSellCreationComplete);
private function availableProductSetupAdminForSellCreationComplete(event:Event, view:OrderBasketView) : void {
Assert.assertTrue(view.availableProductTypes.contains(ProductType.PRODUCT_1));
Assert.assertTrue(view.availableProductTypes.contains(ProductType.PRODUCT_2));
Assert.assertTrue(view.availableProductTypes.contains(ProductType.PRODUCT_3));
and helper.createComponentAndAddListener looks like this:
public function createComponentAndAddListener(view:UIComponent, testCase:Object, creationComplete:Function) : void {
_view = view;
_view.addEventListener(FlexEvent.CREATION_COMPLETE, Async.asyncHandler(testCase, creationComplete, 4000, _view));
UIImpersonator.addChild(_view);
If I use FlexGlobals.topLevelApplication.parent.addChild(_view) in place of UIImpersonator.addChild(_view), all the tests pass.
I was wondering if it's a function of the fact that my helper class has no metadata that indicates it's a ui test, but that wouldn't explain why it works in FlashBuilder and not when run with ant.
I also wondered if it was a function of running with headless server set to true, but when I changed it to false the same thing happened.
My environment is:
ubuntu 11.04
ant 1.7.1
Sun jdk 1.6.0_26
Flex SDK 4.5.1.21328
FlexUnit 4.1.0-8-4.1.0.16076
I'm using the auto-generated TestRunner.mxml
Any thoughts, anyone? Now that I can get it to work by adding the UI components to the topLevelApplication, at least I can make progress, but I'd like to get to the bottom of the problem, because that shouldn't be necessary.
Thanks in advance,
-ChrislChanging to the topLevelApplication did not work. What's funny is that it then failed on a completely unrelated test by hanging and never returning... I'm thinking there must be something else that is going on here, but it's not clear what... :-/ Here is an example of my setup/teardown and a test that work great in the UI but not in CI...
[Before(async, ui)]
public function setUp():void
_fromToList = new FromToList();
_fromToList.setStyle('skinClass', FromToListSkin);
Async.proceedOnEvent(this, _fromToList, FlexEvent.CREATION_COMPLETE, 1000);
FlexGlobals.topLevelApplication.parent.addChild(_fromToList);
// UIImpersonator.addChild(_fromToList);
[After(ui)]
public function tearDown():void
FlexGlobals.topLevelApplication.parent.removeChild(_fromToList);
// UIImpersonator.removeChild(_fromToList);
_fromToList = null;
[Test(async)]
public function should_remove_selected_item_in_to_list_to_from_list():void
_fromToList.fromArrayList = _dpArray;
_fromToList.toArrayList = _toDpArray;
var sequence:SequenceRunner = new SequenceRunner(this);
sequence.addStep(new SequenceSetter(_fromToList.toList, { selectedItem: _toDpArray[1]}));
sequence.addStep(new SequenceWaiter(_fromToList.toList, FlexEvent.VALUE_COMMIT, 100));
sequence.addStep(new SequenceCaller(_fromToList, _fromToList.remove));
sequence.addStep(new SequenceWaiter(_fromToList, FromToListChangeEvent.FROM_TO_LIST_CHANGE_EVENT, 100));
sequence.addAssertHandler(handleListHasChangedThenRemoveEvent, {});
sequence.run();
private function handleListHasChangedThenRemoveEvent(event:FromToListChangeEvent, passThruData:Object):void
assertThat(_fromToList.toArrayList.length, equalTo(_toDpArray.length - 1));
assertThat(_fromToList.fromArrayList.length, equalTo(_dpArray.length - _toDpArray.length + 1));
assertTrue(_fromToList.fromArrayList.contains(_toDpArray[1]));
So you can see that I'm using Sequences to manage waiting for stuff to get updated in the background, and basically testing when I select an item in a list and act on it that it updates the model like I expect. Again, works GREAT in the UI Runner.
I'm open to suggestions... -
Procedure runs in SQL Plus, but not when called from my Oracle Form
Hi. I have this code to send an email alert as the user updates a record on my base table from my Oracle Form. I use dbms_scheduler so that it's submitted as a background job and so the email processing does not delay my Oracle Form from saving quickly. If I submit this code in SQL Plus it executes and I receive the email as expected.
begin
dbms_scheduler.create_job (
job_name => 'IMMEDIATE_JOB',
job_type => 'PLSQL_BLOCK',
job_action => 'begin TTMS.dropperVacationConflict_Notify (62547, ''01-SEP-11'', ''02-SEP-11''); end;',
number_of_arguments => 0,
start_date => sysdate +1/24/59, -- sysdate + 1 minute
enabled => TRUE,
auto_drop => TRUE,
comments => 'Immediate, one-time run');
end;However if I submit this code from a Post-Update trigger in my form the code runs without error, but my email is never received (the same parameter values would be passed to this trigger):
begin
-- Submit the email notification in the background so as to not slow down the screen while saving.
dbms_scheduler.create_job (
job_name => 'IMMEDIATE_JOB',
job_type => 'PLSQL_BLOCK',
job_action => 'begin TTMS.dropperVacationConflict_Notify (:dropper_vacations.dropper_id, :dropper_vacations.begin_dt, :dropper_vacations.end_dt); end;',
number_of_arguments => 0,
start_date => sysdate +1/24/59, -- sysdate + 1 minute
enabled => TRUE,
auto_drop => TRUE,
comments => 'Immediate, one-time run');
end; Any ideas why this might be happening?Wow, so I changed the two procedures so that I'm only passing in one number parameter and one char parameter...
CREATE OR REPLACE procedure TTMS.job_vacationconflict_notify (p_dropper_id number, p_other char) IS
CREATE OR REPLACE PROCEDURE TTMS.dropperVacationEmailURL_new (in_dropper_id number, in_other char) ISIf I execute it like this it works and I get the email:
TTMS.job_vacationconflict_notify(62547, 99999);or like this it works and I get the email:
TTMS.job_vacationconflict_notify(62547, '99999');But if I execute it like this (I get no errors) the email is not sent:
TTMS.job_vacationconflict_notify(62547, 'ababa');So this problem really has nothing to do with date formats. It seems to have to do with whether parameter two has characters in it!!! What the heck.
Any ideas on this?
Here is the procedure I'm calling:
CREATE OR REPLACE procedure TTMS.job_vacationconflict_notify (p_dropper_id number, p_other char) IS
begin
dbms_scheduler.create_job (
job_name => 'IMMEDIATE_JOB',
job_type => 'PLSQL_BLOCK',
job_action => 'begin TTMS.dropperVacationemailurl_new ('||p_dropper_id||','||p_other||'); end;',
number_of_arguments => 0,
start_date => sysdate +1/24/59, -- sysdate + 1 minute
enabled => TRUE,
auto_drop => TRUE,
comments => 'Immediate, one-time run');
end;
/And the above procedure is calling this procedure which should be sending the email alert:
CREATE OR REPLACE PROCEDURE TTMS.dropperVacationEmailURL_new (in_dropper_id number, in_other char) IS
myguid varchar2(15):=null;
pcm_contact varchar2(3):=null;
guid_contact varchar2(15):=null;
conflict_cnt number(8):=0;
-- Various declarations
PSENDER VARCHAR2(200); -- From
PRECIPIENT VARCHAR2(200); -- To
P_CC_RECIPIENT VARCHAR2(200); -- CC
P_BCC_RECIPIENT VARCHAR2(200); -- BCC
PSUBJECT VARCHAR2(200); -- Subject
PMESSAGE VARCHAR2(6000); -- Message Body
PPARAMETER NUMBER; -- Parameter Value
guid_valid varchar2(15); -- Used to grab the validation value of
-- Grab name details of e-mail targets
cursor targets is
select guid, initcap(first_name) first_name, initcap(first_name)||' '||initcap(last_name) fullname
from pwc_employee
where upper(guid) = upper(guid_contact);
BEGIN
select count(*)
into conflict_cnt
from dropper_bundle_assign
where
dropper_sched = in_dropper_id and
trunc(sched) <> '31-DEC-29' AND
trunc(sched) between '01-SEP-11' and '02-SEP-11' and
trunc(sched) > trunc(sysdate);
select distinct pcm
into pcm_contact
from dropper_bundle_assign
where
dropper_sched = in_dropper_id and
trunc(sched) <> '31-DEC-29' AND
trunc(sched) between '01-SEP-11' and '02-SEP-11' and
trunc(sched) > trunc(sysdate);
select guid
into guid_contact
from pwc_employee
where initials = pcm_contact;
-- Ensure required parameters have been passed
if guid_contact is not null
and in_dropper_id is not null then
Begin
select guid
into guid_valid
from pwc_employee
where upper(guid) = upper(guid_contact);
Exception
when no_data_found then
raise_application_error(-20000,'Invalid Recipient. Please check the employee table. Please try again.');
End;
-- In the event there are multiple targets then we will loop thru and send individual emails
for thisone in targets loop
PSENDER := lower(user)||'@us.ibm.com';
PRECIPIENT := lower(thisone.guid)||'@us.ibm.com';
P_CC_RECIPIENT := lower(thisone.guid)||'@us.ibm.com';
P_BCC_RECIPIENT := 'ssbuechl'||'@us.ibm.com';
PPARAMETER := TO_NUMBER(lower(in_dropper_id));
PSUBJECT := 'TEST: Dropper Vacation '||in_other||' Conflict Notification for dropper '||in_dropper_id||' - Action Required';
PMESSAGE := thisone.first_name||'-<br><br>There is an induction conflict due to a new or updated dropper vacation.<br><br>Click here to the dropper''s vacation conflicts: <u><a href="http://9.35.32.205:7777/forms/frmservlet?config=TTMSMENU&form=dropper_vacations&otherparams=p_dropper='||PPARAMETER||'">Dropper Id: '||PPARAMETER||'</a></u> (note: use your Oracle credentials when prompted for log-on information).<br><br>Thanks.';
SEND_MAIL ( PSENDER, PRECIPIENT, P_CC_RECIPIENT, P_BCC_RECIPIENT, PSUBJECT, PMESSAGE ); -- Procedure to physically send the e-mail notification
end loop;
else
raise_application_error(-20001,'Recipient and Parameter Value are required. Please try again.');
end if;
exception
when no_data_found then
raise_application_error(-20002,'Note: Email will not be sent because no PCM was identified as the manager or the PCM does not have a record in the Employee table. See ITS for assistance.');
when too_many_rows then
raise_application_error(-20003,'Note: Email will not be sent because multiple PCMs manage this dropper. Please notify each PCM manually.');
END dropperVacationEmailURL_new;
/Edited by: sharpe on Aug 17, 2011 4:38 PM
Edited by: sharpe on Aug 17, 2011 5:03 PM -
To run a java program via a batch file,when called from a web server
REM This batch file runs the Spider with the [-v] option.
REM Lines 51 through 54 are simple DOS commands..they call the Spider
REM The location of the Spider package is the important piece of information here...
REM a batch file has access to the whole computer where the server resides.
setlocal
set JDK=C:\j2sdk1.4.1_01
set PATH=%JDK%\bin;.;%PATH%
CLASSPATH=%JDK%\jre\lib\*.jar;.;%JDK%\jre\lib\ext\*.jar;.;%CLASSPATH%
java spiderpackage.EntryPoint -v
endlocal
I am trying to run this batch file from my web server.I can see nothing on my browser.I can run the same program from my machine but unable to run from web server.what should I do?I am making my question more clear...
I have a Windows batch (*.bat) file that echoes some html, then calls a java program the output of which is html as well, then echoes the final html.
To make sure that the java program gets properly executed, I set the necessary environment variables (e.g., JDK, PATH, CLASSPATH, etc.). The script looks something like this:
setlocal
set JDK=path_to_JDK
set PATH=path_to_java
set CLASSPATH=path_to_java_classes
echo ^<html^>^<body^>
call java foo
echo ^</body^>^</html^>
endlocal
The idea, of course, is to call this script through a browser, on a web server.
Curiously, both echo lines return to the browser just fine, but any output from
the java program (which just writes html to STDOUT) does not make it back.
Can someone explain to me why this is happening? How do I set things up so that the output (STDOUT and STDERROR) from the java program make it back to the browser? -
The "Awesome Bar" is not working. It does not recall anything from the Bookmarks
Just updated to new Firefox. In the past, when I would start to type a site in the address bar firefox would complete it as it was already in my bookmarks. But now it does not do anything. It just sits there waiting for me to complete the address. I could start to type Netf and it automatically finish Netflix.com
Why is this happening. Also, for the first couple days of the new version I had to go back into Tools, Options and reset things at least 3 or 4 times before they would finally stay the way I wanted them.
I would tell it Never Remember History and after while I would look and it would say, Remember History. I wanted a Blank Start page, and it kept changing it. It's okay now but the Awesome Bar is not working at all.Do your bookmarks show up in the auto-suggest drop-down list?
''If not:'' Under Options > Privacy, in the bottom section, does it still show that Firefox should suggest Bookmarks in the Location bar?
If auto-suggest works but the autofill isn't happening, you could double-check that it has not been disabled here:
(1) In a new tab, type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
(2) In the search box above the list, type or paste '''autof''' and pause while the list is filtered
(3) If the '''browser.urlbar.autoFill''' preference is bold and "user set" to false, double-click it to switch its value back to the default value of true. That should work in new tabs.
It's it already true, hmm, I wonder whether this is a private browsing issue? (I didn't test with automatic private browsing.) -
Refcursor not returning rows when called from non SQL*Plus IDE or other
Hi all,
I have a very weird problem.
We have recently performed a minor upgrade to our oracle database and are now using:
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE 10.2.0.5.0 Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production
5 rows selected.We have a crystal report selecting data from a refcursor returned by a stored procedure.
The stored procedure updates data when called as well as returning the refcursor in question.
Observe the following test scenario executed in SQL*Plus:
SQL> create table testtab (teststr varchar2(100));
Table created.
Elapsed: 00:00:00.00
SQL> insert into testtab values ('X');
1 row created.
Elapsed: 00:00:00.00
SQL> create or replace procedure testtabproc (p_listcur in out sys_refcursor)
2 as
3 begin
4
5 open p_listcur for
6 select *
7 from testtab
8 where teststr = 'X';
9
10
11 update testtab
12 set teststr = 'Y';
13
14 commit;
15
16 end;
17 /
Procedure created.
Elapsed: 00:00:00.00
SQL> declare
2
3 v_list_cur sys_refcursor;
4
5 type t_out_rec is record (teststr varchar2(100) );
6
7
8
9 v_out_rec t_out_rec;
10
11 v_rec_count number := 0;
12 v_count_limit number := 10000;
13
14 begin
15
16 dbms_output.put_line('about to call proc');
17
18 testtabproc(v_list_cur);
19
20 dbms_output.put_line('about to fetch records');
21
22 fetch v_list_cur into v_out_rec;
23 while v_list_cur%found loop
24 v_rec_count := v_rec_count + 1;
25 if v_rec_count <= v_count_limit then
26 dbms_output.put_line(v_out_rec.teststr);
27 end if;
28 fetch v_list_cur into v_out_rec;
29 end loop;
30 dbms_output.put_line('complete. selected '||v_rec_count||' records.');
31
32
33 end;
34 /
about to call proc
about to fetch records
X
complete. selected 1 records.
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
SQL> select * from testtab;
TESTSTR
Y
1 row selected.
Elapsed: 00:00:00.00
SQL> as you can see, the cursor returns data and the table is updated.
now, our problem is with crystal and also when I use the same test case via another IDE like TOAD.
No data is returned from the list but the table is still updated.
We suspect that something is happening that is causing the table to be updated before the refcursor is opened, or at least before the predicates are applied.
has anyone else encountered this problem before?Tubby wrote:
WhiteHat wrote:
nope - it works from sqlplus itermitantly (i.e. we always get the debug output but the cursor only sometimes fetches the rows).
it is almost as if the commit is being executed before the cursor is opened.
I still havn't been able to reproduce it except with the actual scenario that I am working with...Is the code you are dealing with exactly the same as the skeleton you've posted in your original post? Do you perhaps have a generic exception catcher in there somewhere (perhaps catching and hiding an ORA-01555) when the cursor is being fetched?
Not that i expect it to make any difference, but i'm curious as to why you've declared your cursor as IN / OUT ?
p_listcur in out sys_refcursor
the code structure in the real example is almost identical to that test case I produced - the exception handler is only catering for no_data_found, all other errors should be raised as normal.
edit: sorry I forgot to add - it's in/out because apparently that's what crystal reports needs in order to use the refcursor..... I'm not a crystal guy so I can't be any more specific than that sorry......
Edited by: WhiteHat on Oct 11, 2010 9:34 AM -
VA01 copies texts, but VA02 does not when creating from reference
Hello,
I am having an issue with text determination configuration. It is currently set up to copy some header texts from the quote to the order when an order is created from reference. This works correctly when using transaction VA01 to create an order from reference.
However, the issue arises when using VA02 to create from reference, the items copy over correctly from the quote, but texts and other data do not copy over correctly. Any ideas on why this might be the case?
Thanks,
TonyHi Everyone,
Thanks for your replies. I know the correct way to do this is to use VA01 and Create from reference. However, the way that the order processing group has always done this is to create a "dummy" order using VA01, then use VA02 to "modify" the order by going to menu option Sales Document -> Create with Reference. This has the effect of copying over all items from the quote into the order. However, no sales texts are copied over when this is done. I'm wondering if there is a config that needs to be modified to allow texts to copy over using this method.
When I go into the texts tab in VA02 and display the log, the texts that I need copied over say something like, "Text does not exist". I have a feeling that the text is not copied over because the order does not have a reference to the quote at the time the text determination is evaluated.
Thanks,
Tony -
CommandAction works through OnDeviceDebug, but not when installed from jar
Hi everybody,
I'm trying to run a HelloMIDlet example and if I run it on emulator it works fine, also when I run it on mobile through OnDeviceDebug from eclipse it works fine, but when I install a jar file and run the application it ends with Application Error message and it exits. I found out that the problem might be in the CommandAction method, because when I use this:
public void commandAction(Command c, Displayable s) {
notifyDestroyed();
}then the application works also when installed from jar, but when I use this:
public void commandAction(Command c, Displayable s) {
String label = new String("Exit"); //just for test
if (label.equals("Exit"))
notifyDestroyed();
}then it ends with Application Error right after I run the program (and it works when I use OnDeviceDebug). I'm using jdk1.5.0_06 and WTK from Sony Erricsson (my target device is W800i, which supports CLDC1.1 and MIDP2.0)
My manifest file is
Manifest-Version: 1.0
MicroEdition-Configuration: CLDC-1.1
MIDlet-Name: HelloMIDlet
Created-By: Sun Microsystems Inc.
MIDlet-Vendor: Sun Microsystems, Inc.
MIDlet-1: HelloMIDlet, , HelloMIDlet
MIDlet-Version: 1.0
MicroEdition-Profile: MIDP-2.0
MIDlet-Description: Hello Worldand I don't use the jad file when installing the application (seems to be unecessary when you have a manifest file inside the jar). And I'm unable to debug it because when debugging then it works normally. Also I tried to recompile the BluetoothDemo and the same error(and works through OnDeviceDebug). And when I installed the jar file, which is originally distributed with BluetoothDemo then it worked. When I compared original jar file and my jar file then the only difference was in the size the class files (class files compiled by me were bigger then the class files in original jar file (which work)).
Any ideas guys and girls?I tried that approach but it doesn't work either. I think maybe my directory structure is wrong.
C:\IRS\IRS.jar
C:\IRS\irs.hs
referenced: jar:file://C:/IRS/IRS.jar!/irs.hs
Am I doing this right? -
Java class files works on middle tier but chokes when called from pl/sql
Hi,
I have 2 class files WorkOrder and xxWorkOrder. xxWorkOrder creates an instance of WorkOrder. Both classes are under the /classes directory. Both compile fine and I have used loadjava to upload/resolve both in the database. I can see them as valid under the user_objects table. I created a function using Pl/sql which calls a method in xxWorkOrder. If I remove the line in xxWorkOrder where it creates an instance of WorkOrder, the pl/sql function works fine via sql plus. If I add the line in, it gives me ORA-29532: Java call terminated by uncaught Java exception: java.lang.ExceptionInInitializerError if i run my test again I get a No classdef found error.
If i run the xxWorkOrder class file directly from the server using java, the code works fine with the instantiation of WorkOrder within it.
I'm not sure which step I am missing ? For some reason when the pl/sql function calls the java method in xxWorkOrder and it sees the line where the instance of WorkOrder is created, it chokes.
Please help!
PreetiExceptionInInitializerError means that whatever is being done at the time it occurs is trying to use some class for the first time so that an attempt to initialize that class is occurring and failing. Such a failure typically means that there is code in a static initializer, such as the foo(); in
static SomeType someVarName = foo();
or just any thing within
static { ... }
in the class being initialized which signals an uncaught exception. It's impossible to say why this would be happening in your particular case without seeing the code. Depending on the release you are using there may be more information (such as a backtrace of the original error) in the .trc file. An example of what I am describing in your case would be if the constructor for WorkOrder invoked a method on some class N, where N hadn't previously been used and where N contained
static Class loser = Class.forName('no/such/Class');
In this (admittedly goofy) case you might expect to see in the .trc file a backtrace for the ExceptionInInitializer error with a sub backtrace identified with "Caused by" that starts with a NoClassDefFound exception or the like. This might work outside the server if "no/such/Class" was present there but had not been loaded into the database. -
Works in RSA3 but not when pulling from BI
Hi,
I created a generic dataSource(Function Module) for Bill Of Material. When testing in RSA3 it is working fine. But when pulling data from BI with particular material in the Data Selection, it is saying "No data available". If I am pulling the same with no data selection then it is giving an error message "Job terminated in source system --> Request set to red".
When checked in SM37 I see the following error messages.
No active nametab exists for /SAPAPO/MATKEY DA 300
Job cancelled after system exception ERROR_MESSAGE
Can any body help me on this
Thanks for your help
SubraEvery thing is fine in all these transactions SM58, BD87, & WE05. There is no problem with the connections at all. I replicated many times and the error is always the same.
The error message below is the reason.
No active nametab exists for /SAPAPO/MATKEY
This messsage is not coming when testing in RSA3. Only when pulling the data from BI, this error is happening.
We are not using SAPAPO but still this message is coming up.
thanks
Subra -
Hi there,
I am trying to call dbms_fga dynamically (of sorts) from a package, and I am getting the error as per the title.
I have tried as many ways as i can think of calling this from another package, with similar results each time.
The user/owner of the package has DBA rights, so it doesn't appear to be a permissions issue.
Oracle Version is 11.1.0.6.0 on Suse.
any ideas on this anyone?
Cheers
CODE:
Attempt 1:
PROCEDURE enable_sql_auditing (on_off in boolean default false) is
v_ssql varchar2(900);
cursor c1 is
select table_name
from all_all_tables
where owner=gcv_pkg_owner;
begin
for rec in c1 loop
sys.dbms_fga.add_policy(object_schema =>''|| gcv_pkg_owner ||'',
object_name => ''|| rec.table_name ||'',
policy_name => ''|| rec.table_name || '_AUDIT''',
handler_schema => ''|| gcv_pkg_owner ||'',
handler_module => 'FGA_SQL',
enable => true);
end loop;
end enable_sql_auditing;
Attempt 2:
PROCEDURE enable_sql_auditing (on_off in boolean default false) is
v_ssql varchar2(900);
cursor c1 is
select table_name
from all_all_tables
where owner=gcv_pkg_owner;
begin
for rec in c1 loop
v_ssql := 'begin sys.dbms_fga.add_policy(object_schema =>''' ||gcv_pkg_owner|| ''', object_name => '''||rec.table_name||''', policy_name => '''||rec.table_name||'_AUDIT'', enable => true); end;';
execute immediate (v_ssql);
end loop;
end enable_sql_auditing;Frenchwood wrote:
The user/owner of the package has DBA rights, so it doesn't appear to be a permissions issue.But it is.
DBA is a role.
permissions within PL/SQL have to be directly granted rather than through roles.
i.e. you need to directly grant execute permission on the package to the required user(s). -
Why are Java SASLFactories missing when called via PL/SQL but not from JRE?
Hi
This may be quite a technical point about SASL and JCE Providers etc OR it may just be a question about how Oracle PL/SQL interfaces with Java.
The background is that I am trying to get a Java opensource library to run in Oracle DB - this is for specialized communication from Database to other servers.
The library uses a SASL mechanism to authenticate with the server and this (appears) to rely on JCE Providers installed and provided by the JRE.
I have some Java code working which uses the library - this runs OK in NetBeans/Windows environment and also using Linux/Oracle JRE directly such as:
+# $ORACLE_HOME/jdk/bin/java -classpath "./MyMain.jar:./OtherSupport.jar" package.TestClient+
However it refuses to work (throws a NullPointerException) when called from PL/SQL.
+FUNCTION send_a_message (iHost IN VARCHAR2,+
iPort IN NUMBER,
+iLogin IN VARCHAR2,+
+iPasswd IN VARCHAR2,+
iRecipient IN VARCHAR2,
iMessage IN VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME package.TestClient.sendATextMessage(java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String) return int';
In the Java code this is:
public static int sendATextMessage(String iHost,
int iPort,
String iLogin,
String iPasswd
String iRecipient,
String iMessage)
I've tracked the issue down to there being no SaslClientFactories (via Sasl.getSaslClientFactories()) showing when called from PL/SQL whereas 3 are available when run from within Java directly. This via:
Enumeration<SaslClientFactory> facts = Sasl.getSaslClientFactories();
System.out.println("Found Sasl Factories [" & (facts != null) & "] size[" & Collections.list(facts).size() & "]");
So, is there some aspect of Java initialisation that I'm missing when calling from PL/SQL (which means SASL factories aren't getting loaded into JRE) or is there something different in SASL setup?
Any pointers appreciated.
Thanks
DaveOk, after a bit of reading and general hacking about I have got this working.
What I hadn't initially understood/remembered is that for a Stored Procedure the JVM installed on file system with Oracle isn't actually used - java code is loaded into the database and hence a different set of base functions are available. The following is a good explanation of this http://docs.oracle.com/cd/B14117_01/java.101/b12021/appover.htm#BGBIBDAJ
So "out of the box" the Oracle Database appears to come loaded with only two of the Sun security providers i.e. no com.sum.security.SASL
>
OBJECT_NAME OBJECT_TYPE STATUS TIMESTAMP
com/sun/security/auth/NTSid JAVA CLASS VALID 2013-02-14:14:08:57
com/sun/security/jgss/GSSUtil JAVA CLASS VALID 2013-02-14:14:08:57
>
This is from:
>
SELECT
object_name,
object_type,
status,
timestamp
FROM
user_objects
WHERE
(object_name NOT LIKE 'SYS_%' AND
object_name NOT LIKE 'CREATE$%' AND
object_name NOT LIKE 'JAVA$%' AND
object_name NOT LIKE 'LOADLOB%') AND
object_type LIKE 'JAVA %' AND
object_name LIKE 'com/sun/security%'
ORDER BY
object_type,
object_name;
>
My solution (which may well be a work-around) is the following:
1) Downloaded JDK Source and extracted "com.sun.security.sasl" java code to my project
2) Added following code to my Stored Procedure ()
>
Enumeration<SaslClientFactory> saslFacts = Sasl.getSaslClientFactories();
if (!saslFacts.hasMoreElements()) {
System.out.println("Sasl Provider not pre-loaded");
int added = Security.addProvider(new com.sun.security.sasl.Provider());
if (added == -1) {
System.out.println("Sasl Provider could not be loaded");
System.exit(added);
else {
System.out.println("Sasl Provider added");
>
3) Built my JAR file with the sasl package embedded (note: could only find Java 6 code, so had to comment out some GSS lines - but wasn't intending to use these)
4) Loaded JAR to oracle via "loadjava".
5) Add permissions (only found this out after a couple of failed runs)
>
call dbms_java.grant_permission('XMPP', 'SYS:java.security.SecurityPermission', 'putProviderProperty.SunSASL', '' );
call dbms_java.grant_permission('XMPP', 'SYS:java.security.SecurityPermission', 'insertProvider.SunSASL', '' );
>
6) Run gives the following:
>
Sasl Provider not pre-loaded
Sasl Provider added
...etc...
>
It works!. I confess I'm not sure of the implications of this for multiple calls/performance and if it will need to be added for each stored procedure call - may post back.
For completeness I should point out that after my load the Security providers look like this:
>
OBJECT_NAME OBJECT_TYPE STATUS TIMESTAMP
com/sun/security/auth/NTSid JAVA CLASS INVALID 2013-02-15:09:11:36
com/sun/security/jgss/GSSUtil JAVA CLASS INVALID 2013-02-15:09:11:37
com/sun/security/sasl/Provider JAVA CLASS VALID 2013-02-15:10:03:21
>
i.e. the original couple are "INVALID" !
Dave
Edited by: 946763 on Feb 26, 2013 2:35 AM -
My iphone 4 does not register calls made to it. if i make a call from another phone, i can hear it ringing, but it does not register on the iphone. also, i do not get any messages when this happens. then after a day or two it decides to start working.
Clean iPhone charging port with clean dry toothbrush. See if better. If still problem clean charging port again with toothbrush and small amount of Isopropyl Alcohol.
-
Stored Procedure Does Not Run Properly When Called From Portlet
We have a simple Java portlet that calls a PL/SQL stored procedure which we wrote. The stored procedure sends a large number of emails to users in our corporation using the "utl_smtp" package. The stored procedure returns a count of the emails back to the Java portlet when it's finished. This number is displayed in the portlet.
Our problem:
The stored procedure functions as expected when run from a PL/SQL block in SQL*Plus, and the Java portlet calls the procedure properly when sending out a smaller number of emails (Less than 200 usually). When we get into a higher number of emails the procedure hangs when called from the portlet, but it STILL functions properly from SQL*Plus. It does not return the number of emails sent
and the Java portlet is unable to return a SQLException. Also, we have noticed that emails are sent at a much slower pace from the stored procedure when it's called from the portlet.Any Ideas?
Maybe you are looking for
-
MacBook Pro (late 2011) restarts suddenly and safari quits unexpectedly
Hi. I've a macbookook Pro (Late 2011) 10.8.4 mountain lion. Safari unexpectedly quits and if not that, my macbook restarts without notice and sometimes a black screen with white text appears so it fails to restart. I went on disk utility to repair my
-
I want to save a document created in Pages and can't login to iCloud.
I want to save a document created in Pages and can't login to iCloud.
-
Need to update my iPad 2 which I cannot because the the 'Software Update' that should be available in Settings > General<is not. Advice please...?
-
IPod refusing to play track...
So I've just bought the remastered "My Life In The Bush Of Ghosts" CD by Brian Eno and David Byrne. I imported it into iTunes without problem and the album plays fine. However, once downloaded onto my iPod, it refuses to play the first track, "Americ
-
Linking Skype and Microsoft ID
I was struggling to link these two. I followed the directions in the website but that does not help. it says login with MS account. there will be a option says i have skype account as well but that startup wizard kinda screen does not pop up. it goes