RMI call to java in Oracle 8i
We need to access stored Java classes inside the Oracle 8i (8.1.7) database using RMI from a remote machine. Is this possible? How?
Basically we have stored PL/SQL procedures/packages we want to create interfaces for (Using JPiblisher) and access them remotely via RMI.
We need to access stored PL/SQL packages from outside the database via RMI. That's the requirement. First we need to wrap the PL/SQL packages with Java classes (JPublisher can help us here). Then there are, in my opinion, three possible ways to achieve this:
- direct Java RMI calls
- CORBA
- EJB
Because I need to evaluate all ways, I am just trying the 1st ( I know, not scalable) way - direct RMI calls. I can do a direct RMI call from the database to an outside server. That works fine. My problem is the other way round, to call an object inside 8i. I understand that using CORBA or EJB the Oracle ORB is used (handled by the TNS Listener). Using a direct RMI call I would need to run the RMIREGISTRY program (inside or outside 8i?)...But I have no clue, how this could work.
Similar Messages
-
Cant Call Stored Java Method Oracle 8I
I have some java code which I have compiled under the package schedsrv which I have loaded in the server with the loadjava facility
I created the procedure link using
create procedure as java using
schedsrv.ClassName.Procedure(java.lang.String, etc
I call the function and the server says no method name exists
for schedsrv/Classname where is the problem
I loaded the java from a .JAR and the classes were in a subdirectory called schedsrv and are in the .jarThis is the wrapper
create or replace procedure CreateScheduleEmp(EMP IN NUMBER, DID IN DATE, ENDD IN DATE) authid definer as language java name 'CreateScheds.processEmployee(java.lang.String,java.SQL.Date,java.SQL.Date)';
Called by
Execute CreateScjeduleEmp(1547,'00-JAN-00','07-JAN-00');
this is the class.
public class CreateScheds {
public CreateScheds() {}
public static void processEmployee(String emp, Date did, Date end) {
try {
CreateSchedules shed = new CreateSchedules();
shed.processEmployee( emp, did, end );
catch ( SQLException e ) {
System.err.println(e.getMessage());
it the class it creates and calls has an abstract base and is extended and completed in CreateSchedule which was written using
SQLJ.
The error I am getting says it can't find the
processEmployee method.
I tried it in a package which failed as well.
This is the class it calls
import java.lang.*;
import java.util.*;
import java.sql.SQLException;
import oracle.sqlj.runtime.Oracle;
import java.sql.Date;
// Note that java.SQL.Date (and not java.UTIL.Date) is being used.
#sql iterator DaySchedItr( String day_off, String start_time, String end_time, String int_type );
public class CreateSchedules extends EmployeeProcessor {
public CreateSchedules() {}
/** Get an agreement for the employee id.
@param emp is an employee_id code
@return the agreement id or null if not found.
@exception SQLException
protected String getAgreement( String emp ) throws SQLException {
String agree;
#sql { SELECT AGREEMENT_ID INTO :agree FROM SCHED.EMPLAGREE WHERE EMPLOYEE_ID=:emp ORDER BY FROM_DATE DESC };
return agree;
/** Get a collection of empldaysched records
@exception SQLException
protected DaySchedItr getDaySched( String agree ) throws SQLException {
DaySchedItr itr;
#sql itr = { SELECT DAY_OFF, START_TIME, END_TIME, INT_TYPE FROM SCHED.DAYSCHED WHERE AGREEMENT_ID=:agree ORDER BY DAY_OFF };
return itr;
/** Insert a single EmplDaysched record
@exception SQLException
protected void insertEmplDaySched( String emp, Date did, DaySchedItr itr ) throws SQLException {
String start_time, end_time, int_type;
start_time = itr.start_time();
end_time = itr.end_time();
int_type = itr.int_type();
int off = Integer.parseInt(itr.day_off(),10);
off--;
#sql { INSERT INTO SCHED.EMPLDAYSCHED(EMPLOYEE_ID, DATE_ID, START_TIME,
END_TIME, INT_TYPE, STATUS)
VALUES( :emp, :did+:off, :start_time, :end_time, :int_type, 1 )
/**public abstract void processEmployee( String emp, Date did, Date end ) throws SQLException;
@param String empl. The employee number employee_id
@param Date The First Date in a series of dates
@param end: The End Date in a series of dates
@return void
@exception SQLException
If the employee is not assigned an agreement nothing happens.
public void processEmployee( String emp, Date did, Date end ) throws SQLException {
String agree;
DaySchedItr itr;
agree = getAgreement(emp);
if ( agree == null )
return;
itr = getDaySched( agree );
while ( itr.next() )
insertEmplDaySched( emp, did, itr );
itr.close();
#sql { COMMIT };
class TheTester3 extends Object {
public static void main(String args[]) throws SQLException {
String emp;
Date did, end;
Oracle.connect(CreateSchedules.class, "connect.properties");
CreateSchedules shed = new CreateSchedules();
emp = "2547";
did = new Date(100,0,1);
end = new Date(100,0,7);
shed.processEmployee( emp, did, end );
//shed.processEmployees( "999987654321", did, end );
//shed.processAllEmployees( "test", did, end );
This is the base class
import java.lang.*;
import java.util.*;
import java.sql.SQLException;
import oracle.sqlj.runtime.Oracle;
import java.sql.Date;
// Note that java.SQL.Date (and not java.UTIL.Date) is being used.
#sql iterator EmplItr ( String employee_id );
#sql iterator GrpItr ( String walloc_string );
/** A base class to process employees
Supports three methodologies for selecting employees
1. Process a single employee for a date range
2. Process all employees having a common walloc string selection
3. Process all employees in an authority group. An authority group
may handle multiple walloc string selections.
public abstract class EmployeeProcessor {
/** Single method that each derived class must implement
public abstract void processEmployee( String emp, Date did, Date end ) throws SQLException;
@param String empl. The employee number employee_id
@param Date The First Date in a series of dates
@param end: The End Date in a series of dates
@return void
@exception SQLException
public abstract void processEmployee( String emp, Date did, Date end ) throws SQLException;
/** Method to extract all employees with a given Group Authority ID
public void processEmployees( String walloc, Date did, Date end ) throws SQLException {
@param String Walloc. The first part of a walloc string only the length of this string is significant
@param Date The First Date in a series of dates
@param end: The End Date in a series of dates
@return void
@exception SQLException
public void processEmployees( String walloc, Date did, Date end ) throws SQLException {
int len = walloc.length();
EmplItr itre;
#sql itre = { SELECT EMPLOYEE_ID FROM SCHED.EMPLPROF WHERE SUBSTR(WALLOC_STR,1,:len)=:walloc };
while ( itre.next() ) {
processEmployee( itre.employee_id(), did, end );
itre.close();
/** Method to extract all employees with a given Group Authority code
public void processAllEmployees( String grp, Date did, Date end ) throws SQLException {
@param String Group. The Group Authority code
@param Date The First Date in a series of dates
@param end: The End Date in a series of dates
@return void
@exception SQLException
public void processAllEmployees( String grp, Date did, Date end ) throws SQLException {
GrpItr itrg;
String walloc;
#sql itrg = { select WALLOC_STRING from sched.USER_GROUPS where authority=:grp };
while ( itrg.next() ) {
walloc = itrg.walloc_string();
walloc = walloc.trim();
processEmployees( walloc, did, end );
itrg.close();
null -
Error calling Java in Oracle Stored Procedure
I can call a java function inside my Oracle Stored Procedure, but if I reference a class that uses JNI, I get problems. I don't know what forum to post this under. This seems the closest match.
Here is my error:
java.lang.NoClassDefFoundError
at AcmeComp.ec.Motor.<init>(Motor.java:35)
at BBOra.runBB(BBOra:13)
Here is my java class, BBOra.java:
import AcmeComp.ec.*;
class BBOra {
static String strCnt;
BBOra() {}
public static void runBB() {
try {
//Motor class is in AcmeComp.ec package
Motor eng = new Motor();
} catch(Exception e) {
System.out.println("Error: " + e);
public static void runNonBB() {
System.out.println("runNonBB works ok.");
From DOS prompt, I loaded ac222ec.jar (has the AcmeComp.ec package) and BBOra.java files into Oracle:
loadjava -u system/manager -resolve -verbose ac222ec.jar.java
loadjava -u system/manager -resolve -verbose BBOra.java
From SQL Plus, I created 2 stored sprocedures:
CREATE OR REPLACE PROCEDURE runBB
AS LANGUAGE JAVA
NAME 'BBOra.runBB()';
CREATE OR REPLACE PROCEDURE runNonBB
AS LANGUAGE JAVA
NAME 'BBOra.runNonBB()';
From SQL Plus, I gave myself permissions to load libraries, so I can load ac222ecjni.dll, which has all the Native (C++) code I use:
BEGIN
DBMS_JAVA.GRANT_PERMISSION('SYSTEM',
'java.lang.RuntimePermission',
'loadLibrary.*');
END;
From SQL Plus, I set up my output:
set SERVEROUTPUT ON;
CALL dbms_java.set_output(3000);
From SQL Plus, I called my Stored Procedures:
CALL runNonBB();
CALL runBB();
runNonBB() works great, but runBB() gives me the error I listed above. The Motor class that BBOra calls, itself calls a class NMotor, which has a call:
static {
System.loadLibrary("ac222ecjni");
Unfortunately, I don't know the inner workings of the native code. Does "at AcmeComp.ec.Motor.<init>(Motor.java:35)"? mean JServer was able to see the class "Motor", but not instatiate it? Or did it error trying to create the class "NMotor"?
Here's a snippet of Motor:
package AcmeComp.ec;
public class Motor implements IMotor {
public Motor() {
motor = new NMotor();
some functions
private NMotor motor;
Here's a snippet of NMotor:
package AcmeComp.ec;
class NMotor {
NMotor() {
sunjdk = true;
some native method declarations
private boolean sunjdk;
static {
//ac222ecjni.dll has all the Native (C++) code
System.loadLibrary("ac222ecjni");
PLEASE HELP ME FIGURE THIS OUT. IT IS KILLING ME. I can even look into the USER_OBJECTS view in Oracle and see that ALL of the classes from the ac222ec.jar are present and accounted for.Man, I guess I figured it out myself. Ten Duke dollars to myself. But, for the sake of anyone who may want to know the answer, here it is:
JServer (or Oracle9i JVM in Oracle 9i) does not support JNI. Here is their (weak) reasoning, taken from "Oracle9i Java Developer's Guide" as found in http://www.csis.gvsu.edu/GeneralInfo/Oracle/java.920/a96656/invokeap.htm#1007948
"Oracle does not support the use of JNI in Oracle9i Java applications. If you use JNI, your application is not 100% pure Java, and the native methods require porting between platforms. Native methods have the potential for crashing the server, violating security, and corrupting data."
Sounds like a fancy way to say they have a limitation--their JVM isn't up to par all the way. If JNI is a feature in Java, why should Oracle decide for me if I should use it? Don't Java methods also have the potential for crashing the server, violating security, and corrupting data? I think they should just provide the functionality you would expect from a VM and let the user decide which functionality to use. In my case, I HAVE to use JNI, so I'd have to use RMI so that a different VM can do the JNI part.
Sounds pretty lame of Oracle, but oh well. -
Java function call from Trigger in Oracle
Moderator edit:
This post was branched from an eleven-year-old long dead thread
Java function call from Trigger in Oracle
@ user 861498,
For the future, if a forum discussion is more than (let's say) a month old, NEVER resurrect it to append your new issue. Always start a new thread. Feel free to include a link to that old discussion if you think it might be relevant.
Also, ALWAYS use code tags as is described in the forum FAQ that is linked at the upper corner of e\very page. Your formulae will be so very much more readable.
{end of edit, what follows is their posting}
I am attempting to do a similar function, however everything is loaded, written, compiled and resolved correct, however, nothing is happening. No errors or anything. Would I have a permission issue or something?
My code is the following, (the last four lines of java code is meant to do activate a particular badge which will later be dynamic)
Trigger:
CREATE OR REPLACE PROCEDURE java_contact_t4 (member_id_in NUMBER)
IS LANGUAGE JAVA
NAME 'ThrowAnError.contactTrigger(java.lang.Integer)';
Java:
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "ThrowAnError" AS
// Required class libraries.
import java.sql.*;
import oracle.jdbc.driver.*;
import com.ekahau.common.sdk.*;
import com.ekahau.engine.sdk.*;
// Define class.
public class ThrowAnError {
// Connect and verify new insert would be a duplicate.
public static void contactTrigger(Integer memberID) throws Exception {
String badgeId;
// Create a Java 5 and Oracle 11g connection.
Connection conn = DriverManager.getConnection("jdbc:default:connection:");
// Create a prepared statement that accepts binding a number.
PreparedStatement ps = conn.prepareStatement("SELECT \"Note\" " +
"FROM Users " +
"WHERE \"User\" = ? ");
// Bind the local variable to the statement placeholder.
ps.setInt(1, memberID);
// Execute query and check if there is a second value.
ResultSet rs = ps.executeQuery();
while (rs.next()) {
badgeId = rs.getString("Note");
// Clean up resources.
rs.close();
ps.close();
conn.close();
// davids badge is 105463705637
EConnection mEngineConnection = new econnection("10.25.10.5",8550);
mEngineConnection.setUserCredentials("choff", "badge00");
mEngineConnection.call("/epe/cfg/tagcommandadd?tagid=105463705637&cmd=mmt%203");
mEngineConnection.call("/epe/msg/tagsendmsg?tagid=105463705637&messagetype=instant&message=Hello%20World%20from%20Axium-Oracle");
Edited by: rukbat on May 31, 2011 1:12 PMTo followup on the posting:
Okay, being a oracle noob, I didn't know I needed to tell anything to get the java error messages out to the console
Having figured that out on my own, I minified my code to just run the one line of code:
// Required class libraries.
import java.sql.*;
import oracle.jdbc.driver.*;
import com.ekahau.common.sdk.*;
import com.ekahau.engine.sdk.*;
// Define class.
public class ThrowAnError {
public static void testEkahau(Integer memberID) throws Exception {
try {
EConnection mEngineConnection = new EConnection("10.25.10.5",8550);
} catch (Throwable e) {
System.out.println("got an error");
e.printStackTrace();
}So, after the following:
SQL> {as sysdba on another command prompt} exec dbms_java.grant_permission('AXIUM',"SYS:java.util.PropertyPermission','javax.security.auth.usersubjectCredsOnly','write');
and the following as the user
SQL> set serveroutput on
SQL> exec dbms_java.set_output(10000);
I run the procedure and receive the following message.
SQL> call java_contact_t4(801);
got an error
java.lang.NoClassDefFoundError
at ThrowAnError.testEkahau(ThrowAnError:13)
Call completed.
NoClassDefFoundError tells me that it can't find the jar file to run my call to EConnection.
Now, I've notice when I loaded the sdk jar file, it skipped some classes it contained:
c:\Users\me\Documents>loadjava -r -f -v -r "axium/-----@axaxiumtrain" ekahau-engine-sdk.jar
arguments: '-u' 'axium/***@axaxiumtrain' '-r' '-f' '-v' 'ekahau-engine-sdk.jar'
creating : resource META-INF/MANIFEST.MF
loading : resource META-INF/MANIFEST.MF
creating : class com/ekahau/common/sdk/EConnection
loading : class com/ekahau/common/sdk/EConnection
creating : class com/ekahau/common/sdk/EErrorCodes
loading : class com/ekahau/common/sdk/EErrorCodes
skipping : resource META-INF/MANIFEST.MF
resolving: class com/ekahau/common/sdk/EConnection
skipping : class com/ekahau/common/sdk/EErrorCodes
skipping : class com/ekahau/common/sdk/EException
skipping : class com/ekahau/common/sdk/EMsg$EMSGIterator
skipping : class com/ekahau/common/sdk/EMsg
skipping : class com/ekahau/common/sdk/EMsgEncoder
skipping : class com/ekahau/common/sdk/EMsgKeyValueParser
skipping : class com/ekahau/common/sdk/EMsgProperty
resolving: class com/ekahau/engine/sdk/impl/LocationImpl
skipping : class com/ekahau/engine/sdk/status/IStatusListener
skipping : class com/ekahau/engine/sdk/status/StatusChangeEntry
Classes Loaded: 114
Resources Loaded: 1
Sources Loaded: 0
Published Interfaces: 0
Classes generated: 0
Classes skipped: 0
Synonyms Created: 0
Errors: 0
.... with no explanation.
Can anyone tell me why it would skip resolving a class? Especially after I use the -r flag to have loadjava resolve it upon loading.
How do i get it to resolve the entire jar file?
Edited by: themadprogrammer on Aug 5, 2011 7:15 AM
Edited by: themadprogrammer on Aug 5, 2011 7:21 AM
Edited by: themadprogrammer on Aug 5, 2011 7:22 AM
Edited by: themadprogrammer on Aug 5, 2011 7:23 AM
Edited by: themadprogrammer on Aug 5, 2011 7:26 AM -
Java.lang.ClassCastException when calling webservice stub from oracle DB
Hello everyone,
Because i need to get familliar with calling java webservices from an oracle database, i followed the following example
(http://www.oracle.com/technology/products/jdev/howtos/10g/WS_DBCallout/DBCalloutWS_HowTo.htm),
which included installing the SOAP client stack to the database (in the sys schema), grant the right permissions to the SYS user, developing a simple Helloworld webservice with jdeveloper 10.1.2, generating a Webservice stub and deploying a static method of this stub to the database.
All of this worked just fine, but when i want to call the webservice from oracle by invoking the deployed function, i get a java.lang.ClassCastException.
The complete stacktrace lists as follows:
v_Return = foutje: java.lang.ClassCastExceptionnulljava.lang.ClassCastException
at org.apache.soap.rpc.RPCMessage.serializeParams(RPCMessage.java:323)
at org.apache.soap.rpc.RPCMessage.marshall(RPCMessage.java:305)
at org.apache.soap.Body.marshall(Body.java:148)
at org.apache.soap.Envelope.marshall(Envelope.java:203)
at org.apache.soap.Envelope.marshall(Envelope.java:161)
at oracle.soap.transport.http.OracleSOAPHTTPConnection.send(OracleSOAPHTTPConnection.java:664)
at org.apache.soap.rpc.Call.invoke(Call.java:261)
at test.HelloWorldServiceStub.sayHello(HelloWorldServiceStub.java:82)
I debugged the WebServiceStub and noticed that the call.invoke method crashes. This is weird beacuse when i use System.out.println on the parameter is works just fine. so you would think it is a string.
Moreover, if i invoke the webservice from the endpoint or even when im debugging the stub locally it all works just fine.
Can someone plzzzzzz help me with this because i spend the whole day looking for an answer and im getting crazy!!!!!
Thanx al lot guys,
Kim
PS or could the problem be in the database instead of the webservice?????????
Message was edited by:
user568880
Message was edited by:
Kim ZeevaardersI think that it's going wrong because i did not install the right SOAP client stack.
In the HowTo is specified what JAR files are to be loaded in the database (from %JDEV_HOME), but it states that it has only been tested on a Oracle 9.2 database. I'm using Oracle10g. Maybe that's the reason that im getting this classcast exception...
Can anybody tell me what the right .JAR files are that have to be loaded into database when working with Oracle 10g?
Many thx in advance!
Kim -
Not able to call BPEL web service using RMI call from different machine
Hi,
1. I have created a smiple Helloworld asynchoronous BPEL process
2. I am able to call that BPEL process using java program (RMI call) which I have written in JDeveloper 10.1.3.3 and the java program is running in the embeded OCJ4 instance of JDeveloper sucessfully.
3. Now I am trying to run the same Java program in my unix machine where oracle application is installed.
4. I have set all the CLASSPATH for required jars which I have used in JDeveloper and also kept the jar file in Unix machine.
5. The java codes are complied successfully.
6. But when I am trying to run it , getting the following exception:
bash-3.00$ java HelloworldAsyn
name is Debkanta
property file data are: {java.naming.provider.url=opmn:ormi://172.18.19.169:6003:home/orabpel, java.naming.factory.initial=com.evermind.server.rmi.RMIInitialContextFactory, orabpel.platform=ias_10g, java.naming.security.principal=oc4jadmin, java.naming.security.credentials=welcome1}
hello3
java.lang.Exception: Failed to create "ejb/collaxa/system/DeliveryBean" bean; exception reported is: "javax.naming.NameNotFoundException: ejb/collaxa/system/DeliveryBean not found
at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:52)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.oracle.bpel.client.util.BeanRegistry.lookupDeliveryBean(BeanRegistry.java:279)
at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:250)
at com.oracle.bpel.client.delivery.DeliveryService.post(DeliveryService.java:174)
at com.oracle.bpel.client.delivery.DeliveryService.post(DeliveryService.java:149)
at HelloworldAsyn.main(HelloworldAsyn.java:64)
at com.oracle.bpel.client.util.BeanRegistry.lookupDeliveryBean(BeanRegistry.java:293)
at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:250)
at com.oracle.bpel.client.delivery.DeliveryService.post(DeliveryService.java:174)
at com.oracle.bpel.client.delivery.DeliveryService.post(DeliveryService.java:149)
at HelloworldAsyn.main(HelloworldAsyn.java:64)
bash-3.00$
I need to solve it urgently. Can anyone please help me.
Is it relaed to some user access issue in unix?
Thanks & Regards
Deb
Message was edited by:
user587916actually , I have laready given print stataement for the data in the context property file that you can see in the output. Today I am also able to call the bpel process using the same java program from my DOS command promt(cmd). Don't understand why the problem is occuring in unix.
please help. -
Calling the Java Method in PL/SQL Java Stored procedure errors out
Hi,
I could not find a suitable thread to post my PL/SQL question so iam posting it here.........
I have written a java class by name XYZ which has a method ABC for which there are 9 arguements being passed and its a VOID method.
This java class has been loaded into ORACLE using DBMS_JAVA.LOADJAVA pkg, Now this class is being called in the oracle as a JAVA Stored procedure...... When ever im trying to call the procedure it throws the following error
ORA-29531: no method
*Cause: An attempt was made to execute a non-existent method in a
Java class.
*Action: Adjust the call or create the specified method.
The code snippet as follows
JAVA CODE:
Class xyz
public static void Abc (String hostName,
int port,
String serviceURL,
String soapAction,
int timeOut,
String wsUser,
String wsPasWd,
String keyStore,
String keyStorePasWd)
//method implementation
JAVA STORED PROCEDURE:
create OR REPLACE procedure ABC_JAVA_SP_CALL
(p_hostname in varchar2, p_port in number, p_serviceurl in varchar2, p_soapaction in varchar2, p_timeout in number, p_wsuser in varchar2, p_wspasswd in varchar2, p_ks_path in varchar2, p_ks_passwd in varchar2)
as
language java
name 'xyz.Abc(java.lang.String, int, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String)';
When i try to call
declare
p_hostname varchar2(100);
p_port number;
p_serviceurl varchar2(100);
p_soapaction varchar2(100);
p_timeout number;
p_wsuser varchar2(100);
p_wspasswd varchar2(100);
p_ks_path varchar2(100);
p_ks_passwd varchar2(100);
begin
//SP which returns the values for the required parameters.
comppkg.getvcsinfo(
p_hostname,
p_port ,
p_serviceurl,
p_soapaction,
p_timeout,
p_wsuser,
p_wspasswd,
p_ks_path,
p_ks_passwd
Layer7_icengc_ws_tes(p_hostname,
p_port ,
p_serviceurl,
p_soapaction,
p_timeout,
p_wsuser,
p_wspasswd,
p_ks_path,
p_ks_passwd);
end;
This thing ends up with
29531. 00000 - "no method %s in class %s"
*Cause: An attempt was made to execute a non-existent method in a
Java class.
*Action: Adjust the call or create the specified method.
Im not understanding what wrong am i doing
pls help
Edited by: madhusudan on Feb 12, 2013 8:07 PMHello,
there is the forum {forum:id=65} for questions about using Java within Oracle.
Regards
Marcus
Edited by: Marwim on 13.02.2013 07:56
I could not find a suitable thread to post my PL/SQL question so iam posting it here.........You got the hint to the correct forum alread in another thread {message:id=10837976}
And if you think this is not related to Java but PL/SQL, then you should ask in {forum:id=75} -
How to call a package in Oracle
I'm trying to call a package in oracle
(this is the oracle way of calling it :
begin pck$xl.get_year_low_high_to_date(:compid, 20010801 , 20020108 ",:year_low,:year_high,:year_average,:low_date,:high_date); end;)
but i can't get it right.
I'm new to package calling in Oracle from Java, till now i only worked with SQL statements without parameters of that kind, can someone help me with this?
ps the ":compid" is a parameter i have to fill in and provide...
thank you very muchok here is a test i do...
but still doesn't work something about the bindvariables (check errorlog). I know a bit jdbc and i understant what you mean, but the problem is i don't know how this should go :(
please advise
import java.sql.*;
import java.util.*;
import java.text.*;
import java.io.*;
* @author U97488
public class test {
public static void main(String[] args) {
try{
ConnectionSherpa cs = ConnectionSherpa.getInstance("ConnectionSherpa");
Connection conn = cs.getConnObj();
String sSQL = "begin?; pck$xl.get_year_low_high_to_date(?, 20010801, 20020801 ,:year_low,:year_high,:year_average,:low_date,:high_date); end;";
CallableStatement stmt = conn.prepareCall(sSQL);
stmt.setString(1, "BRU10");
System.out.println(stmt.toString());
if(stmt.execute(sSQL)){
System.out.println(stmt.getString(2));
}catch (Exception e){
e.printStackTrace();
}StackTrace:
java.sql.SQLException: ORA-06550: Regel 1, kolom 6:
PLS-00110: Bindvariabele '1' is niet toegestaan in deze context..
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1451)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:862)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1839)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1764)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2354)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:909)
at com.kbcsecurities.taminoupdate.servlets.test.main(test.java:28) -
Error while calling data service: ClassCastException: oracle.sql.TIMESTAMP
I created a data service out of an Oracle datastore (table) which has a number of TIMESTAMP columns and deployed it in Axis2
When testing the Web Service in Designer, I get this error and can't find any solution:
com.sunopsis.wsinvocation.SnpsWSInvocationException: oracle.sql.TIMESTAMP cannot be cast to java.util.Date
at com.sunopsis.wsinvocation.client.a.a.d.requestReply(d.java)
at com.sunopsis.graphical.wsclient.f.b(f.java)
at com.sunopsis.graphical.tools.utils.swingworker.v.call(v.java)
at edu.emory.mathcs.backport.java.util.concurrent.FutureTask.run(FutureTask.java:176)
at com.sunopsis.graphical.tools.utils.swingworker.l.run(l.java)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Thread.java:534)
Caused by: oracle.sql.TIMESTAMP cannot be cast to java.util.Date
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:1792)
at com.sunopsis.wsinvocation.client.a.a.d.a(d.java)
... 8 more
Caused by:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
faultSubcode:
faultString: oracle.sql.TIMESTAMP cannot be cast to java.util.Date
faultActor:
faultNode:
faultDetail:
{}stackTrace:java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to java.util.Date
at com.sunopsis.data.transform.impl.DataTransformerUtilDate2SqlTimestamp.from(DataTransformerUtilDate2SqlTimestamp.java)
at com.sunopsis.data.transform.impl.generic.DataTransformerReverser.to(DataTransformerReverser.java)
at com.sunopsis.data.transform.impl.generic.DataTransformerIfNullThenExceptionWrapper.to(DataTransformerIfNullThenExceptionWrapper.java)
at com.sunopsis.data.transform.impl.generic.DataTransformerCombiner.to(DataTransformerCombiner.java)
at oracle.odi.dataservices.fwk.axis2.OMSerializer.objectToXsd(OMSerializer.java)
at oracle.odi.dataservices.fwk.axis2.OMSerializer.serializeManagedEntity(OMSerializer.java)
at oracle.odi.dataservices.fwk.axis2.OMSerializer.serializeManagedEntityList(OMSerializer.java)
at oracle.odi.dataservices.fwk.axis2.OMSerializer.serializeOMElement(OMSerializer.java)
at oracle.odi.dataservices.fwk.axis2.DataServicesMessageReceiver.invokeBusinessLogic(DataServicesMessageReceiver.java)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:39)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:144)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:279)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:116)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
at java.lang.Thread.run(Thread.java:619)
oracle.sql.TIMESTAMP cannot be cast to java.util.Date
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:1792)
at com.sunopsis.wsinvocation.client.a.a.d.a(d.java)
at com.sunopsis.wsinvocation.client.a.a.d.requestReply(d.java)
at com.sunopsis.graphical.wsclient.f.b(f.java)
at com.sunopsis.graphical.tools.utils.swingworker.v.call(v.java)
at edu.emory.mathcs.backport.java.util.concurrent.FutureTask.run(FutureTask.java:176)
at com.sunopsis.graphical.tools.utils.swingworker.l.run(l.java)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
at java.lang.Thread.run(Thread.java:534)What database are you doing this with?
B -
Java.lang.NoClassDefFoundError while calling a java class from BPEL
Hi,
I'm calling a java class to convert JSON to XML using BPEL. I have imported all the necessary jar files in the project and compiling done successfully.
But at runtime , i get the java.lang.NoClassDefFoundError: net/sf/json/JSON error.
For this i placed all the necessary jars under FUSION_HOME/Oracle_SOA1/soa/modules/oracle.soa.ext_11.1.1/ path and restarted the server.
But still i'm getting the same error at runtime.
Did i missed any step? Let me know the procedure to solve this.
Do i have to run ant or edit Manifest file after placing the jar?
in one site i find we have to place the jars under <DOMAIN HOME>/lib directory. Is this correct?
We are using SOA suite 11.1.1.6.
Thanks,
TerryHi Karan,
I have done placing the jars at FUSION_HOME/Oracle_SOA1/soa/modules/oracle.soa.ext_11.1.1/ and ran ant -f build.xml .The build was successful without any error.
I have even placed the jars in <DOMAIN HOME>/lib (/us2001/fmw/11.1.1.6/user_projects/domains/ohsdomain/lib) and did a server restart.
After these activities, when i execute the composite, i still get the error in em console,
Message
got RuntimeException
Supplemental Detail
oracle.fabric.common.FabricException: Could not create object of class 'packageName.className'; nested exception is:
java.lang.NoClassDefFoundError: net/sf/json/JSON
at oracle.integration.platform.blocks.wsif.WsifReference.request(WsifReference.java:698)
at oracle.integration.platform.blocks.mesh.SynchronousMessageHandler.doRequest(SynchronousMessageHandler.java:139)
at oracle.integration.platform.blocks.mesh.MessageRouter.request(MessageRouter.java:182)
Any help on this.
Thanks,
Terry -
Calling a Java Class from PL/SQL
Hai,
I need a technique of calling a class file and invoke its
methods written in Java by PL/SQL for my intranet development.
PLease let me know if you have really experienced and won.
Thanks
JOhnsonFirst, to call a Java class from PL/SQL the class needs to be
deployed to the database. you can check the 8i documentation for
the instructions for loading Java into the database(LoadJava).
The document contains information on how to load the Java and
call it from PL/SQL. The following links should help.
Loading Java:
http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/
java.817/a83728/03write6.htm
Invoking a Java Method in the database:
http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/
java.817/a83728/04jserv2.htm
Gary (JDev Team) -
Calling a Java Function from PL/SQL
Hi,
I would like to call a Java API from a java class residing on the middle tier ($OA_JAVA)
from the subscription code of a business event. The business event will have a
subscription with java rule function as my Java API. And the business event will be
raised from PL/SQL code using WF_EVENT.RAISE API. I want the Java API to
executed SYNCHRONOUSLY without deferring the event. Can you please provide
pointers to this.
Regards
RameshDocumentation here: http://download-uk.oracle.com/docs/cd/B14117_01/java.101/b10983/datamap.htm#sthref185
says JPublisher can publish records too.
But when I change the example given at http://download-uk.oracle.com/docs/cd/B14117_01/java.101/b10983/datamap.htm#sthref190 as following:
PACKAGE "COMPANY" AS
type emp_rec is record (empno number, ename varchar2(10));
type emp_list is varray(5) of emp_rec;
type factory is record (
name varchar(10),
emps emp_list
function get_factory(p_name varchar) return factory;
END;
then I see <unknown type or type not found> at sql or java files generated. Any ideas? -
Invoking bpel process from java in oracle soa/bpm 11g
Hi,
We have some java code to invoke bpel process in oracle BPM 10g following the instructions in http://download-east.oracle.com/docs/cd/B14099_19/integrate.1012/b14448/invoke.htm.
Basically the steps are:
1) get a Locator (com.oracle.bpel.client.Locator)
2) get IDeliveryService (com.oracle.bpel.client.delivery.IDeliveryService) reference from locator
3) call IDeliveryService method request or post with input message and get the response back.
Recently we want to migrated from oracle bpm 10g to oracle soa/bpm 11g. But I can not find the similar API in 11g. It seems now some adapter/binding need to be added in exposed service lane in soa composite view, for example, ADF-BC, direct binding etc, in order to allow java to invoke a bpel process. Here are two very useful links from Edwin about the detail how this is implemented.
http://biemond.blogspot.com/2009/11/invoking-soa-suite-11g-service-from.html
http://biemond.blogspot.com/2009/11/calling-soa-suite-direct-binding.html?showComment=1285198033913#comment-c1055322845511794252
My question is:
1) what are the choices and the official/best way to invoke a bpel process in oracle soa/bpm 11g from java?
2) does user need to add an adapter/binding in exposed service lane in order to let the bpel service be called in java?
3) what is the real difference between a bpm application and soa application in 11g?
I will really appreciate any expert's opinion.
Thanks,
BinThanks for your reply and confirmation, really appreciate it.
Yes, I found the difference of the invoking process API and was able to invoke bpel process using direct and ADF-BC binding by following Edwin's blog. But I have not found any official reference to compare this API difference between 10g and 11g ( I will mark this question as answered if anyone can find an official source from oracle, need to prove it to the team). The API to work with human task workflow seems pretty much the same between 10g and 11g. -
Out of memory error when calling a java stored procedure multiple times
Trying to run a PL/SQL loop calling a java stored procedure, I get the following error:
"ORA-04030: out of process memory when trying to allocate 262188 byte callheap,ioc_allocate free)"
(with some other error lines).
The stored procedure does two major things:
1) Open a socket to communicate with a server, of which it queries some data.
2) Use JDBC (with the default DB connection it has, as a stored procedure) to write the results to a table.
All socket connections, statements, etc. are properly closed and all memory should be garbage collected between each call.
Can anyone offer an explanation or additional checks to make? I'm quite sure the code isn't causing the problem, since I've tried running it as a stand alone application (outside of Oracle) and didn't have any problems.
Thanks.Hi,
Verify that the database parameters are set correctly.
EA -
Calling a java loaded API from PL/SQL
HI,
I have a java program loaded in the Database.
For sake of clarity I am posting the java Program also.
package mypackage1;
public class WriteClob extends CLOB
public static void main(String[] args) {
Connection conn = null;
String url = null;
String user = null;
String password = null;
Properties props = new Properties();
String fileName = null;
String xml_test ="KINGSTON";
StringBuffer s_xml = new StringBuffer();
// PreparedStatement ps = null;
OraclePreparedStatement ps=null;
int ret_int=0;
props.put("user", "apps" );
props.put("password", "apps");
long len=0;
int temp;
ResultSet rs = null;
SimpleDateFormat fSDateFormat = null;
props.put("SetBigStringTryClob", "true");
long first=System.currentTimeMillis();
url = "jdbc:oracle:thin:@ap619sdb:4115:owf12dev";
user = "apps";
password = "apps";
try
DriverManager.registerDriver(new OracleDriver()); // Get the database connection
conn = DriverManager.getConnection( url, props );
long second=System.currentTimeMillis();
System.out.println("Time between conn. "+(second-first));
first=System.currentTimeMillis();
for (int i =0;i<1000;i++){
s_xml.append(xml_test);
second=System.currentTimeMillis();
System.out.println("Time between loop "+(second-first));
first=System.currentTimeMillis();
ps =(OraclePreparedStatement) conn.prepareStatement("insert into xml_clob_temp1 values(:1)");
ps.setString(1,s_xml.toString());
ps.executeUpdate();
second=System.currentTimeMillis();
System.out.println("Time between loop "+(second-first));
} catch(SQLException sqlexp){ sqlexp.printStackTrace(); }
Now i am trying to create a procedure to call this Java API.
create or replace package load_perf as
procedure WriteClob ;
end;
create or replace package body load_perf as
procedure WriteClob
is
language java name 'mypackage1.WriteClob.main(java.lang.String)';
end;
I have tried debugging this a lot and am not able to overcome this error while creating the procedure.
LINE/COL ERROR
3/1 PL/SQL: Item ignored
5/15 PLS-00311: the declaration of
"mypackage1.WriteClob.main(java.lang.String)" is incomplete or
malformed
I have earlier created Java APIs which have returned some value and have been able to load them in the DB and call through a PL/SQL function wrapper.
But I am unable to create a procedure for this.
I have tried all sorts of debugging but always am getting error around this.
Can someone Please take a look at this Pronblem.
Thanks In Advance,
GauravA proper designed application in the database tier is far more scalable and performs better than using a separate middle tier for the application.
This should be self evident.
A middle tier requires more moving parts between the application and data. There now sits a network pipe between application and data. There are more software layers that slows down the interaction of the application with the data - more stuff that can go wrong. More stuff that needs to be maintained and configured and secured.
What's more, the database tier is a lot more scalable than the middle tier. Oracle Real Application Clusters. Oracle Parallel Processing. Oracle Shared Server. Etc.
These are robust and mature technologies.
One major fact that seems to be missed by so-called IS architects favouring a middle tier is that the middle tier cannot make a single database query or transaction go faster.
Scaling the middle tier is done by throwing more hardware at it. But not a single additional mid-tier h/w platform will make the database tier any faster. Will make the database tier scale.
Then there is also the issue of costs. A middle tier requires additional hardware. It requires support and maintenance agreements with the vendors. It requires middle tier software to be purchased. It requires a new set of skills to do middle tier development. It deals with different technology and different programming languages.
Why? How can this approach be sensible when:
- Oracle scales exceedingly well (and this scalability is not dependent on more h/w purchasing)
- Oracle deals with a single programming language (PL/SQL)
- Oracle supports high availability
- Oracle supports redudancy
- Oracle supports the complete application tier inside the database
If you have problems now leveraging Oracle (as an application tier), then you will have more problems when doing it a middle layer. Why?
Because the lack of experience/skill/knowledge required to make Oracle work for you, is not now suddenly negated and not needed when moving the application tier to Java.
Maybe you are looking for
-
Fields For Good Reciept and Issed !
Hi all, I want the fields for the goods reciept and good issued for getting the stock for a particular material as on to date (which is my selection screen) ... I have selected the sales data from the VBRK and VBRP tables which is for sales informati
-
Why can't i export my track in mp3 format in the latest garageband
it seems so fundamental that having created a great track in garageband it should be easy to export it in mp3 format but the new version doesn't think it worthwhile to make it that easy.........after contacting apple support i was told to install som
-
How to get Date/Time in Numerical form?
Dear All, I m writing the Data into Excle file throgh write to spreadsheet data and I want a timestamp into it, but I cant do it coz time always coms in the string format, but i want it in the numerical form anyways, so can anybody help me?
-
Oracle Streams setup for multiple schemas in a same database
We are on 11.1.0.7 and will be using Oracle 11g Streams that will replicate the data real-time for two schemas between the source and target set of schemas with in the same database. We will be doing DDL as well as DML replication. I created the foll
-
Unable to install Aperture 2.1.4 update on Snow Leopard
Hi Folks, I have Aperture 2.1 installed on my Mac. When I try to install the 2.1.4 update, it quits by saying "Aperture 2.0 or later is required to install this update". And Snow Leopard wouldn't let me launch Aperture without this update. Has anyone