I am trying to use cgi to navigate from a python3 program and php program ( joomla 3.86 on raspberry )
the following simple program is ok and an html page opens when I launch it from localweb.
#!/usr/bin/python3
import cgi
print("Content-type: text/html\n\r\n")
print()
print("essai print")"""
but when I try to launch the following formtest.py program ( ultimately I want to do it with a php program )
#!/usr/bin/python3
import cgi
print("Content-type: text/html")
print()
print("<html>")
print("<FORM ACTION="192.168.4.1/cgi-bin/echo.py" METHOD="POST">")
print("<INPUT TYPE="submit" NAME="send" VALUE="Exécuter le script"></FORM>")
print("</html>")
where echo.py is also simple and works alone when launched from local site ( all programs are placed in www/cgi-bin/ )
#!/usr/bin/python3
import cgi
print("Content-type: text/html\n\r\n")
print()
print("essai print")
I get the following error ( seen from etc/apache2/error log ) :
Sat Jul 11 11:45:48.291525 2020] [cgi:error] [pid 17883] [client 192.168.4.1:49084] AH01215: File "/var/www/cgi-bin/formtest.py", line 8: /var/www/cgi-bin/formtest.py
[Sat Jul 11 11:45:48.291773 2020] [cgi:error] [pid 17883] [client 192.168.4.1:49084] AH01215: print("<form action="echo.php" method="POST">"): /var/www/cgi-bin/formtest.py
[Sat Jul 11 11:45:48.291830 2020] [cgi:error] [pid 17883] [client 192.168.4.1:49084] AH01215: ^: /var/www/cgi-bin/formtest.py
[Sat Jul 11 11:45:48.291882 2020] [cgi:error] [pid 17883] [client 192.168.4.1:49084] AH01215: SyntaxError: invalid syntax: /var/www/cgi-bin/formtest.py
[Sat Jul 11 11:45:48.317873 2020] [cgi:error] [pid 17883] [client 192.168.4.1:49084] End of script output before headers: formtest.py
I tried all combinations with and without html code , different adresses for echo.py ( cgi-bin/formtest.py , 192.168.4.1/cgi-bin/ etc
I removed either the form action line or the input line and got the same nasty error
Strange because I saw at least 2 sites showing this king of form action link with python3 and cgi pointing to a .py program .
Next question is , if you can solve my problem , can I do it with a PHP program ?
thanks very much to get interested with my problem
Bernard
I found a solution : just put the whole html code under a same print using """
#!/usr/bin/python3
print("Content-type: text/html")
print("""
<FORM ACTION="echo.php" METHOD="post">
<INPUT TYPE="submit" NAME="send" VALUE="Action">
</FORM>
""")
and the program pointing to can be .py or .php
hope this can help someone one day
Bernard
Related
Team,
I am able to successfully generated the coverage.dat file but I cannot generate htlm to view the report. anything that am missing? am new to this.
./bazel coverage --combined_report=lcov //src/teams/test/...
output
Command> ./bazel coverage --combined_report=lcov //src/teams/test/...
INFO: Invocation ID: 48b15c3a-43bb-435c-97d5-e608703cc53a
INFO: Using default value for --instrumentation_filter: "^//src/teams/test/keys[/:],^//src/teams/test/server[/:],^//src/teams/test/store/postgres[/:],^//src/teams/test/tools/keyrotate[/:],^//src/teams/test/vault[/:]".
INFO: Override the above default with --instrumentation_filter
INFO: Build option --instrumentation_filter has changed, discarding analysis cache.
DEBUG: Rule 'distroless' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1564086429 -0400"
DEBUG: Repository distroless instantiated at:
/Users/userme/code/company/git-team/product/WORKSPACE:32:20: in <toplevel>
/private/var/tmp/_bazel_userme/e6e1d0cbd051dd43ed59dca5541f019d/external/product/wkspc/phase0.bzl:62:23: in static_repositories
Repository rule git_repository defined at:
/private/var/tmp/_bazel_userme/e6e1d0cbd051dd43ed59dca5541f019d/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in <toplevel>
INFO: Analyzed 33 targets (68 packages loaded, 21664 targets configured).
INFO: Found 28 targets and 5 test targets...
INFO: LCOV coverage report is located at /private/var/tmp/_bazel_userme/e6e1d0cbd051dd43ed59dca5541f019d/execroot/product/bazel-out/_coverage/_coverage_report.dat
and execpath is bazel-out/_coverage/_coverage_report.dat
INFO: From Coverage report generation:
Dec 09, 2022 11:36:27 AM com.google.devtools.coverageoutputgenerator.Main getTracefiles
INFO: Found 5 tracefiles.
Dec 09, 2022 11:36:27 AM com.google.devtools.coverageoutputgenerator.Main parseFilesSequentially
INFO: Parsing file bazel-out/darwin-fastbuild/testlogs/src/teams/test/vault/vault_test/coverage.dat
Dec 09, 2022 11:36:27 AM com.google.devtools.coverageoutputgenerator.Main parseFilesSequentially
INFO: Parsing file bazel-out/darwin-fastbuild/testlogs/src/teams/test/server/server_test/coverage.dat
Dec 09, 2022 11:36:27 AM com.google.devtools.coverageoutputgenerator.Main parseFilesSequentially
INFO: Parsing file bazel-out/darwin-fastbuild/testlogs/src/teams/test/store/postgres/postgres_test/coverage.dat
Dec 09, 2022 11:36:27 AM com.google.devtools.coverageoutputgenerator.Main parseFilesSequentially
INFO: Parsing file bazel-out/darwin-fastbuild/testlogs/src/teams/test/keys/keys_test/coverage.dat
Dec 09, 2022 11:36:28 AM com.google.devtools.coverageoutputgenerator.Main parseFilesSequentially
INFO: Parsing file bazel-out/darwin-fastbuild/testlogs/src/teams/test/tools/keyrotate/keyrotate_test/coverage.dat
Dec 09, 2022 11:36:28 AM com.google.devtools.coverageoutputgenerator.Main getGcovInfoFiles
INFO: No gcov info file found.
Dec 09, 2022 11:36:28 AM com.google.devtools.coverageoutputgenerator.Main getGcovJsonInfoFiles
INFO: No gcov json file found.
Dec 09, 2022 11:36:28 AM com.google.devtools.coverageoutputgenerator.Main getProfdataFileOrNull
INFO: No .profdata file found.
Dec 09, 2022 11:36:28 AM com.google.devtools.coverageoutputgenerator.Main runWithArgs
WARNING: There was no coverage found.
INFO: Elapsed time: 65.521s, Critical Path: 52.28s
INFO: 247 processes: 25 disk cache hit, 75 internal, 146 darwin-sandbox, 1 worker.
INFO: Build completed successfully, 247 total actions
//src/teams/test/keys:keys_test PASSED in 3.1s
/private/var/tmp/_bazel_userme/e6e1d0cbd051dd43ed59dca5541f019d/execroot/product/bazel-out/darwin-fastbuild/testlogs/src/teams/test/keys/keys_test/coverage.dat
//src/teams/test/server:server_test PASSED in 1.1s
/private/var/tmp/_bazel_userme/e6e1d0cbd051dd43ed59dca5541f019d/execroot/product/bazel-out/darwin-fastbuild/testlogs/src/teams/test/server/server_test/coverage.dat
//src/teams/test/store/postgres:postgres_test PASSED in 3.8s
/private/var/tmp/_bazel_userme/e6e1d0cbd051dd43ed59dca5541f019d/execroot/product/bazel-out/darwin-fastbuild/testlogs/src/teams/test/store/postgres/postgres_test/coverage.dat
//src/teams/test/tools/keyrotate:keyrotate_test PASSED in 1.3s
/private/var/tmp/_bazel_userme/e6e1d0cbd051dd43ed59dca5541f019d/execroot/product/bazel-out/darwin-fastbuild/testlogs/src/teams/test/tools/keyrotate/keyrotate_test/coverage.dat
//src/teams/test/vault:vault_test PASSED in 2.3s
/private/var/tmp/_bazel_userme/e6e1d0cbd051dd43ed59dca5541f019d/execroot/product/bazel-out/darwin-fastbuild/testlogs/src/teams/test/vault/vault_test/coverage.dat
Executed 5 out of 5 tests: 5 tests pass.
INFO: Build completed successfully, 247 total actions
genHTML output
`genhtml /private/var/tmp/_bazel_userme/e6e1d0cbd051dd43ed59dca5541f019d/execroot/product/bazel-out/_coverage/_coverage_report.dat`
Reading data file _coverage_report.dat
genhtml: ERROR: no valid records found in tracefile _coverage_report.dat
i also tried this but same output.
https://bazel.build/configure/coverage
genhtml --output genhtml "$(bazel info output_path)/_coverage/_coverage_report.dat"
Jenkins: 2.89.4-x rolling version
Jenkins was running slow due to memory issues.
Restarted Jenkins (sudo/usual way), I got the following SEVERE issue.
Finally Restarted Jenkins machine thinking that'll help; got memory back (mem looks good now).
Trying to start Jenkins again and getting the same SEVERE issue and installation just HANGS at a given plugin while doing Initializing plugin <somePlugin-here> by pool-6-thread-2.
Running from: /usr/lib/jenkins/jenkins.war
Jun 06, 2019 6:49:14 AM Main deleteWinstoneTempContents
WARNING: Failed to delete the temporary Winstone file /tmp/winstone/jenkins.war
Jun 06, 2019 6:49:14 AM org.eclipse.jetty.util.log.Log initialized
..
...more lines here...
...
..
Jun 06, 2019 6:49:19 AM jenkins.model.Jenkins$5 runTask
INFO: Took 54ms for LogRecorderManager.init by pool-6-thread-7
Jun 06, 2019 6:49:19 AM com.cloudbees.jenkins.plugins.updates.envelope.LoggerLog log
SEVERE: Unable to parse provided JSON
net.sf.json.JSONException: A JSONObject text must begin with '{' at character 0 of
at net.sf.json.util.JSONTokener.syntaxError(JSONTokener.java:499)
at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:919)
at net.sf.json.JSONObject._fromString(JSONObject.java:1145)
at net.sf.json.JSONObject.fromObject(JSONObject.java:162)
at net.sf.json.JSONObject.fromObject(JSONObject.java:132)
at com.cloudbees.jenkins.plugins.updates.envelope.JSONObjectLoader.from(JSONObjectLoader.java:38)
at com.cloudbees.jenkins.plugins.updates.envelope.JSONObjectLoader$1.apply(JSONObjectLoader.java:51)
at com.cloudbees.jenkins.plugins.updates.envelope.JSONObjectLoader$1.apply(JSONObjectLoader.java:47)
at com.cloudbees.jenkins.plugins.updates.envelope.Validation$Value.flatMap(Validation.java:229)
at com.cloudbees.jenkins.plugins.updates.envelope.JSONObjectLoader.from(JSONObjectLoader.java:47)
at com.cloudbees.jenkins.plugins.updates.envelope.ParsedEnvelope$Loader.fromJSON(ParsedEnvelope.java:95)
at com.cloudbees.jenkins.cjp.installmanager.BaseFolder.loadInstalled(BaseFolder.java:136)
at com.cloudbees.jenkins.cjp.installmanager.WAREnvelope.loadInstalled(WAREnvelope.java:140)
at com.cloudbees.jenkins.cjp.installmanager.CJPPluginManager$StartUp.execute(CJPPluginManager.java:297)
at com.cloudbees.jenkins.cjp.installmanager.CJPPluginManager.loadPlugins(CJPPluginManager.java:231)
at com.cloudbees.jenkins.cjp.installmanager.CJPPluginManager.loadBundledPlugins(CJPPluginManager.java:209)
at hudson.PluginManager$1$1.run(PluginManager.java:379)
at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
at jenkins.model.Jenkins$5.runTask(Jenkins.java:1066)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Jun 06, 2019 6:49:19 AM com.cloudbees.jenkins.plugins.updates.envelope.LoggerLog log
SEVERE: Unable to read JSON from [/var/lib/jenkins/cb-envelope/envelope.json]
Jun 06, 2019 6:49:19 AM jenkins.model.Jenkins$5 runTask
..
..
..
..
..
...more lines here...regarding inspecting/installing/loading/extracting plugins .hpi/.jpi files (looks good no ERROR/FATAL/SEVERE lines in this area).
...
..
..
..
..
..
Jun 06, 2019 6:49:34 AM jenkins.model.Jenkins$5 runTask
INFO: Took 0ms for Initializing plugin ColumnPack-plugin by pool-6-thread-2
Jun 06, 2019 6:49:34 AM jenkins.model.Jenkins$5 runTask
INFO: Took 274ms for Discovering plugin initialization tasks by pool-6-thread-10
Jun 06, 2019 6:49:34 AM jenkins.model.Jenkins$5 runTask
INFO: Took 0ms for SupportPlugin.threadDumpStartup by pool-6-thread-15
Jun 06, 2019 6:49:34 AM jenkins.model.Jenkins$5 runTask
INFO: Took 2ms for XStreamDOMCompat.addAliases by pool-6-thread-16
The above log shows only has 1 SEVERE error about the following:
SEVERE: Unable to parse provided JSON - [/var/lib/jenkins/cb-envelope/envelope.json]
Questions:
1. What is this cb-envelop folder in JENKINS_HOME?
2. Why Jenkins is not coming up?
I see this folder has 0 byte envelop.json file and both cje-xx folders contain nothing, example ls output shown below.
[giga123#jenkins_dev_machine ~]$ ls -l /var/lib/jenkins/cb-envelope/
total 8
drwxr-xr-x 2 jenkins_svc_user jenkins_group 4096 Jul 3 2017 cje-2.46.3.2
drwxr-xr-x 2 jenkins_svc_user jenkins_group 4096 Apr 20 2018 cje-2.89.4.2
-rw-r--r-- 1 jenkins_svc_user jenkins_group 0 Mar 27 2018 envelope.json
-rw-r--r-- 1 jenkins_svc_user jenkins_group 0 Jul 5 2017 envelope.json.disabled
[giga123#jenkins_dev_machine ~]$ ls -l /var/lib/jenkins/cb-envelope/cje-2.89.4.2/
total 0
Solution:
Soft fix: Renamed the envelop.json file to envelop.json.disabled.
Try Jenkins start now (ex: sudo /sbin/service jenkins stop/start and after start Jenkins should come up fine. Didn't catch that this issue came sometime back and someone did disable this file for Jenkins to startup.
The issue was a BLANK json file (thus '{' parse SEVERE error was coming up).
Hard fix: Rename /var/lib/jenkins/cb-envelope/ to /var/lib/jenkins/cb-envelope.OLD
Try Jenkins start now (ex: sudo /sbin/service jenkins stop/start and after start Jenkins should come up fine. cb-envelop folder will be recreated (if renamed/deleted) after Jenkins start.
Once this was done net.sf.json.JSONException: A JSONObject text must begin with '{' at character 0 of error went away and Jenkins installation went a little further BUT installation halted at a given plugin. I disabled that plugin (by going to $JENKINS_HOME/plugins/<plugin.jpi_or_hpi>.disabled and retried to start Jenkins, now it halted at another next plugin in the list of plugins during Initializing plugin .... plugin... steps/sub-steps.
To resolve that, we had to contact Cloudbees support team and disable support-core.jpi plugin. This plugin comes with Cloudbees Jenkins Operation Center / Master installation by default as one of the .jpi files.
After support-core.jpi file in plugins folder was renamed to support-core.jpi.disabled (you can move support-core folder to support-core.OLD if you want), we retried starting Jenkins and it came back up fine.
One last thing we noticed was, after Jenkins dashboard was finally UP, it was in QUITE and SHUTDOWN mode (by design). To remove state that, we had to click on:
As an admin level user account, Go to Jenkins > Manage Jenkins > Quiet Restart and UN-CHECK the check box which says Stay in "queiting down" state when restarted.
Remove the check from the following.
On Jenkins dashboard, click cancel on Shut down mode link (if any) and now Jenkins is up and running fine.
I keep getting different errors while trying to insert data retrieved from a html page using JSP into a table in my MS Access database. Everyone time I try to fix or change my code I get a different error. the current error is:
(ps. i'm using apache tomcat. my database is called "tico" and "Contacts" is the name of the table. the field names in MS access are "Job Code:" and "TICo's Client:"). If anyone can help, it would be much appreciated. thanks. :)
-------------------------------------------------------------------------
enter code here
HTTP Status 500 - An exception occurred processing JSP page /TICo Website/onejsp.jsp at line 21
type Exception report
message An exception occurred processing JSP page /TICo Website/onejsp.jsp at line 21
description The server encountered an internal error that prevented it from fulfilling this request.``
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /TICo Website/onejsp.jsp at line 21
18: url = "jdbc:odbc:tico"
19: />
20:
21: <sql:update var="tico" scope="request" dataSource ="${tico}">
22: INSERT INTO Contacts
23: ([Job Code:], [TICo's Client:])
24: VALUES (?, ?)
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException
(JspServletWrapper.java:521)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:412)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get
connection,
DataSource invalid: "java.sql.SQLException: [Microsoft]
[ODBC Driver Manager]
Data source name not found and no default driver specified"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException
(PageContextImpl.java:865)
org.apache.jasper.runtime.PageContextImpl.handlePageException
(PageContextImpl.java:794)
org.apache.jsp.TICo_0020Website.onejsp_jsp._jspService(onejsp_jsp.java:215)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
root cause
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid:
"java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name
not found and no default driver specified"
org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.
getConnection(UpdateTagSupport. java:243)
org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.doStartTag
(UpdateTagSupport.jav a:124)
org.apache.jsp.TICo_0020Website.onejsp_jsp._jspx_meth_sql_005fupdate_005f0
(onejsp_jsp.java: 264)
org.apache.jsp.TICo_0020Website.onejsp_jsp._jspService(onejsp_jsp.java:80)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
note The full stack trace of the root cause is available in the Apache
Tomcat/6.0.37 logs.
Apache Tomcat/6.0.37
----------------------------------------------------------------------------------
full stack trace
-------------------------------------------------------------------------------
enter code hereJun 25, 2013 9:54:33 AM
org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance
in production environments was not found on the java.library.path: C:\Program
Files\Apache Software Foundation\Tomcat 6.0\bin;C:\Windows\Sun\Java\bin;C:
\Windows \system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32
\Wbem;C:\Windows \System32\WindowsPowerShell\v1.0\;;.
Jun 25, 2013 9:54:33 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jun 25, 2013 9:54:33 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 438 ms
Jun 25, 2013 9:54:33 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jun 25, 2013 9:54:33 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.37
Jun 25, 2013 9:54:33 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
Jun 25, 2013 9:54:33 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Jun 25, 2013 9:54:33 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Jun 25, 2013 9:54:34 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jun 25, 2013 9:54:34 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jun 25, 2013 9:54:34 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/15 config=null
Jun 25, 2013 9:54:34 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 800 ms
Jun 25, 2013 10:03:14 AM org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Jun 25, 2013 10:03:15 AM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Jun 25, 2013 10:03:15 AM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
Jun 25, 2013 10:03:21 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance
in production environments was not found on the java.library.path: C:\Program
Files\Apache Software Foundation\Tomcat 6.0\bin;C:\Windows\Sun\Java\bin;C:\Windows
\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:
\Windows \System32\WindowsPowerShell\v1.0\;;.
Jun 25, 2013 10:03:21 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jun 25, 2013 10:03:21 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 348 ms
Jun 25, 2013 10:03:21 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jun 25, 2013 10:03:21 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.37
Jun 25, 2013 10:03:21 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
Jun 25, 2013 10:03:21 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Jun 25, 2013 10:03:21 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Jun 25, 2013 10:03:22 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jun 25, 2013 10:03:22 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jun 25, 2013 10:03:22 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/15 config=null
Jun 25, 2013 10:03:22 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 495 ms`
JSP Page
<%#page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%# taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%# taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<html>
<head>
<title>Using GET and POST Method to Read Form Data</title>
</head>
<body>
<sql:setDataSource
var = "tico"
scope = "session"
driver = "sun.jdbc.odbc.JdbcOdbcDriver"
url = "jdbc:odbc:tico"
/>
<sql:update var="tico" scope="request" dataSource ="${tico}">
INSERT INTO Contacts
(Job Code:, TICo's Client:)
VALUES (?, ?)
<sql:param value = "${param.jobcode}" />
<sql:param value = "${param.ticosclient}" />
</sql:update>
<center>
<h1>Using GET Method to Read Form Data</h1>
<div style="position:absolute; top:20px; width:100%; height:80px;">
<ul>
<table align='center' style="width: 1000px; height: 81px;" border="0" cellpadding="0"
cellspacing="0" align="center">
<col width="33">
<col width="33">
<col width="33">
<col width="33"></br></br></br>
<tr><td>
<li><p><b>Job Code:</b>
<%= request.getParameter("jobcode")%>
</p></li>
</td></tr>
<tr><td>
<li><p><b>TICo's Client:</b>
<%= request.getParameter("ticosclient")%>
</p></li>
</td></tr>
</body>
</html>
Certainly one thing you'll need to fix is your SQL command text.
INSERT INTO Contacts
(Job Code:, TICo's Client:)
VALUES (?, ?)
will have to be changed to
INSERT INTO Contacts
([Job Code:], [TICo's Client:])
VALUES (?, ?)
By the way, you may want to double-check that there really are colon (:) characters in the field names. That's quite normal for labels on a form, but it's rather unusual for them to be included in the actual field names.
Edit
The "Data source name not found and no default driver specified" error suggests that the JSP process is running in the 64-bit environment and the 64-bit version of the Access Database Engine (a.k.a. "ACE") has not been installed on the server. To correct that, download and install the 64-bit version of the Access Database Engine from here, then create a 64-bit System DSN for the database (via the normal Windows Control Panel applet, not SYSWOW64).
Am experienced with Django, Apache, WSGI, MySql, etc. and have this environment setup and working fine on another OS X computer running Lion. Django session backend is db, session middleware and app are both enabled properly in settings. During first request of site view, we set a request.session key/value, which this first time thru works fine. On subsequent view though when we check if the key/value exists, we get a server-level 500 error that even with Debug mode on doesn't make it to the python interpreter to generate a full stack trace exception. The apache log generates the following messages...
[Mon Apr 16 14:26:22 2012] [notice] Apache/2.2.21 (Unix) DAV/2 mod_wsgi/3.3 Python/2.7.1 mod_ssl/2.2.21 OpenSSL/0.9.8r configured -- resuming normal operations
[Mon Apr 16 14:26:27 2012] [info] mod_wsgi (pid=2362): Create interpreter 'snap.joe|'.
[Mon Apr 16 14:26:27 2012] [info] [client 127.0.0.1] mod_wsgi (pid=2362, process='snap', application='snap.joe|'): Loading WSGI script '/var/www/venvs/snap_env/snap/wsgi/wsgi.py'.
[Mon Apr 16 14:26:32 2012] [error] [client 127.0.0.1] Premature end of script headers: wsgi.py
[Mon Apr 16 14:26:33 2012] [notice] child pid 2362 exit signal Bus error (10)
Have checked that a MySQL db table django_session row is added properly with session_data and also the cookie set in the browser after the first request contains the proper/matching session_id. If I add a simple request.session.flush() just before the existing session code, we can bypass the error obviously because there is never anything in the session. One more thing, the value we are adding to the session key/value store is a Django QuerySet object. Again, this is working on a live CentOS server, and also another Mac OS X Lion machine (albeit running Python 2.6 instead of 2.7).
Any ideas folks? Many thanks!
See documented reasons at:
http://code.google.com/p/modwsgi/wiki/FrequentlyAskedQuestions#Apache_Process_Crashes
and follow further links for possible workarounds.
In short, can be shared library version conflict, using mod_python at same time, or extension module for Python that doesn't work with sub interpreter.
If this is only Python site on that Apache, set:
WSGIApplicationGroup %{GLOBAL}
for one potential quick solution.
A few thoughts:
1) are you running the same versions of modules? Django just recently updated (1.4), so if you did a pip install and didn't specify a version your production might have an older version while your development has the newer one.
2) Can you test this using just the manage.py runserver? My suspicions are that it's something to do with the apache config (so if it works fine in runserver, that means the issue is with apache).
These are the steps I took:
install apache 2.2.x
install TortoiseHg 0.7
copy hgwebdir.cgi, hgweb.config to cgi-bin
edit hgweb.config as appropriate
unzip $blah\TortoiseHg\library.zip to unzip $blah\TortoiseHg\library
sys.path.append("$blah\TortoiseHg\library") at the beginning of
hgwebdir.cgi
move $blah\TortoiseHg\templates to $blah\TortoiseHg\library\templates
(Edit: I forgot to add that all these steps are laid out here.)
When I run http://localhost/cgi-bin/hgwebdir.cgi/ I can see my repository. If I try browse that repository, I'm told "DLL load failed: The specified module could not be found.". The last line of the walkback says "c:\program files\apache group\apache\cgi-bin\mercurial\osutil.pyc in __load()".
I've read about people having problems with pywintypes25.dll; this lives in "c:\program files\tortoisehg" and is already in my PATH.
What DLL couldn't be found?
you missed the c libs of mercurial
there are 3 ways to get out of this
recent mercurial versions ship with pure python implementations you can find in mercurial/pure
compile it yourself (im not exactly sure on the steps, on any unix this just works)
grab win32 installer from the website
note that i didn't yet take a look at how those are build
(you need a distutils based install, not a py2exe based one)
First thing: don't use TortoiseHg for this. Use the Mercurial installer instead.
(TortoiseHg tries to be as independent of your Python installation as possible, and for reasons unclear to this Python-newbie, things Don't Work. Something about py2exe.)
Otherwise, just follow the steps in the HgWebDirStepByStep. I did have to install pywintypes, but YMMV. Lastly, the unzip utility mentioned on that page may do strange things with file permissions: I had to add read permissions to Templates directory and its files/subdirectories.
As an aside, if you're wondering how to set the style, add this to hgweb.config:
[web]
style = foo
My setup involves an apache 2.2.17, mod_wsgi 3.3, python 2.7.2, trac 0.12.2, mercurial 1.8.4. Two issues surfaced:
mercurial demandimport initialization order
mercurial unable to load DLLs in site-packages.
I solved the problem as follows:
change hgwebdir.wsgi to disable demandimport:
from mercurial import demandimport; demandimport.disable()
create a pure (.py only, no compiled .pyd) mercurial package and install. See also https://www.mercurial-scm.org/wiki/WindowsInstall
E:\Dist\mercurial-1.8.4>setup.py --pure build
E:\Dist\mercurial-1.8.4>setup.py --pure install
The compiled versions (with Microsoft Visual Studio 2008) fail to load the DLL:
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] mod_wsgi (pid=6092): Exception occurred processing WSGI script 'D:/Home/web/apache/cgi-bin/hgwebdir.wsgi'.
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] Traceback (most recent call last):
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "D:/Home/web/apache/cgi-bin/hgwebdir.wsgi", line 9, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] from mercurial.hgweb.hgwebdir_mod import hgwebdir
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "C:\\Apps\\Python27\\lib\\site-packages\\mercurial\\hgweb\\__init__.py", line 10, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] import hgweb_mod, hgwebdir_mod
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "C:\\Apps\\Python27\\lib\\site-packages\\mercurial\\hgweb\\hgweb_mod.py", line 10, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] from mercurial import ui, hg, hook, error, encoding, templater
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "C:\\Apps\\Python27\\lib\\site-packages\\mercurial\\ui.py", line 10, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] import config, util, error
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "C:\\Apps\\Python27\\lib\\site-packages\\mercurial\\config.py", line 9, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] import error, util
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "C:\\Apps\\Python27\\lib\\site-packages\\mercurial\\util.py", line 17, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] import error, osutil, encoding
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] ImportError: DLL load failed: The specified module could not be found.
I know this question is already answered, but I experienced a slightly different issue and found a work around --
I'm sure I'm missing something obvious in the Python configuration (2.5.4), but I'm having issues with .pyd versus .dll. (I had the same issues with the Python subversion libraries.) I see osutil.pyd in Mercurial\library.zip, but it fails to load it. Therefore, I unzipped library.zip and then copied *.pyd to *.dll, e.g:
REM Ugly DOS... Recursively renames all .pyd files to .dll
for /f "tokens=*" %%a in ('dir /s /b *.pyd') do copy "%%a" "%%~da%%~pa%%~na.dll"
Make sure the unzipped library directory is in the PYTHONPATH, but after this I successfully can execute: from mercurial import osutil. Also remember to copy or move the Templates directory to the newly unzipped library directory.
Follow the steps in Section 5 of the HgWebDirStepByStep for the rest. I did not experience the "Gotchas" in Section 5.3 though.