Encountering exceptions when running a java program in the db
hi,
when running the following following program in oracle11g, AIX (5300-07)
DROP JAVA SOURCE DIRLIST;
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED DIRLIST as import java.io.*;
import java.sql.*;
import java.util.Date;
import java.text.SimpleDateFormat;
public class DirList
public static void getList(String directory)
throws SQLException
File path = new File( directory );
String[] list = path.list();
String element;
for(int i = 0; i < list.length; i++)
element = list;
String fpath=directory+"/"+list[i];
File f = new File(fpath);
long len;
Date date;
String ftype;
String sqldate;
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:S");
if (f.isFile()) {
len = f.length();
date = new Date(f.lastModified());
sqldate = df.format(date) ;
ftype = "F";
else {
len = 0;
sqldate = null;
ftype = "D";
#sql { INSERT INTO DIR_LIST (FILENAME, filelength, filetype, filemodified)
VALUES (:element, :len, :ftype, to_timestamp(:sqldate,'YYYY-MM-DD HH24:MI:SS:FF3'))
we are encountering the following issues..
SQL> sho error JAVA SOURCE DIRLIST
Errors for JAVA SOURCE DIRLIST:
LINE/COL ERROR
0/0 An exception has occurred in the compiler (1.5.0_10). Please
file a bug at the Java Developer Connection
(http://java.sun.com/webapps/bugreport) after checking the Bug
Parade for duplicates. Include your program and the following
diagnostic in your report. Thank you.
0/0 java.lang.NullPointerException
0/0 at
com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:4
80)
LINE/COL ERROR
0/0 at
oracle.aurora.jdkcompiler.JdkDriver.compile(JdkDriver.java:570)
0/0 at oracle.aurora.rdbms.Compiler.compile(Compiler.java:322)
0/0 at oracle.aurora.rdbms.Compiler.access$000(Compiler.java:57)
0/0 at oracle.aurora.rdbms.Compiler$1.run(Compiler.java:324)
0/0 at java.security.AccessController.doPrivileged(Native Method)
0/0 at oracle.aurora.rdbms.Compiler.doCompile(Compiler.java:651)
In trace files there are another set of exceptions that are getting generated when this program is running as shown below
joez_compile_method: failed compiling method oracle/aurora/sqljdecl/SqljDecl.jj_
scan_token with oracle/aurora/zephyr/util/JITCompileException:class java.lang.Ar
rayIndexOutOfBoundsException:null
oracle.aurora.zephyr.util.JITCompileException: class java.lang.ArrayIndexOutOfBo
undsException:null
at oracle.aurora.zephyr.util.Debug.assert_(Debug.java:67)
at oracle.aurora.zephyr.JITDriver.jitMethod(JITDriver.java:197)
at oracle.aurora.zephyr.JITDriver.jitMethod(JITDriver.java:71)
at oracle.aurora.vm.OracleRuntime.jitOneMethod(Native Method)
at oracle.aurora.vm.OracleRuntime.jitSomeMethods(OracleRuntime.java:758)
Caused by: java.lang.ArrayIndexOutOfBoundsException
at java.util.Vector.addElement(Vector.java:582)
at java.util.Stack.push(Stack.java:44)
at oracle.aurora.zephyr.bytecode.ByteCodeToMIR.push(ByteCodeToMIR.java:4
03)
at oracle.aurora.zephyr.bytecode.ByteCodeToMIR.pushRef(ByteCodeToMIR.jav
a:406)
at oracle.aurora.zephyr.bytecode.ByteCodeToMIR.translateBasicBlock(ByteC
odeToMIR.java:1822)
at oracle.aurora.zephyr.bytecode.ByteCodeToMIR.translateMethod(ByteCodeT
oMIR.java:824)
at oracle.aurora.zephyr.bytecode.ByteCodeToMIR.translateMethod(ByteCodeT
oMIR.java:4633)
at oracle.aurora.zephyr.JITDriver.jitMethod(JITDriver.java:125)
... 3 more
We been trying for couple of weeks to figure out the issue.
Has anyone encountered this issue or having solution in rectifying this please share with us..
Thanks
If you mean can you run it as a windows 2000 service so the user doesn't see it yes you can.
I recommend the following Java Service wrapper program:
http://www.eworksmart.com/JNT/
It's quite simple to set up and will start when the user logs in (so long as the service is set to start automatically).
Hope that helps,
Seigers.
Similar Messages
-
Exception while Running a Java Program for UME.
Hi Experts,
I am trying to run a java program to acess UME. Its a sample to create user but all of my samples are throwing this exception in NWDS (Console).Can anyone tell me why is it throwing this exception .
com.sap.security.api.UMRuntimeException: UME factory 'com.sap.security.api.IUserFactory' cannot be accessed because UME initialization has not started yet.
Please check
UMFactory.isInitialized() before using UME functionality.
at com.sap.security.api.UMFactory.checkInitialized(UMFactory.java:1019)
at com.sap.security.api.UMFactory.getUserFactory(UMFactory.java:801)
at Search.main(Search.java:25)
Exception in thread "main"
Thanks in advance
SomilHi,
Earlier i faced the same exception when i tried to call the UME form Standalone java application,To resolve this i used stateless session bean approach. i follow the Below Mentioned Steps,
1:-- create an J2EE -- EJB module project.
2:-- Create stateless session bean and define the require methods ,implement Local and remote interface methods in your bean class.
3:-- refer the UME apis in EJB Projects build path.
4:-- Call UME in Bean class methods.Build the EJB project and Archive.
5:--Now create an Enterprise application Project ,Include the EJB module project to your EA Project by right clicking on EA project.Build EA project and EAR file
6:--Deploy the EAR file on your server.
7:--Now from your standalone java application include these two projects in Project tab of your Application.
8:--Lookup the stateless session bean in your java class by its default JNDI name ,Obtain remote or local Home interface,And execute the BEAN Method which deals with UME.
You can also refer this tutorial in some parts of it UME apis(like IUser,UMFactory) are used in Servelets and EJB ,You can download this tutorial source from SDN for your reference.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/297f35cf-0201-0010-00b2-fe2f3e23d360
Siddharth -
Problem when Running a java program
I am new to Java. I have installed JDK 1.3.1 on my machine. have setup the class path also. My program complies fine but when i am running it I am getting the following error.
Exception in thread "main" java.lang.NoClassDefFoundError: InsertSuppliers
Press any key to continue . . .
I am pasting my java program underneath. Can anybody please help me?
import java.sql.*;
import java.lang.*;
import java.util.*;
import java.io.*;
public class InsertSuppliers
public static void main(String[] args)
throws IOException
System.out.println("iuysuiysuidyfsduyf");
String url = "jdbc:odbc:CafeJava";
Connection con;
Statement stmt;
String query = "select SUP_NAME, SUP_ID from SUPPLIERS";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
try {
con = DriverManager.getConnection(url,
"Admin", "duke1");
stmt = con.createStatement();
stmt.executeUpdate("insert into SUPPLIERS " +
"values(49, 'Superior Coffee', '1 Party Place', " +
"'Mendocino', 'CA', '95460')");
stmt.executeUpdate("insert into SUPPLIERS " +
"values(101, 'Acme, Inc.', '99 Market Street', " +
"'Groundsville', 'CA', '95199')");
stmt.executeUpdate("insert into SUPPLIERS " +
"values(150, 'The High Ground', '100 Coffee Lane', " +
"'Meadows', 'CA', '93966')");
ResultSet rs = stmt.executeQuery(query);
System.out.println("Suppliers and their ID Numbers:");
while (rs.next()) {
String s = rs.getString("SUP_NAME");
int n = rs.getInt("SUP_ID");
System.out.println(s + " " + n);
stmt.close();
con.close();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}Your error occurs because java can not find a file named InsertSuppliers.class in the Classpath. there are 3 basic ways to make this work. Assume you compiled InsertSuppliers so that the InsertSuppliers.class file is in a directory c:\myjava (I am assuming Windows).
1. Do not set your System Classpath. CD to the c:\myjava directory. Enter "java InsertSuppliers"
2. Set your System Classpath = .;c:\myjava and enter "java InsertSuppliers" from any directory.
3. Enter "java -classpath c:\myjava InsertSuppliers" from any directory.
Of course, none of these will work if InsertSuppliers.class file doesn't exist in c:\myjava. And remember that class names are case sensitive. -
Error Message when running first java program
Hi,
I am reading "Sams Teach Yourself Java 6 in 21 Days" by Rogers Cadenhead. I am having a problem with compiling the sample program in the first part of the book, "HelloUser" which is supposed to print out "Hello (my name - Matt)" when run in the command line.
I receive this error when trying to run it after having successfully compiled it (I enter java HelloUser while in correct folder):
Exception in thread "main" java.lang.NoSuchMethodError: main
I have correctly set the PATH and CLASSPATH settings for my PC (Windows XP). I am guessing that I need to define a "main" or something. I'm brand new to Java but am good with the scripting language PHP. Please tell me what I should do to correct this problem. Thanks in advanceHere is the code for the program:
public class HelloUser {
public static void man(String[] arguments) {
String username = System.getProperty("user.name");
System.out.println("Hello " + username);
}Here is what I enter in the Command Line:
cd \JavaWork\j21work
javac HelloUser.java
java HelloUser
There are no problems up until I enter the last line (java HelloUser) to run the program. By the way, I using JDK 6 update 1 with Windows XP. -
Help required - running a Java program from the command line
Hi,
I have a small non-graphical Java application, packaged into a Jar file. My program relies on classes in another (external) Jar file.
When I run the application from the IDE, everything works fine. However, when I try to run the application from the command line, I keep getting a NoClassDefFoundError for classes in the external jar.
Both the application jar file and the external jar file are in my root directory (C:\).
My command line call is as follows:
java -cp c:MyExternalLib.jar -jar MyApp.jar
Any help greatly appreciated.
Thanks,
Walterhi,
set classpath=%classpath%;c:\myjar.jar;
here i have specified myjar.jar file as an example u give ur location.after setting the classpath run ur java application.
java mypgm
this will solve ur problem
regards,
Ganesh -
How to run a Java program without the command line.
Is there anyway to create a Java program that runs like most programs do in Windows ,by double clicking on their icons?
Thanks,
Vancehttp://www.ej-technologies.com/products/exe4j/overview.html
Looks kinda cool. Most java-2-exe programs are usually way too expensive and wont work with GUIs and require other dlls/libraries... -
Problem with running a java program from the command line
I have this code:
package pkg;
import jxl.*;
import java.io.File;
public class TestClass {
public static void main(String[] args) {
try{
Workbook book = Workbook.getWorkbook(new File("d:/testWorkspace/excFile.xls"));
Sheet sheet = book.getSheet(0);
String s=sheet.getCell(4, 2).getContents();
System.out.println(s);
}catch (Exception e){System.err.println(e);}
}I've wrote it in Eclipse, added jxl.jar to the buildpath, and it works fine.
Then I tried to run it from the command line and I did it like this:
D:\testWorkspace\testProject\bin> java -cp \jxl.jar pkg.TestClassThe result was:
Exception in thread "main" java.lang.NoClassDefFoundError: pkg/TestClass
Caused by: java.lang.ClassNotFoundException: pkg.TestClass
...but the file TestClass.class DOES exist in the folder d:\testWorkspace\testProject\bin\pkg\ and the file jxl.jar IS on the root of drive D (like I already wrote, it worked fine inside the Eclipse).
So, my question is: How to run this code from the command line?
I have no idea what went wrong.
Can someone help me, please?The current directory is not implied in the classpath.
D:\testWorkspace\testProject\bin> java -cp .;d:\ pkg.TestClassor
D:\testWorkspace\testProject\bin> java -cp .;d:\jxl.jar pkg.TestClassI always forget which is right since I never work with jars... -
Running a Java program without the JRE...
Hi there,
I was wondering whether it is possible to run my java applications on a system that does not have the JRE installed?
Is there a way to compile the java bytecode into an executable - let's say for windows.
Thank youSee:
http://www.bearcave.com/software/java/comp_java.html
Yair. -
No name found Exception when running entity client program?
Hi
I am deployed an bean managed Entity bean successfully. And also i created one table in SQL . I am usung weblogic server 8.1 . while running Bean managed entity bean client program it throws no name found exception.please guide me how to run a entity client program. i configured JDBC driver for SQL successfully.
Regards
Priya.MHi Priya,
Before running the ejb client we need to follow the steps as given below.
1)set the weblogic environment using the setWLSEnv
2)set the classpath for ejb(home,remote and bean).
3)run the client program
Note:To set the classpath for the ejb(suppose if we placed the ejb's in ejb folder)
set classpath=d:\ejb;.; %classpath%
Regards
Anilkumar kari -
Running a java program in the background
I'm designing a network remote control system in java.
I was wondering does anyone know if it is possible to run an application at the log in screen in windows 2000. There is no GUI and no command prompt.
paddyIf you mean can you run it as a windows 2000 service so the user doesn't see it yes you can.
I recommend the following Java Service wrapper program:
http://www.eworksmart.com/JNT/
It's quite simple to set up and will start when the user logs in (so long as the service is set to start automatically).
Hope that helps,
Seigers. -
How to run a java program in the JVM of an already running program?
As far as I know about JVM, each time we run a program a separate instance of JVM is created where the program runs. Correct me if I am wrong.
Is there any way for another program to execute itself in the same JVM?
Currently I am working on JFCUnit which is a tool used to automate swing applications. I am trying to automate JConsole.
If I open "JConsole.exe" through a program and then try to get the handles using JFCUnit, things are not working.
If I use JConsole.jar in JDK/lib and create a new instance of JConsole and then try to get the handles using JFCUnit, I am able to proceed with automation.
But here comes the problem :-
The application which needs to be automated through JConsole requires it to be started with few arguments, which is as follows:
%JDK_HOME%\bin\jconsole -J-Djava.class.path=%CLASSPATH% -J-Dcom.sun.management.jmxremote.ssl=false -J-Dcom.sun.management.jmxremote.authenticate=true -J-Djmx.remote.protocol.provider.pkgs=oracle.oc4j.admin.jmx.remote "service:jmx:rmi://localhost:23791"So this problem can be solved in two ways,
Either
1. JFCunit could be made to recognize the JConsole.exe which would be running is a different JVM.
OR
2. JConsole.jar to be used in a way so that it takes the required arguments, hereby an instance of JConsole would be created that too in the same JVM as that of the program.
I am more interested in the first solution as it would definitely be helpful in other projects as well.
Please let me know if any other solution is possible.
Any kinda solution is appreciated :)
Thanks in advance.Give a look at Terracota.
http://www.terracottatech.com/ -
I start running a java program and when i switch users the sound doesnt work
When I start running a java program or leave a game running and i switch users the sound doesnt work. I have been searching around the web and nobody seems to have an answer. This just recently started to happen. Please if anyone has any ideas that would be much appreciated and the problem is my computer its almost brand new. And my computer is completely up to date.
Sony Mobile team has a separate community which can be found here.
If my post answers your question, please click on "Accept as Solution" -
How to set path to run a Java program?
my pc os is win2000 service pack 3.
cpu is celoron 667mhz
256 pc133 sdram
i have done the setting b4 run a java program but no any effect.
setting as below:
set path=c:\j2sdk1.4.1_01\bin
set classpath=c:\j2sdk1.4.1_01\lib
my java file is store in C:\Java, file name is HelloWorld.java, so when i type:
C:\>
C:\>Java\javac HelloWorld.java
(the screen show me : java\javac not internal or external........")
and i try again as follow:
C:>
C:>\Java>javac HelloWorld.java
(the screen show : Exception in thread "main" java.lang.NoClassDefFoundError:HelloWorld/java)
i cant do anymore, who can help me?you need to put the CLASSPATH to dir: c:\j2sdk1.4.1_01
and also to the directory you are working
For example, you are working in "C:\Myclasses". You need to put:
set CLASSPATH = C:\j2sk1.4.1_01;C:\Myclasses;
if you don't put your working directory, java doesn't find your classes
Try it and luck! -
How to run a java program in command prompt
hi i want to run a java program from in command prompt from another directory
i want to run a file named First in C:\Program Files\Java\jdk1.6.0_07\bin
so when i give the command
java "C:\Program Files\Java\jdk1.6.0_07\bin\First"
it doesnt works it shows
C:\>java "C:\Program Files\Java\jdk1.6.0_07\bin\First"
Exception in thread "main" java.lang.NoClassDefFoundError: C:\Program Files\Java
\jdk1/6/0_07\bin\First
Caused by: java.lang.ClassNotFoundException: C:\Program Files\Java\jdk1.6.0_07\b
in\First
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: C:\Program Files\Java\jdk1.6.0_07\bin\First. Pro
gram will exit.but it prints
C:\>java -cp "C:\Program Files\Java\jdk1.6.0_07\bin\" First
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
C:\> -
How to compile and run a java program?
I am getting this error message, what to do?
Exception in thread "main" java.lang.NoClassDefFoundError:
Thanks for you help.
AjayHello,
I believe that this error is caused because when you
compile and run a java program, you have to use the
same name that is next to public class. For example,
the program name is next to the word public class.
For example, if a program began like this:
public class Concat
then the name of the program in this case is Concat
and when you compile it you type: javac Concat.java
when you run it type: java Concat
depending on the name of your program.and depending on whether the class is in a package. And depending on what directory you are currently in.
Also depending on if you set your class path you might
have to type the above like this: jdk1.2.1\bin\javac
Concat.java to compile, and to run you would have to
type jdk1.2.1\bin\java Concat where you would replace
Concat with the name of your program and replace
jdk1.2.1 with the name of your version of java, that
is again if you do not have your classpath set. Hope
this helps.Your examples have nothing to do with whether the CLASSPATH is set--only with whether the PATH is set. And, it may not be jdkXXX\bin. The path to the JDK (in this case, to javac and java executables) could be anything. Classpath should be set on the command line. The OP probably did NOT set a classpath on the command line (preferred), or in the environment variables.
Also, make sure you did not forget to put:
public static void main(String[ ] args)
on the line underneath the line where it says "public
class Concat" where Concat is the name of your
program. Again, I hope this helps.Irrelevant (with the info we have from the OP so far). The error says that the JVM can't even find the class--not that the class doesn't have a main. The "main" referred to in the error message is within the JVM itself.
OP: Did you fix your problem? If not, what directory are your files in? Are they in a package? What command are you typing to get that error? That is, please tell us your entire command line.
Maybe you are looking for
-
Please help! i have just update my iphone 4s with 7.4 update and my phone is now asking for a password which i dont have. I have tried my keypad lock i used before the update and also my itunes password and neither work, how do i rectify this ???
-
I now have Windows 8 and I cannot connect to my AirPort Express. Do I need new drivers to fix this?
-
Hi We've installed Content Server 6.40 according to installation guide SAP Content Server for windows (SAP Netweaver 2004s) We've created a repository via tcode CSADMIN. We see server status running when we use url http://192.168.100.121:1090/Content
-
External monitor detected but no picture
I recently tried hooking up my 17 inch LCD gateway monitor to my 13 inch mac. My mac detects it and lists it under display properties however it does not actually have a picture on the monitor. The gateway just stays black or powers on and then goes
-
Question in creating view pages
Hi, I'm pretty new in SharePoint 2010 and I'm trying to design a simple task list in a tabular format. Below is the link to my screenshots https://plus.google.com/photos/111135350719234396436/albums/5969419655213868465?authkey=CK-WxOzIqP3F8wE When I