LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-01-2009, 12:23 AM   #1
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Question XS denied - why? pls hlp!


Hi,

I am building a project where Java and MySQL are used together. It is a client-server project with F10 @ client side and CentOS5.2 @ server side. I use ConnectorJ as driver. There is a java.policy in place that allows a connect from anywhere on poerts above 1024, the line is:

Quote:
grant codeBase "file:/var/www/html/Tr/-"
{
permission java.net.SocketPermission "*:1024-65535","listen,connect,accept,resolve";
}
I have embedded the login data (login/password) into the code, using these to log in (locally and remotely via phpMyAdmin) is possible, and the grant to the required database has been set. However, when my module tries to log in, I get an access denied. The URL to connect to the database is:

Quote:
jdbc:mysql:192.168.1.75/Central1
Needless to mention the database Central1 @ 192.168.1.75 exists; has the appropriate user, with the appropriate grants...

The stackdump is as follows:

Quote:
Standard exception : Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: java.security.AccessControlException: access denied (java.net.SocketPermission 192.168.1.75:3306 connect,resolve)

STACKTRACE:

java.net.SocketException: java.security.AccessControlException: access denied (java.net.SocketPermission 192.168.1.75:3306 connect,resolve)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2569)
at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at t1.axt.s1.cps.C1.doConn(C1.java:103)
at t1.axt.s1.cps.C1.<init>(C1.java:57)
at t1.axt.s1.Tr.doPrepComponents(Tr.java:1643)
at t1.axt.s1.Tr.doConnect(Tr.java:410)
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:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)

** END NESTED EXCEPTION **

Last packet sent to the server was 74 ms ago.
Please help! Any delay eats in my project time and I lost quite some time just moving from *** to CentOS already...

Big TNX!!

Thor

PS I do hope this is the right place to put this call 4 help, it IS a programming problem, but also a server problem, or even a networking problem, but it IS a ... problem...
 
Old 06-01-2009, 09:12 AM   #2
kellinwood
Member
 
Registered: Jan 2006
Location: Culver City, California
Distribution: Fedora
Posts: 64

Rep: Reputation: 21
Is this Java code an Applet running in a browser by any chance? I ask because Applets are only allowed to connect to the same server and port that the applet was loaded from in the first place, and this is exactly the exception I would expect in that case.
 
Old 06-02-2009, 09:42 AM   #3
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766

Original Poster
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
and...right you are :-)

Indeed, but I solved it. The exception (and stack dump) happened on the server, I ommitted the "codebase" clause in the policy file, that would seem to have helped, conflict between that and the classpath? Possibly.

Tnx!!

Thor
 
  


Reply

Tags
access, denied, java, mysql



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java and PHP - pls hlp ButterflyMelissa Linux - Software 5 04-11-2009 03:14 AM
Alternative JVM - pls hlp ButterflyMelissa Programming 4 04-02-2009 01:40 PM
installation probs pls hlp ZINZIN Linux - Newbie 4 03-18-2006 01:58 AM
macromedia flash for linux hlp pls!!!! mlu Linux - Software 3 12-01-2004 10:20 PM
mozilla firefox with JRE 1.5 hlp pls!!!! mlu Linux - Software 1 11-30-2004 06:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration