Calling a java class in my oracle database from a oracle stored procedure
my oracle stored procedure is:
create or replace
PROCEDURE openpdffile
AS LANGUAGE JAVA
NAME 'pdfopenbook.mainbook()';
it is valid and so is this java class;
import java.sql.*;
import oracle.jdbc.*;
public class pdfopenbook //class pdfopen
public static void mainbook(String args[]) //main function
try //try statement
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "c:\\temp
final_book.pdf");
// Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "sol.exe");
} catch (Exception e) //catch any exceptions here
System.out.println("Error" + e ); //print the error
but i get the error:
onnecting to the database caprs.
ORA-29531: no method mainbook in class pdfopenbook
ORA-06512: at "CAPRS.OPENPDFFILE", line 1
ORA-06512: at line 2
Process exited.
Disconnecting from the database caprs.
it says there is no mainbook method but there is, what am i doing wrong??
Thanks,
Doug
Pass String[] as an argument to mainbook():
create or replace PROCEDURE openpdffile
AS LANGUAGE JAVA
NAME 'pdfopenbook.mainbook(java.lang.String[])';Have you posted it on the Database forum?
Regards,
Nick
Similar Messages
-
Calling a java class from abap/bsp
Hello,
I am still learning ABAP. I need to call a java class (a chart drawing library) from ABAP or from a BSP. What is the best way to do that ?
Basically I would create an object, pass data from a database and then get some binary data from that object (an image).
Hope you can help me
Sincerely,
Olivier Matt/people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection
check the above link and this forum too
Call Java Class and Methods from ABAP -
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) -
I want to call External Java class from the PL/SQL
Hi,
I am using Oracle Apps R11i (11.5.7), I wanted to call external Java class from the PL/SQL. This external Java class is residing in another application server.
How do I do this.
I know one way. Develop C routine in Oracle Apps to call external java class and call this C routine from the PL/SQL.
Is there any simple method available? or any other method?
Thanks in advance.
-VenkatFirst of all, this is a Java application you're talking about, right (i.e. it has a main() function)? It's not just a class that you're trying to instantiate is it? If it's an application, you obviously have to start a new virtual machine to run it (rather than using the virtual machine built into the database like stored java). I'm a little leary of your mention of an "application server" as this would more commonly mean that a virtual machine is already over there running with access to this class. In which case, you'd typically interface with SOAP or some other RPC API.
All that aside, as long as you have physical disc access (through NFS or whatever) to the class file, you could use a java wrapper class with a system call to do this. In fact, there is a thread in just the last day or so on this very forum that has the code to do just that (see " Invoking OS Commands from PL/SQL"). However, it's worth noting that the virtual machine will be running on the database server in this case and not the application server. -
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 -
Problem Calling a Java class from PLSQL function
We are calling a Java class through oracle function as
FUNCTION CalculateAMW (contributorid IN Number,
fromdate IN Date,OHorAnncoverage in Number,
OHAnncoverage in Number,
AppStatus in Number,
Status in Number)
RETURN Number
AS LANGUAGE JAVA
NAME 'AMWCalculations.calculateAMW
(long,java.sql.Timestamp,long,long,long,long) return double';
on execution of this function the sql prompt for the 1st time it is giving the output
but
if reexecute it is throwing and error ORA - 932 : Inconsistent
datatypes.
Recompiling the java class then it works for the 1st time and the next
time
we execute it throws error as explained above.
What could be the problem.
Thanks
Nanda Kishoreany idea???Yes, you are in the wrong forum, this is a Java forum, you have an ASP question, so i suggest you visit an ASP forum/site
-
How to call a java class placed in java top?
Hi,
Can anyone please let me know how we can call the java class placed in the java top using PL/SQL?
Thanks,
BharatBharat ,
Please refer this link , you can call java static method using sql function
http://www.stanford.edu/dept/itss/docs/oracle/10g/java.101/b12021/invokeapp.htm
Keerthi -
How can I call a java class from within my program?
I was wondering if there's a platform independent way to call a java class from my program.
Here's my scenario. I'm working on a platform independent, feature rich, object-oriented command prompt program. The way I'm designing it is that users can drop classes they write into my bin directory and gain access to the class through my program. For example, they drop a class named Network.class in the bin directory. They would type Network network at my command prompt and gain access to all the methods available in that class. They can then type system.echo network.ipaddress() at my prompt and get the system's ip address. I have it designed that there's a server running in the background and the clients connect to my port. Once connected the end-user can enter their user name and password and gain access to the system. When they type a command they actually call another java program which connects to my server using a seperate thread. They can then communicate back and forth. I have it set that everything has a process id and it's used to keep track of who called what program. Once the program is done it disconnects and closes. Rather than getting into the nitty gritty (I didn't want to get into heavy detail, I know how everything will work) I'm really interested in finding out how I can call a java program from my program. I don't want it to be part of the app in any way.
-
How to call a Java class from another java class ??
Hi ..... can somebody plz tell me
How to call a Java Class from another Java Class assuming both in the same Package??
I want to call the entire Java Class (not any specific method only........I want all the functionalities of that class)
Please provide me some slotuions!!
Waiting for some fast replies!!
Regards
Smita MohantyHi Smita,
you just need to create an object of that class,thats it. Then you will be able to execute each and every method.
e.g.
you have developed A.java and B.java, both are in same package.
in implementaion of B.java
class B
A obj = new A();
//to access A's methods
A.method();
// to access A's variable
//either
A.variable= value.
//or
A.setvariable() or A.getvariable() -
How to call a java class in a bat file
Hi
I need to call a Test.java class in a bat files .It refer .DOM.jar
in C:/url; How do i call the java class i need the syntax
Thanks lotassuming lanch.bat, Test.class and DOM.jar are in c:\url
assuming %JAVA_HOME% is defined (else substitue it with your java installation directory)
here is the content of launch.bat:
cd C:/url (or cd c:\url ) (or cd c: followed by cd url)
%JAVA_HOME%\bin java -classpath .;DOM.jar Test
hop that'd help,
marvinrouge -
Calling a java class in JSP in Weblogic 5.1
Hi
I am trying to call a java class in a jsp page. But it is giving an error:
Compilation of 'C:\weblogic\myserver\classfiles\jsp_servlet\_knet\_buy.java' failed:
C:\weblogic\myserver\classfiles\jsp_servlet\_knet\_buy.java:79: cannot access jsp_servlet._knet.e24PaymentPipe
probably occurred due to an error in /knet/buy.jsp line 25:
e24PaymentPipe pipe = new e24PaymentPipe();
Is this a problem bcos of the wrong path of the class file which i am calling?
Please help this is urgentHello All
As I tried to deploy the easiest project (dummy.war) on WebLogic 8.1.5, There is only one class (without package) Login.class
*********** Listing of the dummy WAR ***********
META-INF/
META-INF/MANIFEST.MF
WEB-INF/
WEB-INF/classes/
WEB-INF/classes/Login.class
WEB-INF/web.xml
index.jsp
login.jsp
************ Output of deployment from Admin Console****************
Log:
A log of the task's activities.
[Deployer:149033]preparing application dummy on intranetAdmin
[Deployer:149033]prepared application dummy on intranetAdmin
[Deployer:149033]activating application dummy on intranetAdmin
[Deployer:149033]failed application dummy on intranetAdmin
[Deployer:149034]An exception occurred for task [Deployer:149026]
Deploy application dummy on intranetAdmin.:
Exception:weblogic.management.ApplicationException: start() failed.
Module: dummy Error: weblogic.management.DeploymentException:
[HTTP:101216]Servlet: "index" failed to preload on startup in Web application:
" dummy ".
weblogic.servlet.jsp.CompilationException: Compilation of D:\apps\wlsapp\
INTRAN~1\.\intranetAdmin\.wlnotdelete\extract\intranetAdmin_ dummy _ dummy
\jsp_servlet\__index.java failed.
D:\apps\wlsapp\INTRAN~1\.\intranetAdmin\.wlnotdelete\extract\
intranetAdmin_dummy_dummy\jsp_servlet\__index.java:22: '.' expected
import Login; //[ /login.jsp; Line: 8]
^
1 error
at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java:478)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:246)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:196)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.
java:3430)
at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.
java:3387)
at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext
.java:3373)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:3356)
at weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServletContext.java:
6208)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:864)
at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer.java:2134)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2175)
at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.
activateContainer(SlaveDeployer.java:2520)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer
.java:2438)
at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.java:2155)
at weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(SlaveDeployer.java:2254)
at weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDeployer.java:2149)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.
java:2401)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:
883)
at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:591)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
Caused by: java.io.IOException: Compiler failed executable.exec
at weblogic.utils.compiler.CompilerInvoker.compileMaybeExit(CompilerInvoker.java:470)
at weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:328)
at weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:336)
at weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:321)
at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java:451)
... 22 more
- with nested exception:
[java.io.IOException: Compiler failed executable.exec]
I put this class into a dummy package named sample, changed package declaration within this class and changed import statement within jsp pages like this :
<%@ page import="sample.Login " %>
<jsp:useBean id="logUsr" scope="session" class="sample.Login" />
When I did like this, everything is ok. No more exception.
If my application has so many java classes under WEB-INF/classes/ without creating package, it may be so inconvenience.
Please kindly let me know why this exception (class not found exception) occurred.
And what is the solution? I cannot deploy the application successfully yet.
many thanks,
Zin Ko Win -
Calling a java class in a JSP file
Hello,
I have a jsp file in which I call a java class.
I work with Tomcat 4.0.1
If I modify the java class and then I execute my JSP, it still be the old version of my class that is executed.
I don't understand why since if I creates a main function and I execute it, it works correctly!
Do you know what is the problem?
Thanksi also have this problem.when i modify jsp file,it didn't execute inmediately. Then i restart tomcat,but problem also exist.
a few minute age,i execute jsp file again,it can appear the modified jsp.i don't down why
i work tomcat 5.0 windowxp -
Jsp session variable to call in java class.
here i am facing a problem in calling a jsp session varibale to java class.
in my code.. i have seperate files for jsp pages and packaged java classes.
as i am developing a web tire application. the data entered in the front end i am getting to jsp page and putting the mandatory in session to use in other pages. now here the same session vaiable i have to use/call in java class file.
Please refer me the best method and any references on this to call the session vaiable to java class file.
in jsp page i decleared like this:
session.setAttribute("stuIdentification",stuid);
this id i have to use in java class.file.
how to call it?
Thanks
KurraGimbal2's got the right idea.
The reasons for choosing point 1) are also valid. Whenever possible try and do as much code that is not specifically tied to your business objects inside your dynamic element (the jsp page) instead of your static one (the compiled class)
this allows you to very easily update your jsp to make any changes without having to recompile class code. Recompiling seems like a little thing when you are in development but imagine if the class is executed by a business critical application that faces forward to customers, recompiling will mean shutting down your servers and that may not be an option.
Regards,
David -
Calling my Java class from JSP page
Hello, I am trying to call my Java class from my JSP page passing parameters to it and getting back a collection of result sets. Can someone tell me what I might be doing wrong:
JSP code to call Java class:
<%
String strEssUser = "test";
String strProcessingMonth = "JUL";
String strProcessingYear = "2002";
strQueryList=new ListReturn(strEssUser.toString(), strProcessingMonth.toString(), strProcessingYear.toString());
%>
I get this error when I try to run this JSP page using tomcat:
C:\Program Files\Apache Tomcat 4.0\work\Standalone\localhost\em\jsp\Test_0005fSummarySBU_0005fscreen$jsp.java:77: Class org.apache.jsp.ListReturn not found.
strQueryList=new ListReturn(strEssUser.toString(), strProcessingMonth.toString(), strProcessingYear.toString());
I'm not sure if this problem is the way I am calling the Java class, or if I have a problem in the Java code itself. Can anyone help?Ok, I get a very strange error now:
org.apache.jasper.JasperException: Unable to compile class for JSPerror: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
What is this??? Anyone? -
11g iBots(Agents) calling custom java class?
We upgraded from 10g to 11g and we have iBots that call a custom java class in the form of a jar file.
This all worked fine in 10g.
I followed all configuration steps in the documentation, but we are unable to get our iBots(Agents) to work in 11g.
Keep getting "Can't find Class" errors.
Has anyone successfully created agents that call custom java classes with 11g, if so, can you please share your steps for doing this?Hi glova,
The document refers to the RPD and catalog migration....what ever customization used in 10g wont effect in 11g i suppose most of the things.
i would suggest you to copy the java class of ibots and do the copy paste or manually do it in 11g and see if it works ...this is the only alternative.
hope helps you.
Cheers,
KK
Maybe you are looking for
-
When I try to set up sync on the desktop, I could not get past the question about not being a robot. There is no clue about what to do. When I click on "next" it says "wrong answer" (or similar phrase). and I cant get past that. Also, both, the iphon
-
I'm getting rid of an old Mac Mini which has it's iTunes library stored on a NAS drive. I want the replacement Mac to reference and use this existing NAS stored iTunes library rather than loading the entire contents onto the new Mac. What do I need t
-
Error in module RSQL of the database interface.
Hi Expert, I get this error "Error in module RSQL of the database interface." when the below ABAP statement executed, do you know the root cuase? Thanks. ABAP Code: data lt_fact type TABLE OF /BIC/FZRT_C002. data ls_Fact type /BIC/FZRT_C002. *
-
Spyder pro, spyder elite or eye one display 2
hello folks, i have a macbook pro5,3 with the glossy screen and editing with Aperture 3. i'm wondering which brand works best for the macbook pro or the most "mac friendly". i'm willing to spend the $200 for either the spyder elite or the eye one dis
-
How would I merge two csv files in Powershell
Hello, I have two CSV Files. Each has a list of virtual machines in them. One CSV file has the name of the VM as well as details about the RAM, CPU, VM Details (from VMM). The other CSV File has the name of the VM as well as the IP address. How wou