Issue 69 in django-jython: JNDI not being recognized

31 views
Skip to first unread message

django...@googlecode.com

unread,
Jan 21, 2012, 1:04:43 PM1/21/12
to django-j...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 69 by upadh...@gmail.com: JNDI not being recognized
http://code.google.com/p/django-jython/issues/detail?id=69

What steps will reproduce the problem?
1. Basic django-jython(1.3.0b2) with django(1.3.1) setup using tomcat(6.0)
under eclipse(Eclipse Java EE IDE for Web Developers. Version: Helios
Service Release 2).
2. Using 'doj.backends.zxjdbc.mysql', with
mysql-connector-java-5.1.6-bin.jar. It works if I specify database settings
in settings.py, without JNDI.
3. Documentation
says(http://packages.python.org/django-jython/database-backends.html#jndi-support):
When using JNDI and with the exception of DATABASE_BACKEND, all the other
DATABASE_* options will be ignored by django-jython

What is the expected output? What do you see instead?

Expected: Documentation
says(http://packages.python.org/django-jython/database-backends.html#jndi-support):
When using JNDI and with the exception of DATABASE_BACKEND, all the other
DATABASE_* options will be ignored by django-jython

What I see: The setting DATABASE_OPTIONS is being ignored. JNDI_NAME is
correct, as java uses it correctly to connect to database. Further
intentionally misspelling JNDI_NAME gives no errors or warning. It appears
to being completely ignored.

I have tried both:

DATABASE_OPTIONS = {'JNDI_NAME': 'java:comp/env/jdbc/MyProjectDB'}

And:

'OPTIONS': {'JNDI_NAME': 'java:comp/env/jdbc/MyProjectDB'},

inside DATABASES["default"].

Further, the connection successfully establishes based on database settings
in settings.py despite including JNDI_NAME in either way mentioned above.

What version of the product are you using? On what operating system?

Mac OSX Lion

django...@googlecode.com

unread,
Jan 21, 2012, 1:13:44 PM1/21/12
to django-j...@googlegroups.com

Comment #1 on issue 69 by upadh...@gmail.com: JNDI not being recognized
http://code.google.com/p/django-jython/issues/detail?id=69

Just noticed this bit: "create a file named pollsite.xml". This is not what
I am doing, in my case, "context.xml" exists under META-INF. Which is where
it should be for my java part of my application.

What is pollsite? The project I suppose. In my case I have only got a
settings.py, and a foo.py, which is a servlet:

from javax.servlet.http import HttpServlet
from com.brunchcase import Query

import os
os.environ["DJANGO_SETTINGS_MODULE"] = "settings"

from django.template.loader import render_to_string

class foo(HttpServlet):
def doGet(self,request,response):
self.doPost (request,response)
def doPost(self,request,response):
toClient = response.getWriter()
response.setContentType ("text/html")
toClient.println("<pre>%s</pre>" %
Query(request, "amitu").execute().toString(4))
toClient.println(render_to_string("foo.html", {"name": "amitu"}))
from django.contrib.auth.models import User
print User.objects.all()

I do not have an actual django project. foo.py and settings.py are in
WebContent, and I have got the following in my web.xml:

<servlet>
<servlet-name>PyServlet</servlet-name>
<servlet-class>org.python.util.PyServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>PyServlet</servlet-name>
<url-pattern>*.py</url-pattern>
</servlet-mapping>

Note: All this works as expected, just that JNDI_NAME is being ignored, and
I guess I am not getting connection pooling advantage without it.

django...@googlecode.com

unread,
Feb 6, 2012, 8:54:04 AM2/6/12
to django-j...@googlegroups.com
Updates:
Owner: juneau001

Comment #2 on issue 69 by juneau001: JNDI not being recognized
http://code.google.com/p/django-jython/issues/detail?id=69

(No comment was entered for this change.)

django...@googlecode.com

unread,
Feb 10, 2012, 7:56:24 AM2/10/12
to django-j...@googlegroups.com

Comment #3 on issue 69 by ooso....@gmail.com: JNDI not being recognized
http://code.google.com/p/django-jython/issues/detail?id=69

Seems to be a regression issue.

Current trunk fixes this issue for mysql but still exists for oracle
backend.

django...@googlecode.com

unread,
Feb 10, 2012, 5:30:27 PM2/10/12
to django-j...@googlegroups.com

Comment #4 on issue 69 by juneau001: JNDI not being recognized
http://code.google.com/p/django-jython/issues/detail?id=69

Thanks for the feedback...will look at repair for Oracle backend.

django...@googlecode.com

unread,
Sep 28, 2012, 3:00:54 PM9/28/12
to django-j...@googlegroups.com

Comment #5 on issue 69 by 7...@intrafile.com: JNDI not being recognized
http://code.google.com/p/django-jython/issues/detail?id=69

The latest release 1.30 still is broken for JNDI & MySQL

django...@googlecode.com

unread,
Sep 28, 2012, 7:04:19 PM9/28/12
to django-j...@googlegroups.com

Comment #6 on issue 69 by 7...@intrafile.com: JNDI not being recognized
http://code.google.com/p/django-jython/issues/detail?id=69

When I inspected the common.py in the doj application, I saw that if the
JNDI lookup fails, it creates a regular data source connection - so it
seems that the JNDI specification is being ignored.
However if I comment out the lines in common.py so that it only uses JNDI
connection, I can see that the zxJDBC JNDI lookup is failing. I have tried
{'JNDI_NAME': 'java:comp/env/jdbc/myDataSource'} as well as
{'JNDI_NAME': 'jdbc/myDataSource'}

django...@googlecode.com

unread,
Aug 10, 2014, 4:25:29 AM8/10/14
to django-j...@googlegroups.com
Updates:
Status: Invalid

Comment #7 on issue 69 by andr...@st0cker.at: JNDI not being recognized
http://code.google.com/p/django-jython/issues/detail?id=69

Please try again on the most recent version, if this is still relevant to
you. If still not working, just reopen this ticket.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages