if we create a java source using below way in oracle
CREATE JAVA SOURCE NAMED "Welcome" AS
public class Welcome {
public static String welcome() {
System.out.println("Welcome "); }
}
/
Where can i see the message ?
Reason for Why I am asking for this Question is .
Right now I am debugging one Email Sending Application(Alerts). The application is working fine for the alerts doesnt have any attachment, but if there is any attachment I am getting Java call Terminated by uncaught Java Exception java.lang.NoClassDefFoundError
The application Flow is as below
PLSQL Package (Here we fetch all the data and call Java Source)
JAVA Source (XXABC_SENDMAIL.sendMail is use to send the mail)
When I put DBMS.output I can reach till the point where JAVA source call is happening , but i need to find , at exactly which place the JAVA error is getting thrown.
I got the EXACT answer from the below link..
http://blogs.dayneo.co.za/2012/11/simplest-way-to-debug-your-oracle-java.html
Direct from the Link
dayneo#RMSD> CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED SimpleSample as
2 public class SimpleSample
3 {
4 public static void simplemsg()
5 {
6 System.out.println(new java.util.Date().toString() + ": Hello world!");
7 }
8 }
9 /
Java created.
dayneo#RMSD> create or replace procedure simplesample_says as
2 language java name 'SimpleSample.simplemsg()';
3 /
Procedure created.
dayneo#RMSD> set serveroutput on size 1000000
dayneo#RMSD> call dbms_java.set_output(1000000);
Call completed.
dayneo#RMSD> begin
2 simplesample_says();
3 end;
4 /
Mon Nov 05 15:37:03 GMT+02:00 2012: Hello world!
PL/SQL procedure successfully completed.
its more or less the same as the
Stack overflow question "where does system.out.println output goes in oracle java class"
but I feel the link fits 100% to my question.
Related
I try to add before migration and after migration scripts as callbacks to flyway for compiling my views, procedures, functions etc.
Is there a possibility to stop it before a migration process or have a rollback when before or after scripts fail (or rather return a warning)?
Cause the only thing I see right now is I receive warnings like this
[WARNING] DB: Warning: execution completed with warning (SQL State: 99999 - Error Code: 17110)
and it goes on, without stopping.
I thought about FlywayCallback interface and it's implementation but I'm not entirely sure how it should be done with compiling.
I'm using Spring Boot 1.2.5 with the newest Flyway.
I have also same error. SQL State: 99999 - Error Code: 17110. i found this solution.
check which version under this warning and that version under sql script check have Trigger or any procedure which not closed properly.
close trigger or any procedure if oracle DB / end of trigger.
ex:
CREATE OR REPLACE TRIGGER Print_salary_changes
BEFORE DELETE OR INSERT OR UPDATE ON Emp_tab
FOR EACH ROW
WHEN (new.Empno > 0)
DECLARE
sal_diff number;
BEGIN
sal_diff := :new.sal - :old.sal;
dbms_output.put('Old salary: ' || :old.sal);
dbms_output.put(' New salary: ' || :new.sal);
dbms_output.put_line(' Difference ' || sal_diff);
END;
/
Flyway 5.0 now comes with a feature called Error Handlers that lets you do exactly this. You can now create an error handler that turns that warning into an error as simply as
import org.flywaydb.core.api.FlywayException;
import org.flywaydb.core.api.errorhandler.Context;
import org.flywaydb.core.api.errorhandler.ErrorHandler;
import org.flywaydb.core.api.errorhandler.Warning;
public class OracleProcedureFailFastErrorHandler implements ErrorHandler {
#Override
public boolean handle(Context context) {
for (Warning warning : context.getWarnings()) {
if ("99999".equals(warning.getState()) && warning.getCode() == 17110) {
throw new FlywayException("Compilation failed");
}
}
return false;
}
}
More info in the docs: https://flywaydb.org/documentation/errorhandlers
I had the same error when my scripts had a "CREATE TABLE XXX AS SELECT..." statement.
I fixed it by splitting it into two separate statements:
CREATE TABLE XXX (columns def...);
INSERT INTO TABLE XXX (columns...)
SELECT...;
I am just trying to plant AJAX Chat for my website users. I have successfully completed the installation process with database configuration. But when I am trying to brows the domain.com/ajaxchat/index.php its returning this error given below:
XML Parsing Error: junk after document element Location: http://futurenext.esy.es/inc/chat/ Line Number 2, Column 1:
I think that the problem is in AJAXChatTemplate.php , and here the code is:
function getContent() {
if(!$this->_content) {
$this->_content = AJAXChatFileSystem::getFileContents($this->_templateFile);
}
return $this->_content;
And the error message is like:
" Non-static method AJAXChatFileSystem::getFileContents() should not be called statically, assuming $this from incompatible context in line 37"
Now please any one can help me to fix the problem. What is the problem here I can't really understand. Thanks.
I have a batfile that I want to call from java. I made a nashorn script, that runs successfully from commandline and from Netbeans 'run' command. Here it is:
#!C:/Program Files/Java/jdk1.8.0_25/bin -fv
$ENV.PWD = 'C:/Hydromodel/MapGenerate';
$EXEC("cmd /c start cmd_all.bat");
print ('finished!');
I try to call the script from java this way:
public class RunCmd {
public void nashornTest() {
ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
try {
Object eval = engine.eval("load('src/simple/a_test.js');");
//Object eval = engine.eval(new FileReader("C:/_Udvikling/Maven/realtid_2014/src/main/java/simple/a_test.js"));
} catch (Exception ex ) {
Logger.getLogger(CmdTest.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Both ways I get this error:
Severe: javax.script.ScriptException: TypeError: Cannot load script from src/simple/a_test.js in <eval> at line number 1
Even if the javascript file is reduced to:
print ('hello!');
I also tried this SO proposed way
The Error stays.
I googled, but most people seem to use Linux or Mac when writing about Nashorn.
Should I do anything special to call Nashorn from java on a Windows box?
mbwiese
I am running Netbeans 8 and JDK 8 with Glassfish 4.1 on Windows 7
I can't call a java wrapping service in Acceleo because it doesn't recognize parameters type. This is my simple test code: the main calls a query stored in Services.mtl, that calls the java service that just return the name of an object "Send"
Main.mtl
[file ('system.P', false, 'UTF-8')]
[for (t : Send | aSystemBehavior.transitions)) ]
[getName(t)/]
[/for]
[/file]
Services.mtl
[query public getName(arg0 : Send) : String
= invoke('myPackage.Services', 'getName(myPackage.Send)', Sequence{arg0})
/]
Services.java
public class Services
{
public String getName(Send t)
{return t.getName();}
}
The Error Log shows:
Invalid result for expression
self.invoke('myPakage.Services',
'getName(myPakage.Send)', Sequence {arg0}) at line 0 in
Module services for query getName(Send). Last recorded value of self
was org.eclipse.emf.ecore.impl.DynamicEObjectImpl#1f00eb36 (eClass:
org.eclipse.emf.ecore.impl.EClassImpl#2c2aade3 (name: Send)
(instanceClassName: null) (abstract: false, interface: false)).
Problem found while generating the file system.P'.
If I use a String as parameter type instead of Send, everything works fine.
Does the package containing the service "Services" has been exported? If not, open the file MANIFEST.MF, go in the runtime tab and add its package to the list of exported packages. Are you sure that your "Send" object has a name? This message only indicates that null was returned by the query getName.
I don't have anymore this problem... I created a new Acceleo project from scratch, and it works. I am not sure what was the problem... maybe it's something about che choice of metamodels to import during the creation of the Module (I have to choose between run-tim and develop-time metamodel).
ORACLE 11g - COLDFUSION 9 - REF CURSOR - WITH at least one in variable.
How in ColdFusion with in variables get a Oracle stored procedure to return values?
We have tried several things, we can get a stored procedure to return a result set if we are not passing in variables but we cannot get them when we are passing in variables.
We know how to do it calling MS SQL.
Thanks for any help
P.S. we have heard this may not be possible with the current Oracle Driver is there a different Oracle driver?
From what I have been reading online I am thinking this is not just a coding issue. I hope I am wrong about that. This is just an example I was working on as a proof of concept so I can start creating all of them. I can get it work if I am not using a ref cusor.
Error Executing Database Query.
[Macromedia][Oracle JDBC Driver]The specified SQL type is not supported by this driver.
The error occurred in D:\apache\htdocs\test\index.cfm: line 86
84 :
85 :
86 :
87 :
88 :
CF Call to procedure
<cfstoredproc procedure="BWNGDBADEV.PACK_REFCURSOR.GETALL" datasource="mydatasourcename" returncode="no">
<cfprocparam type="InOut" cfsqltype="CF_SQL_INTEGER" variable="pPERSONNELID" value="4" null="No">
<cfprocparam type="Out" cfsqltype="CF_SQL_REFCURSOR" variable="AnyVarName">
<!--- *** This name ties StoredProc results to the query below *** --->
<cfprocresult name="myvar">
</cfstoredproc>
Oracle Package
CREATE OR REPLACE
PACKAGE PACK_REFCURSOR
AS
TYPE EMP_TableRows
IS
REF
CURSOR
RETURN BWNGDBADEV.PER_PERSONNEL%ROWTYPE;
PROCEDURE GETALL(
pPERSONNELID IN OUT BWNGDBADEV.PER_PERSONNEL.PERSONNELID%type,
OUTTABLE OUT EMP_TableRows);
END PACK_REFCURSOR ;
/
CREATE OR REPLACE
PACKAGE BODY PACK_REFCURSOR
AS
PROCEDURE GETALL(
pPERSONNELID IN OUT BWNGDBADEV.PER_PERSONNEL.PERSONNELID%type,
OUTTABLE OUT EMP_TableRows)
IS
BEGIN
-- implicit cursor is opened - no close needed ***
OPEN OUTTABLE FOR
SELECT *
FROM BWNGDBADEV.PER_PERSONNEL
WHERE PERSONNELID = pPERSONNELID;
END GETALL ;
END PACK_REFCURSOR ;
/
do you have the latest DataDirect JDBC drivers ?
v 3.5 drivers and release notes here: http://kb2.adobe.com/cps/000/42dcb10a.html
the release notes suggest it fixes your exact problem
There's a small note in the docs stating: "You cannot use the cfprocparam tag for Oracle 8 and 9 reference cursors. Instead, use the cfprocresult tag."
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7d52.html
Try something along these lines:
<cfstoredproc
procedure = "BWNGDBADEV.PACK_REFCURSOR.GETALL"
dataSource = "mydatasourcename"
returnCode = "Yes">
<!--- cfprocparam tags --->
<cfprocparam type="InOut" cfsqltype="CF_SQL_INTEGER" variable="pPERSONNELID" value="4" null="No">
<cfprocparam type="Out" cfsqltype="CF_SQL_REFCURSOR" variable="AnyVarName">
<!--- cfprocresult tags --->
<cfprocresult name="RS1" resultSet="1">
<cfprocresult name="RS2" resultSet="2">
</cfstoredproc>