[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-developers] jsp/jdbc woes on raq4
- Subject: Re: [cobalt-developers] jsp/jdbc woes on raq4
- From: "Bill Kuhn" <bill@xxxxxxxxxx>
- Date: Wed Nov 28 08:45:29 2001
- List-id: Discussion Forum for developers on Sun Cobalt Networks products <cobalt-developers.list.cobalt.com>
Thanks for those who took the time to answer my question. Although I had
figured out after my original post that I could edit the
tomcat.policy.master file to grant permissions to the postgresql jdbc
driver, the other ideas (placing the jar in /usr/java/jakarta-tomcat/lib or
placing the jar in the site's web/WEB-INF/lib directory) will surely come in
handy as I develop.
Thanks again for your thoughts.
-Bill
----
Bill Kuhn
bill@xxxxxxxxxx
----- Original Message -----
From: "Timothy Stonis" <timothy.stonis@xxxxxxx>
To: <cobalt-developers@xxxxxxxxxxxxxxx>
Sent: Tuesday, November 27, 2001 3:44 PM
Subject: Re: [cobalt-developers] jsp/jdbc woes on raq4
>
> The postgres driver does not have the correct permissions. Edit the
> /usr/java/jakarta-tomcat/conf/tomcat.policy.master file.
>
> Look for the lines:
>
> grant codeBase "file:/usr/interclient/-" {
> permission java.security.AllPermission;
> };
>
> Copy those lines, and add the path to your postgres jar file. Restart
the
> web server as directed in the instructions.
>
> -OR-
>
> Put the postgres jar file in /usr/java/jakarta-tomcat/lib/ and restart
the
> web server.
>
> _Tim
>
>
>
> On 11/27/01 9:26 AM, "Bill Kuhn" <bill@xxxxxxxxxx> wrote:
>
> > I hope someone may be able to help.
> >
> > I recently installed the cobalt java development package and update on a
> > raq4. I ran a simple test jsp and that worked fine.
> >
> > My goal is to develop an application that will store data in a
relational
> > database. I'm more familiar with postgresql than mysql so I created a
> > database in postgresql, added the postgresql jdbc .jar file to the
CLASSPATH
> > in /etc/profile.d/java.sh (and re-sourced that file in my open shell),
and
> > wrote and compiled a simple java program to test loading the driver and
> > connecting to the database. That test was a success. The java program
> > loaded the driver and connected to the database.
> >
> > I then wrote a simple database test jsp (named dbtest.jsp) as follows:
> > <%@ page import="java.sql.*" %>
> > <html>
> > <body>
> > <%
> > Connection connection = null;
> > Class.forName("org.postgresql.Driver");
> > connection =
> > DriverManager.getConnection("jdbc:postgresql:hometeam","admin",
> > "");
> > connection.close();
> > %>
> > </body>
> > </html>
> >
> > I restarted apache/tomcat to re-source java.sh so that the postgresql
jdbc
> > .jar file would be in tomcat's CLASSPATH and, once the apache/tomcat was
> > back up I tried to access dbtest.jsp in my browser and received the
> > following error:
> > Error: 500
> > Location: /secure/dbtest.jsp
> > Internal Servlet Error:
> >
> > javax.servlet.ServletException: Something unusual has occured to cause
the
> > driver to fail. Please report this exception:
> > java.security.AccessControlException: access denied
> > (java.net.SocketPermission localhost resolve)
> > at
> >
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
> > l.java:459)
> > at
> >
secure._0002fsecure_0002fdbtest_0002ejspdbtest_jsp_24._jspService(_0002fsecu
> > re_0002fdbtest_0002ejspdbtest_jsp_24.java:75)
> > at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
> >
org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.ja
> > va:130)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
> >
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
> > va:282)
> > at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
> > at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
> > at org.apache.tomcat.core.Handler.service(Handler.java:287)
> > at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> > at
> >
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
> > 2)
> > at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
> > at
> >
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> > (Ajp12ConnectionHandler.java:166)
> > at
> >
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
> > at
> >
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
> > at java.lang.Thread.run(Thread.java:484)
> >
> > Root cause:
> > Something unusual has occured to cause the driver to fail. Please report
> > this exception: java.security.AccessControlException: access denied
> > (java.net.SocketPermission localhost resolve)
> > at org.postgresql.Driver.connect(Driver.java:125)
> > at java.sql.DriverManager.getConnection(DriverManager.java:517)
> > at java.sql.DriverManager.getConnection(DriverManager.java:177)
> > at
> >
secure._0002fsecure_0002fdbtest_0002ejspdbtest_jsp_24._jspService(_0002fsecu
> > re_0002fdbtest_0002ejspdbtest_jsp_24.java:65)
> > at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
> >
org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.ja
> > va:130)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
> >
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
> > va:282)
> > at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
> > at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
> > at org.apache.tomcat.core.Handler.service(Handler.java:287)
> > at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> > at
> >
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
> > 2)
> > at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
> > at
> >
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
> > (Ajp12ConnectionHandler.java:166)
> > at
> >
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
> > at
> >
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
> > at java.lang.Thread.run(Thread.java:484)
> >
> >
> > I'm not sure what could be going wrong. I see that the Driver loads
> > properly so I'm not dealing with a class not found problem.
> >
> > The security policy in tomcat.policy is the default created by
> > cobalt_config.pl and that looks reasonable:
> > grant codeBase "file:/home/sites/site31/web/-" {
> > permission java.net.SocketPermission "localhost:1024-",
> > "listen,connect,resolve"
> > ;
> > permission java.util.PropertyPermission "*", "read,write";
> > permission java.lang.RuntimePermission "accessClassInPackage.sun.io";
> > permission java.io.FilePermission "/home/sites/site31/web/-",
> > "read,write,delete
> > ";
> > };
> >
> > If I understand the above security policy correctly, my jsp should have
no
> > difficulty connecting to the postgresql server on 5432 on localhost.
> >
> > By the way, I also tried various other jdbc urls to no avail:
> > jdbc:postgresql://localhost/hometeam
> > jdbc:postgresql://localhost:5432/hometeam
> > jdbc:postgresql://127.0.0.1/hometeam
> > jdbc:postgresql://127.0.0.1:5432/hometeam
> > jdbc:postgresql://<ip address>:5432/hometeam (where <ip address> is the
ip
> > address assigned to the nic)
> >
> > Any assistance would be greatly appreciated.
> >
> > Thanks,
> > Bill Kuhn
> >
> > ----
> > Bill Kuhn
> > bill@xxxxxxxxxx
> >
> > _______________________________________________
> > cobalt-developers mailing list
> > cobalt-developers@xxxxxxxxxxxxxxx
> > http://list.cobalt.com/mailman/listinfo/cobalt-developers
> >
>
> _______________________________________________
> cobalt-developers mailing list
> cobalt-developers@xxxxxxxxxxxxxxx
> http://list.cobalt.com/mailman/listinfo/cobalt-developers
>