Java class import error
Hi ,
I unable to import the java class into the peoplecode. while i am import it into my peoplecode i got the error message
like,
*Calling Java java.util.regex.Pattern.matcher: no overload matches. (2,743) TEST.SAVE_PB.FieldChange PCPC:379 Statement:4
While calling the given Java method, no overload was found with a parameter signature that matches the supplied parameter types.*
the following codes are i used to import.
Local JavaObject &pattern = GetJavaClass("java.util.regex.Pattern");
Local JavaObject &matcher = GetJavaClass("java.util.regex.Matcher");
any one suggest me a better solution to import these class into my peoplecode.
Hi jim,
again i getting the checking patter issue,
Local JavaObject &pattern = GetJavaClass("java.util.regex.Pattern");
Local JavaObject &matcher = GetJavaClass("java.util.regex.Matcher");
&pattern = &pattern.compile("[!#$%&'()*+,-./\:;<=>?@[]^_{|}~]");
TEST.OUTPUTSTRING = &pattern.matcher(CreateJavaObject("java.lang.String", TEST.INPUTSTRING.Value)).replaceAll("\\\a");
from the above code i need to replace a character in which the characters matched from the pattern.
&pattern = &pattern.compile("[!#$%&'()*+,-./\:;<=>?@[]^_{|}~]");
while ran the above line i got the error like
*Java Exception: java.util.regex.PatternSyntaxException: Unclosed character class near index 31
[!#$%&'()*+,-./\:;<=>?@[]^_{|}~]
^: during call of java.util.regex.Pattern.compile. (2,763) TEST.SAVE_PB.FieldChange PCPC:331 Statement:3
is there any other way to assign a pattern to check the condition..?
Similar Messages
-
Problem When Import Java Class -compilation error
Hi all
I made a java class that has methods to return Screen width and Height .
package tarek;
import java.awt.Dimension;
import java.awt.Toolkit;
public class Screen
Dimension dim ;
public Screen()
dim = Toolkit.getDefaultToolkit().getScreenSize();
public double getWidth()
double w = dim.getWidth();
return w;
public double getHeight()
double h=dim.getHeight();
return h;
I made the jar file " screen.jar" and make it ready to use in form builder
I opened form builder and make import java class (From program>import java class>choose the class anc click import)
The class now imported successfully and the PL/SQL package body is:
PACKAGE Screen /* tarek.Screen */ IS
-- DO NOT EDIT THIS FILE - it is machine generated!
-- Constructor for signature ()V
FUNCTION new RETURN ORA_JAVA.JOBJECT;
-- Method: getHeight ()D
FUNCTION getHeight(
obj ORA_JAVA.JOBJECT) RETURN NUMBER;
-- Method: getWidth ()D
FUNCTION getWidth(
obj ORA_JAVA.JOBJECT) RETURN NUMBER;
END;
Now I made a button on the form and i WRITE THIS CODE TO INVOKE THE CLASS on when_button_pressed
DECLARE
vScreen_Class ORA_JAVA.JOBJECT;
BEGIN
vScreen_Class := SCREEN.NEW;
END;
My problem is I have compilation error
error 306 AT LINE 5 , COLUMN 25
wrong number or types of argument in call to "NEW"
I do not know what is the reason of this compilation error?
Is it because the method in java return "double datatype" while in oracle return "number datatype"
Please help
Edited by: [email protected] on Dec 28, 2009 10:24 AMSarah, I ca not move my thread to JDeveloper because it is not java issue. The problem is with my PL/SQL code and the way I make Import Java class to forms Builder. The Java code is OK.
Andreas Thank you so much for replying. In fact I made a full compile "Ctrl+Alt+K". but still error
The following is the package Body
PACKAGE BODY Screen IS
-- DO NOT EDIT THIS FILE - it is machine generated!
args JNI.ARGLIST;
-- Constructor for signature ()V
FUNCTION new RETURN ORA_JAVA.JOBJECT IS
BEGIN
args := NULL;
RETURN (JNI.NEW_OBJECT('tarek/Screen', '()V', args));
END;
-- Method: getHeight ()D
FUNCTION getHeight(
obj ORA_JAVA.JOBJECT) RETURN NUMBER IS
BEGIN
args := NULL;
RETURN JNI.CALL_DOUBLE_METHOD(FALSE, obj, 'tarek/Screen', 'getHeight', '()D', args);
END;
-- Method: getWidth ()D
FUNCTION getWidth(
obj ORA_JAVA.JOBJECT) RETURN NUMBER IS
BEGIN
args := NULL;
RETURN JNI.CALL_DOUBLE_METHOD(FALSE, obj, 'tarek/Screen', 'getWidth', '()D', args);
END;
BEGIN
NULL;
END;
--------------------------------------------------------------------------------- -
Executing one system command from one java class. ERROR. Please help me
Hello i am trying to add users into one linux machine using one jaav program but when i execute the java class the system doesn't show me any error and dont make anything.
The linux command, in the main of the class, is correct; from thelinux shell it runs well, but from the java class it doesn't run.
Can you help me please?
thanks
import java.io.*;
public class ejecutaUsuario {
/** Creates a new instance of ejecutaUsuario */
public ejecutaUsuario(String cmdline) {
try {
String line;
Process p = Runtime.getRuntime().exec(cmdline);
BufferedReader input =
new BufferedReader
(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
System.out.println(line);
input.close();
catch (Exception err) {
err.printStackTrace();
System.out.println(err);
public static void main(String argv[]) {
String passwd="hola";
String usuarioInterno="xxxxxx";
new ejecutaUsuario("/bin/sh useradd -p `openssl passwd -1 -salt 12345678 " + passwd + "` -d /home/" + usuarioInterno + " -m -s /bin/bash " + usuarioInterno);Try gettting the error input stream as well (getErrorStream()). Maybe you are getting output there.
You might want to try just executing the 'useradd' part, getting the output stream of that process, and then put the parameters of useradd into the outputstream.
Later
Cardwell -
Windows classpath vs java.class.path error in QuickTime based applet
Hello
I've spent days reading and searching the internet, and I'm still stumped why some Windows installations are not able to run my QuickTime for Java based applet even though QuickTime is installed (the specific error is: java.lang.NoClassDefFoundError: quicktime/QTException). I have some additional details and a question that might spur someone to an insightful nudge.
On a Windows system that fails:
echo %classpath%
.;C:\Program Files\QuickTime\QTSystem\QTJava.zipWhich is where QTJava.zip is found on the (faulty?) system, but java.class.path is just:
java.class.path = C:\PROGRA~1\Java\jre6\classes
Of the dumped system properties, only java.library.path makes any mention of the QTSystem folder (or any other QT or QuickTime related items).
java.library.path = C:\Program Files\Safari;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\PROGRA~1\Java\jre6\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\QuickTime\QTSystem\
I ran across one thread (elsewhere) where the user was having problems with loading some classes from a complex JAR environment, and a solution was to write a custom class loader. After doing so, the user got the same error "java.lang.NoClassDefFoundError: quicktime/QTException" that was resolved by extending the custom class loader to include .zip files. I'm not sure if the solution is relevant, or if he simply broke something in his custom class loader that would have worked otherwise. I've not written a custom class loader and not sure where to begin, so before I ventured down that path I was hoping someone might shed some light as to if this is a dead end or potential solution. This is a signed applet (QuickTime now requires it, even if you are only playing files of the same server) and it does work on several Windows machines and all tested Macs.
Thank you,
Deron
output to Java Console with level 5 tracing enabled
basic: Joining applet thread ...
basic: Joined applet thread ...
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@750159, refcount=2
basic: Finding information ...
basic: Releasing classloader: sun.plugin.ClassLoaderInfo@750159, refcount=1
basic: Done ...
basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@3a9bba
basic: Loading applet ...
basic: Initializing applet ...
basic: Starting applet ...
basic: completed perf rollup
network: Cache entry not found [url: http://www.equushd.com/quicktime/QTException.class, version: null]
network: Connecting http://www.equushd.com/quicktime/QTException.class with proxy=DIRECT
network: Connecting socket://www.equushd.com:80 with proxy=DIRECT
java.lang.NoClassDefFoundError: quicktime/QTException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: quicktime.QTException
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 10 more
basic: Exception: java.lang.NoClassDefFoundError: quicktime/QTException
Ignored exception: java.lang.NoClassDefFoundError: quicktime/QTExceptionSomething is wrong with the library.
Staring at java code will not help you figure that out.
Maybe it isn't intended to be loaded in java but instead it loads java itself?
If not then write a C/C++ basic app that links that dll in and see if you can at least get it to start. -
Problem class important error while executing Query from favorites
Hi Experts,
1. I have tried execute the query from favorites it is showing the error message. " Problem class important"
In the message text: logs showing error message [Attached the message screenshot].
2. From "Query Designer" Execute [Ctrl+R] gives the error "500 Internal Server Error" [Attached the screenshot]
3. Able to execute the reports from RRMX.
No ST22 dumps. Can any one suggest about...how to rectify the errors.
Thanks in advance...SuryaNeed tyo make sure the problem is with the query/workbook are general issue with all workbooks/query.
1. Make sure the base query of work book is still executable. RRMX/RSRT.
2. Execute the work book in Bex/Excel and look for definition of workbook; there might be some thing in the workbook referencing other than base query.
3. If other workbook are also not working? need to check if other users have same issue.?
Hope this will help to narrow the problem.
Gopi -
Import java classes Exception Error in Forms 10g
Hi,
I have created a jar file using JDeveloper and need to import it in my Forms 10g to be able to call web services. In my forms builder, after I click on Program - Import Classes and give the name of the stub I created, it gives me the following error :
Exception occurred: java.lang.ClassNotFoundException:
I am following the step by step instructions of OTN
http://www.oracle.com/technology/obe/obe_as_10g/deploy/callws_fromforms/forms_webservice.htm
In the above documentation, where it says "Call the Stub from a Forms Application", point no. 1, it tells to go to control panel - system - advanced - environment variables and edit CLASSPATH. The problem is that in my variable, I cannot see CLASSPATH, it has PATH. I had added my jar file in there. Is it because of this that I'm getting the error.
After that I have added the jar file in default.env in CLASSPATH.
I would appreciate your urgent help in this matter.
Thanks in advance.Well you can create a new variable called CLASSPATH - however, if you are actually seeing the JAR file in the Java Importer then that would assume you are infact seeing the JAR file.
DO you get this problem if you JAR up a simple "Hello world" - if could be that you are not importing all the classes needed . What Jdeveloper version are you using - if its 10.1.3.1 and JAXRPC web services you may need to add an additional JAR to the class.
Luckily for you ...check out...
http://groundside.com/blog/GrantRonald?title=want_to_know_how_to_call_web_services_fr&more=1&c=1&tb=1&pb=1
Regards
Grant
Message was edited by:
Grant Ronald -
Java library import error!
Ok, so I have some code, but I need to import some things from the library. But, when I type:
import java.util.ArrayList;It comes back with the error:
SimpleDotCom.java:21: class, interface, or enum expected
import java.util.ArrayList;
^I assume that this is because I'm missing some critical file,(I'm almost positive I didn't download the ME,) but I'm not sure. What did I do wrong?Hi
This error is occured coz of misplacing the statement(import statement) in a wrong place.
Consider this example.
class ImportTest{
public static void main(String ar[]){
System.out.println("Hello World!");
import java.util.ArrayList;
if you compile this code, you will get the error which you are getting now
i.e you have misplaced the import statement in the code.
ERROR:
javac ImportTest.java
ImportTest.java:8: 'class' or 'interface' expected
import java.util.ArrayList;
^
1 error
Note: Import statement always placed before the class definition
And Package statement must be placed always in the begining
of the file, i.e before any statements.
say for eg:
package test; // Always must be the first statement in a file.
import java.util.ArrayList; // import statements must be after the
// package and before class definition
// if any
class <Class-Name>{
Just Check where you put your import statement. Guess your Line:21 will be the import statement - misplaced
Message was edited by:
chriscsit -
Easy RFC lookup from XSLT mapping using a java class (getting Error)
Hi All,
I am trying to implement the sample scenario for calling RFC from xslt with the help of wrapper class. I am getting following error.
com.sap.aii.mapping.lookup.LookupException: Internal lookup service is not registered. Invoking the lookup service is only supported in the Integration Builder test environment or in the Integration Server runtime environment. at com.sap.aii.mapping.lookup.LookupService.getService(LookupService.java:400) at com.sap.aii.mapping.lookup.LookupService.getChannel(LookupService.java:285) at com.sap.aii.mapping.lookup.LookupService.getChannel(LookupService.java:318) at dk.applican.xi.mapping.lookup.RfcLookup.execute(RfcLookup.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.lib.xsl.xpath.functions.JLBFunction.execute(JLBFunction.java:145) at com.sap.engine.lib.xsl.xpath.ETFunction.evaluate(ETFunction.java:110) at com.sap.engine.lib.xsl.xpath.XPathProcessor.innerProcess(XPathProcessor.java:54) at com.sap.engine.lib.xsl.xpath.XPathProcessor.process(XPathProcessor.java:41) at com.sap.engine.lib.xsl.xpath.XPathProcessor.process(XPathProcessor.java:49) at com.sap.engine.lib.xsl.xslt.XSLVariable.process(XSLVariable.java:125) at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:228) at com.sap.engine.lib.xsl.xslt.XSLTemplate.process(XSLTemplate.java:256) at com.sap.engine.lib.xsl.xslt.XSLStylesheet.callTemplate(XSLStylesheet.java:1310) at com.sap.engine.lib.xsl.xslt.XSLCallTemplate.process(XSLCallTemplate.java:102) at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:228) at com.sap.engine.lib.xsl.xslt.XSLElement.process(XSLElement.java:241) at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:228) at com.sap.engine.lib.xsl.xslt.XSLElement.process(XSLElement.java:241) at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:228) at com.sap.engine.lib.xsl.xslt.XSLTemplate.process(XSLTemplate.java:256) at com.sap.engine.lib.xsl.xslt.XSLStylesheet.process(XSLStylesheet.java:445) at com.sap.engine.lib.xsl.xslt.XSLApplyTemplates.process(XSLApplyTemplates.java:158) at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:228) at com.sap.engine.lib.xsl.xslt.XSLTemplate.process(XSLTemplate.java:256) at com.sap.engine.lib.xsl.xslt.XSLStylesheet.process(XSLStylesheet.java:445) at com.sap.engine.lib.xsl.xslt.XSLStylesheet.process(XSLStylesheet.java:381) at com.sap.engine.lib.jaxp.TransformerImpl.transformWithStylesheet(TransformerImpl.java:392) at com.sap.engine.lib.jaxp.TransformerImpl.transform(TransformerImpl.java:234) at com.sap.aii.ibrun.server.mapping.MappingTransformer.transform(MappingTransformer.java:153) at com.sap.aii.ibrun.server.mapping.XSLTMapping.executeStep(XSLTMapping.java:67) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:91) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:77) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:88) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleRequest(MappingRequestHandler.java:63) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceImpl.processFunction(MappingServiceImpl.java:80) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceObjectImpl0.processFunction(MappingServiceObjectImpl0.java:131) at sun.reflect.GeneratedMethodAccessor482.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187) at $Proxy22.processFunction(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:95) at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequestInternal(RFCJCOServer.java:113) at com.sap.engine.services.rfcengine.RFCJCOServer$ApplicationRunnable.run(RFCJCOServer.java:171) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162
I am SAP XI 3.0 SP-9Hello,
I have the same issue as stated above.
At runtime sometimes the mapping fails however when executing the mapping from ESR (test operation mapping) with the same payload it is executed succesfully (lookup is to system that is the senderservice of the scenario).
Anybody a clue.
Also clearing mapping cache etc. did not solve the problem.
Thanks,
Emile -
Java class reference error in Portal Application
Hello,
I have created a Portal Application Project with the Class
"public class TEST extends AbstractTestComponent implements ITestable"
in order to test the application.
The test works fine with a simple code.
Instead, using the external class HSSFWorkbook in order to create an excel file, the Enterprise Portal Unit Test return the following error:
"java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFWorkbook"
I have tried to put the ZIP file of class into the folder "dist/PORTAL-INF/lib" and "dist/PORTAL-INF/exlib" but it doesn't work.
Can someone tell me what I have to do?
Thanks and best regards,
Matteo.
Edited by: Matteo De Santis on Feb 10, 2009 7:22 PMHi,
note that a portal application has two classloaders. one for the public part (src.api) and one for the private one (src.core).
portal components reside in src.core by default. this means you need to load your jar file to the private class loader.
so instead of dist/PORTAL-INF/lib use dist/PORTAL-INF/private/lib
Regards, Lior -
ORA-105100 Import Java Class (Not a class path error)
i have a problem while using java imported class
java class
import java.io.*;
import java.lang.*;
import java.util.*;
public class externalCall{
public static String Run(String One, String Two){
String commandOutput = null;
commandOutput = concat(One,Two);
return commandOutput;
public static String concat(String One, String Two){
return One+Two;
the problem is that when using externalCall.run from oracle forms it is generating
error ORA-105100 err.
This is not a class path error as we are able to access concat function of java
class using Import Java Class.
Any Clues?...
Best Regards
AshishORA-105101 when using Java Importer
-
IMPDP to import JAVA CLASS and JAVA SOURCE from .DMP file
hi,
I have a schema X, In that schema some of the *"JAVA CLASS" and "JAVA SOURCE"* objects are missing ..
The procedures ,functions..etc objects were updated at X schema..
I have 1 dmp file of Y schema , containing the missing "JAVA CLASS" and "JAVA SOURCE" s.. Can I import the the same to the schema X using IMPDP
i tried using INCLUDE clause but it is not working
eg:
impdp john1/john1@me11g22 directory=datadump dumpfile=DEVF2WAR.DMP remap_schema=devf2war:john INCLUDE="JAVA CLASS","JAVA CLASS"but error..
ORA-39001: invalid argument value
ORA-39041: Filter "INCLUDE" either identifies all object types or no object types.regards,
jpHello,
You should type JAVA_CLASS and JAVA_SOURCE (use underscore instead of space).
impdp john1/john1@me11g22 directory=datadump dumpfile=DEVF2WAR.DMP remap_schema=devf2war:john INCLUDE="JAVA_CLASS","JAVA_CLASS"Best Regards,
Gokhan Atil
If this question is answered, please mark appropriate posts as correct/helpful and the thread as closed. Thanks -
Only to import JAVA CLASS and JAVA SOURCE from .DMP file using IMPDP
hi,
I have a schema X, In that schema some of the *"JAVA CLASS" and "JAVA SOURCE"* objects are missing ..
The procedures ,functions..etc objects were updated at X schema..
I have 1 dmp file of Y schema , containing the missing "JAVA CLASS" and "JAVA SOURCE" s.. Can I import the the same to the schema X using IMPDP
i tried using INCLUDE clause but it is not working
eg:
impdp john1/john1@me11g22 directory=datadump dumpfile=DEVF2WAR.DMP remap_schema=devf2war:john INCLUDE="JAVA CLASS","JAVA CLASS"but error..
ORA-39001: invalid argument value
ORA-39041: Filter "INCLUDE" either identifies all object types or no object types.regards,
jpDouble post: IMPDP to import JAVA CLASS and JAVA SOURCE from .DMP file
Already replied.
Regards
Gokhan -
How i can set texfield value in forms from imported java class .? This class is executing as thread .
Thank'sIs it possible to send an "event" from the Java class, imported by Java Importer, to the Forms App?
In other words, is there a way to have asynchronous communication between Forms and Java class on the server in Forms 10.1.2.0.2 -
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,
DougPass 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 -
Problem with return a ColdFusion query object from a Java class
Hi!
I need to return a ColdFusion query object from a Java class
using a JDBC result set ( java.sql.ResultSet);
I have tried to pass my JDBC result set in to the constructor
of the coldfusion.sql.QueryTable class with this code:
ColdFusion code
<cfset pra = createObject("java","QueryUtil").init()>
<cfset newQuery = CreateObject("java",
"coldfusion.sql.QueryTable")>
<cfset newQuery.init( pra.getColdFusionQuery () ) >
My java class execute a query to db and return QueryTable
Java code (QueryUtil.java)
import coldfusion.sql.QueryTable; // (CFusion.jar for class
QueryTable)
import com.allaire.cfx //(cfx.jar for class Query used from
QueryTable)
public class QueryUtil
public static coldfusion.sql.QueryTable
getColdFusionQuery(java.sql.ResultSet rs)
return new coldfusion.sql.QueryTable(rs);
but when i run cfm page and coldfusion server tries to
execute : "<cfset pra =
createObject("java","QueryUtil").init()>" this error appears:
Object Instantiation Exception.
An exception occurred when instantiating a java object. The
cause of this exception was that: coldfusion/sql/QueryTable.
If i try to execute QueryUtil.java with Eclipse all it works.
Also I have tried to return java.sql.ResultSet directly to
coldfusion.sql.QueryTable.init () with failure.
Do you know some other solution?ok
i print all my code
pratica.java execute a query to db and return a querytable
java class
import java.util.*;
import java.sql.*;
import coldfusion.sql.*;
public class Pratica {
private HashMap my;
private String URI,LOGIN,PWD,DRIVER;
private Connection conn=null;
//funzione init
//riceve due strutture converite in hashmap
// globals
// dbprop
public Pratica(HashMap globals,HashMap dbprop) {
my = new HashMap();
my.put("GLOBALS",globals);
my.put("DBPROP",dbprop);
URI = "jdbc:sqlserver://it-bra-s0016;databaseName=nmobl";
LOGIN = "usr_dev";
PWD = "developer";
DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
try{
// Carico il driver JDBC per la connessione con il database
MySQL
Class.forName(DRIVER);
/* Connessione alla base di dati */
conn=DriverManager.getConnection(URI,LOGIN,PWD);
if(conn!=null) System.out.println("Connection Successful!");
} catch (ClassNotFoundException e) {
// Could not find the database driver
System.out.print("\ndriver non trovato "+e.getMessage());
System.out.flush();
catch (SQLException e) {
// Could not connect to the database
System.out.print("\nConnessione fallita "+e.getMessage());
System.out.flush();
//funzione search
//riceve un hash map con i filtri di ricerca
public QueryTable search(/*HashMap arg*/) {
ResultSet rs=null;
Statement stmt=null;
QueryTable ret=null;
String query="SELECT * FROM TAN100pratiche";
try{
stmt = conn.createStatement();// Creo lo Statement per
l'esecuzione della query
rs=stmt.executeQuery(query);
// while (rs.next()) {
// System.out.println(rs.getString("descrizione"));
catch (Exception e) {
e.printStackTrace();
try {
ret = Pratica.RsToQueryTable(rs);
} catch (SQLException e) {
e.printStackTrace();
this.close();
return(ret);
// ret=this.RsToQuery(rs);
// this.close(); //chiude le connessioni,recordset e
statament
//retstruct CF vede HashMap come struct
//METODO DI TEST
public HashMap retstruct(){
return(my);
//conversione resultset to querytable
private static QueryTable RsToQueryTable(ResultSet rs)
throws SQLException{
return new QueryTable(rs);
//chiura resultset statament e connessione
private void close(){
try{
conn.close();
conn=null;
catch (Exception e) {
e.printStackTrace();
coldfusion code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN">
<html>
<head>
<title>Test JDBC CFML Using CFScript</title>
</head>
<body>
<cftry>
<cfset glb_map =
createObject("java","java.util.HashMap")>
<cfset dbprop_map =
createObject("java","java.util.HashMap")>
<cfset glb_map.init(glb)> <!---are passed from
another page--->
<cfset dbprop_map.init(glb["DBPROP"])>
<cfset pra =
createObject("java","Pratica").init(glb_map,dbprop_map)>
<cfset ourQuery
=createObject("java","coldfusion.sql.QueryTable").init(pra.search())>
<cfcatch>
<h2>Error - info below</h2>
<cfdump var="#cfcatch#"><cfabort>
</cfcatch>
</cftry>
<h2>Success - statement dumped below</h2>
<cfdump var="#ourQuery#">
</body>
</html>
error at line <cfset pra =
createObject("java","Pratica").init(glb_map,dbprop_map)>
An exception occurred when instantiating a java object. The
cause of this exception was that: coldfusion/sql/QueryTable.
-----------------------------------------------------------------------
Maybe you are looking for
-
AVCHD Rohmaterial, bearbeitet in Premiere CS6, dies exportiert mit H.264 / HD 1080 i25 in mp4 Format, und das Endergebnis bei ca. 15 Filme war problemlos. Jetzt machen die letzten 3 Ärger ( evtl. weil Update CS6.03 ) ? Egal wie ich das Endprodukt a
-
HI, HERE I CREATE IMPORT PO IN ME21N,BUT WHEN I GO FOR INVOICE MIRO, THERE IS NO T COMMISION OF CUSTOM VENDOR APPEARS,THEN I CREATE THE COMISSOINER OF CUSTOM VENDOR, BUT STILL IT IS NOT COMING WHILE CLEARING THE CUSTOM INVOICE IN MIRO
-
Report server engine (9.0.2.0.3)
Hi all, I would like to know whether the Report server Engine is multitasking or not. I installed Oracle application server 9.0.2.03 on a NT2000 environment, and I have two server engine running. If I have 4 or more user requests and if the first rep
-
Hi All: I recently got a new computer, authorized new one with itunes and when I go into my library it has none of my playlists that I originally created. Also, I purchased new songs on itunes and as I did in the past, I connected my ipod Nano to aut
-
Please tell me how to delete all the apps running behind the scene on my iPad?