java.lang.SecurityException: Prohibited package name: java.sql

hi,

i am trying to push a java application onto a JRun 3.1 server connecting to a oracle 8 database. in my servlet initialization, i use a connection pool to gain a connection to the database.

Class.forName("oracle.jdbc.OracleDriver");
outConn = DriverManager.getConnection(outUrl, outUsername, outPassword);
//throws error at the above line

this will throw an error:
java.lang.SecurityException: Prohibited package name: java.sql

this error is most peculiar because it runs fine locally on my developers version of JRun 3.1. but when i push it to a licensed version on a different server it gives this error. any hints?
echuta86Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimYatesCommented:
Does the other server have a policy file like this (in the java.security file in your ${JAVA_HOME}/jre/lib/security)

--------------------

#excerpted from java.security. Each property
#takes a comma delimited
#list of package prefixes. Security checks
#apply only to packages
#that begin with an exact string match
#of one of these prefixes.

package.access=java.sql

--------------------

If so, whatever genius set up the machine blocked all java.sql.* classes from being able to run
0
echuta86Author Commented:
another bit of info:

when i write a standalone script that has the same code, and i run it locally, it gives me the same error. i put nothing into the classpath except these files (plus the classes i developed):

@set CP=%CP%;%JAVA_HOME%\jre\lib\rt.jar
@set CP=%CP%;C:\projects\utils\lib\ojdbc14.jar

so Tim, it might not be the security file because i looked locally and the only line that prohibits package access is:

package.access=sun.

and i reiterate that it works locally on my JRun server but not on a different machine running JRun.
0
objectsCommented:
> C:\projects\utils\lib\ojdbc14.jar

Whats in this jar?
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

echuta86Author Commented:
ojdbc14.jar is oracles jdbc connection classes.

i have a thought that maybe the problem is caused by the oracle driver's use of java.sql classes.
0
objectsCommented:
Try include the package in the 'ext' directory instead of in the classpath.

Also why are you adding rt.jar? I'd also remove that.
0
echuta86Author Commented:
i've tried to add the ext directory and i also removed rt.jar but i still get the error. the reason i had rt.jar was because the oracle driver apparently is implementing the java.sql.Savepoint interface which is making it's first appearance in JDK1 1.4. so i've added that specific class to the path instead of the whole jar file.
0
objectsCommented:
What JDK is it running? You can't just add rt.jar to include 1.4 support.
If the driver requires 1.4 then you need to install 1.4.

Sounds like this could be the cause of your problem.
0
echuta86Author Commented:
hmmm..... object, you might be leading me to the answer. in jrun, i've explicitly set the JDK to 1.4 in the server settings for my machine.

might i be incorrectly setting the JDK in my script?
this is my whole script:(project\... are my own class files)

@set JAVA_HOME=C:\j2sdk1.4.1_01

@set CP=%CP%;C:\projects\conventions\classes
@set CP=%CP%;C:\projects\utils\classes
@set CP=%CP%;C:\projects\utils\lib\ojdbc14.jar
@set CP=%CP%;C:\j2sdk1.4.1_01\jre\lib\

java -classpath %CP% tl.conventions.utils.ConventionSynchronizer

@pause

0
echuta86Author Commented:
btw, i only have 1.4.1_01 installed on my machine.
0
TimYatesCommented:
you might need

@set CP=%CP%;C:\j2sdk1.4.1_01\jre\lib\ext

as well...
0
objectsCommented:
> @set CP=%CP%;C:\j2sdk1.4.1_01\jre\lib\

you shouldn't need this line.


0
echuta86Author Commented:
without that line, @set CP=%CP%;C:\j2sdk1.4.1_01\jre\lib\
my script will not run, and complains that there is no java.sql.Savepoint. this would leave me to believe that my system variables might not be set up correctly. but all i need is to set these correct?

JAVA_HOME=C:\j2sdk1.4.1_01
CLASSPATH=C:\j2sdk1.4.1_01
 
and add C:\j2sdk1.4.1_01\bin to the PATH sys var.
0
objectsCommented:
try:

@set JAVA_HOME=C:\j2sdk1.4.1_01

@set CP=%CP%;C:\projects\conventions\classes
@set CP=%CP%;C:\projects\utils\classes
@set CP=%CP%;C:\projects\utils\lib\ojdbc14.jar

%JAVA_HOME%\bin\java -classpath %CP% tl.conventions.utils.ConventionSynchronizer

@pause

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
echuta86Author Commented:
awesome. thanks tim & objects for the input. this should solve my other problem on the server because it's running 1.3.

for future developers:
note1: java.sql.Savepoint is a new interface in JDK1.4
note2: you cannot include any class that begins with java.* unless they are already part of the original JDK. in my case i tried to extract the java.sql.Savepoint class from 1.4 and include it in my classpath in a JDK1.3 env.

your a lifesaver objects.
0
echuta86Author Commented:
followed up questions very fast and efficiently.
0
objectsCommented:
happy to hear it's fixed :)

thanks for the points.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.