Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!

Tom Griffith

Ranch Hand
+ Follow
since Aug 06, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tom Griffith

After typing path on the command line, and noticing that C:\JAVA6\BIN was at the end, I went backwards through the path string (I am assuming System variables go first and take precedence), I noticed C:\Windows\system32 which is a System environment variable and is much earlier in the Path string.

there is a java.exe in that directory so I think that is why java - version returns 1.7.0_25.

Since it's only a jre, no javac.exe is in C:\Windows/system32.

But wouldn't javac just keep going through the path string until it found javac.exe, which would be under C:\JAVA6\BIN?

I guess don't see how the two environments would really be the source of this error..

but if it is, I can't mess with C:\Windows\system32, namely removing java.exe from there...or shoving javac.exe in there...


I also tried this...literally typing in the path to javac.exe...

C:\Test_Programs>C:\JAVA6\BIN\javac HelloTest.java

still receive the same error...
5 years ago
java version 1.7.0_25 (I'm not sure where this is mapping from, it looks like there might be an oracle client installation which is in the System path variable string)

javac -version - getting same error java.lang.NoClassDefFoundError: com/sun/tools.javac/Main
5 years ago
Hi, I had to download sdk 6 to mimic what somebody (myself) had done a few years ago. Anyways, I just downloaded sdk 6 from oracle, installed sdk to C:\JAVA6...

Went into Environment Variables

Under User variables for myself...Path...added C:\JAVA6\BIN

I get the above error. Am I missing something here? Thank you.
5 years ago
ok, thank you, it seems as though Tomcat by default won't allow brute force connections and forces pooling as deploying ojdbc14.jar with just the war fails to find the driver. Oh, tomcat is running as a windows service and I figured out how to access the service remotely via Computer Manager, restarted the instance, and it registers the ojdbc14.jar driver in the Tomcat lib (and not deploying with the war). thank you again.
5 years ago
ok. So jdbc is sort of a special case to that ordering since Tomcat creates a connection pool to all external databases on startup and can't/won't do it at application deployment. Is that right?
5 years ago
ok. thank you. in the least, the servlet is reading the class (oracle.jdbc.OracleDriver) from the config file although it can't find it, so that's some progress. I still wonder why, although I would change it after testing, ojdbc14.jar can't be deployed ~only~ with the web app (web-inf/lib) and not dumped in commons/lib and be accessible. I would think the Tomcat container would just go to the web app if it couldn't find it registered from commons/lib.

I found this from Tomcat documentation..

Therefore, from the perspective of a web application, class or resource loading looks in the following repositories, in this order:
•Bootstrap classes of your JVM
•System class loader classes (described above)
•/WEB-INF/classes of your web application
•/WEB-INF/lib/*.jar of your web application
•Common class loader classes (described above)


5 years ago
Hi. Yeah, this is a servlet in which I have no access to the source code itself, I have to point it from legacy db to new Oracle db. I have to change the SQL in a config file in which it uses.

I used the same driver when I performed this same operation (repointing the servlet to Oracle) on my local Tomcat using the same driver class (oracle.jdbc.OracleDriver) so I don't ~think~ it's the name, albeit that was with Java 6 (local) and the server is on 1.4. I also tried legacy oracle.jdbc.driver.OracleDriver and it's the same thing, can't find it or whatever.

It seems it can't find it in commons/lib or web_app/web-inf/lib.

Aren't external JARs registered or whatever the moment they are dumped into commons/lib (or deployed with the web app) and don't require a restart.

I only have vpn access to the server (not a virtual desktop or whatever), the server admin is out so I can't really get to any Windows based stuff like Control Panel and sysedit. I have the local drive for the server mapped in windows explorer and can access the drive on the command line. I'm pretty sure Tomcat is registered as a windows service, so it starts up on server restart, so there should be a link to the local jre (but I don't think there's a java-home as a system environment variable due to my initial troubles with the Tomcat startup.bat and shutdown.bat).

Does ojdbc14.jar maybe have to be dumped in all three Tomcat instances commons/lib although I'm only using one? I wouldn't think so.
5 years ago
hi guys. Thank you so much for replying. I think I am kind of close but I was trying to do this without starting the server. I think they have all three Tomcat Instances as a Windows Service, and that's how they start up. I don't know much about that, so I suspect that JAVA_HOME and CATALINA_HOME are not listed as environment or system variables.

This is Tomcat 5 (I want to upgrade this and the jre (1.4) but hopefully be able to just get this going first).

What I am trying to do is run a parallel web app (app_or.war) which uses jdbc to integrate with Oracle. there is one in place (app_ms.war) which is integrating with SQL Server and has been running for years

1. I copied app_or.war to webapps and it seems to deploy the web app, creates the directories, etc.

2. I copied app_or.xml to conf/Catalina/localhost. The contents of app_or.xml includes the Oracle resource, including this under ResourceParams...

<parameter>
<name>driverClassName<.name>
<value>oracle.jdbc.OracleDriver</value>
</parameter>

However, I am getting SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.OracleDriver'

....full stack trace in log is cause: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver


I have tried all alternatives since I read that storing jars in your web app and Tomcat's lib could be an issue. I'v received the same error deploying in these ways...

1. ojdbc14.jar located in %TOMCAT_INSTANCE%/common/lib ~AND~ deployed in the web app (WEB-INF/lib)

2. ojdbc14.jar located in %TOMCAT_INSTANCE%/common/lib BUT NOT deployed with the web app

3. ojdbc14.jar NOT in %TOMCAT_INSTANCE%/common/lib ANd DEPLOYED ONLY with the web app (WEB-INF/lib)

I'm getting the same ClassnotFoundException deploying all three ways. Would you guys know what I'm missing. I would think deploying ojdbc14.jar with the web app would preclude the need to restart Tomcat.

I configured Tomcat 6 (slight differences in the context fle format) on my local and was able to run the servlet, but I had the ability to shutdown, restart, etc. and I had ojdbc14.jar stored in both places (in Tomcat and the web app...as it was in attempt 1 above).

I was also deploying through Tomcat Application Manager thinking there might be a difference doing it that way but it doesn't appear so. Thank you so much again.

5 years ago
Hello. If anybody has a moinute, I have the following stuation...

One server

Three Tomcat instances

remote access for myself via vpn, so I see the hard drive in windows explorer and can access the command line

I tried to run startup.bat, shutdown.bat, restart.bat in order to restart but they all throw can't find file errors.

I suspect they are lacking the java_home and catalina_home environment variables on the server. Even so, I wouldn't know how this would relate to multiple instances.

however, I ~think~ Tomcat starts the instances on server startup, so somehow it manages that or whatever.

Does anybody know the best way in which I could restart after I deploy web apps, lib and/or config stuff? Thank you so much for reading this and for your help.
5 years ago
Hello. If anybody has a minute, I am converting a server based Domino agent which performs SQL against legacy SQL Server (using jtds.jar) to interfacing with Oracle (thin, ojdbc5.jar). I worked out an issue a few days ago which I posted at javaranch.

I went ahead and completed all the recoding locally, added ojdbc6.jar to the agent and the local jvm/lib/ext and it works ok. Now when I try to move it and run this on the server, adding ojdbc6.jar to jvm/lib/ext on the server, I get...

Error while registering Oracle JDBC Diagnosability MBean...java.security.AccessControlException: access Denied (javax.management.MBeanServerPermissioncreateMBeanServer)

The legacy "parallel" agent with the SQL Server driver (jtds.jar) is running fine and has been for years. The agent has security level set to 2 and signer has permissions in the Server document. The policy file looks good with All Permissions and pointing to jvm/lib/ext. Would anybody know what I am missing here and why the server is ok with jtds.jar and not ojdbc6.jar. As I said, I did all development on my local Lotus Notes and it was fine running there.

I've read where there might have been some kind of patches for ojdbc5.jar and ojdbc6.jar but my ojdbc6.jar, when I run java -jar on it says...

Oracle 11.1.0.7.0-Production JDBC 4.0 compiled with JDK6

I think this version is after all that patching stuff, and it works ok and interfaces with Oracle with none of this access issue when I run on local Lotus Notes.

Thank you so much for reading.
Ok. I think I found something. I ran it standalone Java as you suggested K. Tsang and it connected. I remembered something about Lotus Notes and external jars and moved the ojdbc5.jar file to Lotus\Notes\jvm\lib\ext directory and it seems to work ok now now. I have ojdbc5.jar as part of the "project" in the agent so apparently external jars have to go to Lotus\Notes\jvm\lib\ext as well. There must be a way to not have to do that since they have the option to add to the agent "project" but at least this vague error has 86'd itself (for now, hopefully forever, but I haven't even started the SQL).

Thank you again for reading about this hurdle, guys.
Dave, thank you. yeah, like earlier, I go to the Oracle site and when I follow the link to ojdbc5.jar or ojdbc6.jar, they take me to some other "overview" page, I can't seem to locate the specific jars for download...

I have to find out what version of Oracle form the admins. I'm starting to think it's not the drivers though since ojdbc14.jar which I've used for years threw the same thing. I have to set up the jdk on the lotus notes pc to run standalone outside of lotus notes, but ultimately, this has to run in lotus notes.
I was just thinking about it,, I didn't download ojdbc5 and ojdbc6 from Oracle because I couldn't find them I downloaded them from www.java2s.com. Could they be screwed up versions, maybe? I still cant find where to download tem direct from Oracle...

But then again, the code with ojdbc14.jar (which I've used for years) is throwing practically the same exception with the full stack trace, just from a different method...it has this at the top

at oracle.gss.util.NLSLocale.getNLSLanguage(NLSLocale.java.675)...then the rest of the trace is viertually the same across all ojdbc14, ojdbc5, ojdbc6

I've been googling on the T4CTTloadAuthenticate.SetSessionFields and see people with apparently the same issue but no solutions yet. Ugh. But the first line of the trace using ojdbc14 seems to indicate a Locale language issue, whatever that is.
Dave, here is a full stack trace...I can't make anything out of it except something with authentication, but it seems to be with te driver and not on the server...

DEFAULT EXCEPTION - java.lang.ArrayIndexOutOfBoundsException: Array index out of range: -1
at oracle.jdbc.driver.T4CTTIoauthenticate.setSessionFields(T4CTTIoauthenticate.java:948)
at oracle.jdbc.driver.T4CTTIoauthenticate.<init>(T4CTTIoauthenticate.java:225)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:351)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
at java.sql.DriverManager.getConnection(DriverManager.java:322)
at java.sql.DriverManager.getConnection(DriverManager.java:358)
at JavaAgent.NotesMain(JavaAgent.java:58)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
Thank you so much for replying and for your help.

I'm not exactly sure what jvm lotus notes 8.5.3 is running (I know 8.5.3 is running jvm6) so I tried both ojdbc5 and ojdbc6. Give the same error.

The code is doing virtually nothing else (except some object declarations). I've eliminated everything else to try to get to the source of this issue. It's a local Lotus notes agent and I have the connection in it's own try block where the OutOfBoundsexception is caught...


I also fixed the class.forName, same errors...



Class.forName("oracle.jdbc.OracleDriver").newinstance;

try {

Connection conn=DriveManager.getConnection("jdbc:oracle:thin:@server.here.com:1521:TSTSID","username"."password");

} catch (SQLException se) {

System.out.println("SQL Exception - " + se.toString());

} catch (Exception e) {

''THIS PRINTS OUT Of BOUNDS EXCEPTION -1
System.out.println("e.toString());

} finally {

conn.close();

}

This is driving me crazy.

now it gets weirder. I just tried something, if I put something bogus in for the URL, like

Connection conn=DriveManager.getConnection("jdbc:oracle:thin:@WACKY.com:1521:TSTSID","username"."password");

the error is then "The network Adapter could not establish the connection"...

but putting the real URL back, it's back to the java.lang.ArrayIndexOutOfBoundsException: Array index out of range -1