----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files. Don't make us guess your problem!!!
----------------------------------------------------------------
Apache JServ 1.1
Apache 1.3.9
Linux/Redhat 6.0
Well, been on this prob for almost two weeks and still can't see why this
servlets init method doesn't get called so trying again.
If I run netstat on my linux box (web server), I can see connections being
established, yet the init method in the logs never gets called. If I call
the servlet from an html file using a post action method, the servlet works
fine. Put them together, and they don't work. All my writes from the
SubmitKit class execute w/o errors, exceptions, etc... I've got other
servlets that work fine, only diff is that they don't get called from the
main file (whether it be a stand-alone or a JApplet) as this one does. If I
test it w/ an applet, and after seeing that this doesn't work, I can then
input in the URL line the servlet (i.e. http://myServer/servlets/Submit) and
it does get init'd. Don't understand it.
Included below is the servlet code, the class code that get's
objectWrite()'en to the servlet, and the main prog to call the servlet (w/
jserv & apache config info below that).
--------------------------------------------------
the Submit class is a servlet that works fine when called from an html page
but doesn't work when called from a tst main or applet.
--------------------------------------------------
import java.io.*;
import java.rmi.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Submit extends HttpServlet
{
private IBuild builder = null;
public void init(ServletConfig config) throws ServletException {
super.init(config);
try {
builder =
(IBuild)Naming.lookup("rmi://grobe/buildAgent");
}
catch (Exception e) {
System.out.println("Caught exception = " + e);
e.printStackTrace();
}
}
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
System.out.println("Submit: doGet");
}
public void doPost(HttpServletRequest request,
HttpServletResponse response) throws
ServletException, IOException {
String status = null;
ObjectInputStream servletIn = null;
ObjectOutputStream toApplet = null;
Kit kit = new Kit();
System.out.println("Submit: doPost");
response.setContentType("application/octet-stream");
try {
servletIn = new
ObjectInputStream(request.getInputStream());
kit = (Kit)servletIn.readObject();
servletIn.close();
}
catch (Exception e) {
System.out.println("doPost Exception: " +
e.getMessage());
}
System.out.println("calling submitBuild");
status = builder.submitBuild(kit);
System.out.println("status = " + status);
}
}
--------------------------------------------------
the SubmitKit class gets called from the main and opens the URLConnection to
the Servlet.
--------------------------------------------------
import java.io.*;
import java.net.*;
import java.util.*;
public class SubmitKit
{
public SubmitKit() {
}
public int sendKit(Kit k) {
ObjectOutputStream toServlet = null;
System.out.println(">> [send]");
Kit kit = k;
try {
String location = "http://morpheus/servlets/Submit";
URL servlet = new URL(location);
URLConnection servletConnection =
servlet.openConnection();
servletConnection.setDoInput(true);
servletConnection.setDoOutput(true);
servletConnection.setUseCaches(false);
servletConnection.setDefaultUseCaches(false);
servletConnection.setRequestProperty("Content-Type",
"application/x-java-serialized-object");
// "application/octet-stream");
toServlet = new ObjectOutputStream(
servletConnection.getOutputStream());
toServlet.writeObject(kit);
toServlet.flush();
toServlet.close();
}
catch (MalformedURLException e) {
System.err.println("MalformedURLException: " + e);
return 1;
}
catch (IOException e) {
System.err.println("IOException: " + e);
return 1;
}
catch (Exception e) {
System.err.println("Exception: " + e);
return 1;
}
System.out.println("<< [send] - 0");
return 0;
}
}
--------------------------------------------------
this is the TstMain that I'm trying after failing w/ a JApplet.
--------------------------------------------------
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
public class TstMain
{
Kit kit = null;
SubmitKit toServl = null;
String name = null;
public TstMain() {
kit = new Kit();
kit.setName("DMCplus");
kit.setVersion("2.1");
kit.setBuild("1500");
toServl = new SubmitKit();
int rtn = toServl.sendKit(kit);
System.out.println("rtn = " + rtn);
}
public static void main(String[] args) {
System.out.println("started ...");
TstMain tst = new TstMain();
System.out.println("finished ...");
}
}
--------------------------------------------------
httpd.conf config
--------------------------------------------------
ServerType standalone
ServerRoot "/usr/local/apache"
PidFile /usr/local/apache/logs/httpd.pid
ScoreBoardFile /usr/local/apache/logs/httpd.scoreboard
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 5
MaxSpareServers 10
StartServers 5
MaxClients 150
MaxRequestsPerChild 0
Port 80
User nobody
Group nobody
ServerAdmin [EMAIL PROTECTED]
DocumentRoot "/u/Build/Build_System"
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/u/Build/Build_System">
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
UserDir public_html
DirectoryIndex index.html
AccessFileName .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
UseCanonicalName On
TypesConfig /usr/local/apache/conf/mime.types
DefaultType text/plain
<IfModule mod_mime_magic.c>
MIMEMagicFile /usr/local/apache/conf/magic
</IfModule>
HostnameLookups Off
ErrorLog /usr/local/apache/logs/error_log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /usr/local/apache/logs/access_log common
ServerSignature On
Alias /icons/ "/usr/local/apache/icons/"
<Directory "/usr/local/apache/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"
<Directory "/usr/local/apache/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
IndexOptions FancyIndexing
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^
DefaultIcon /icons/unknown.gif
ReadmeName README
HeaderName HEADER
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
AddEncoding x-compress Z
AddEncoding x-gzip gz tgz
AddLanguage en .en
AddLanguage fr .fr
AddLanguage de .de
AddLanguage da .da
AddLanguage el .el
AddLanguage it .it
LanguagePriority en fr de
AddType application/x-tar .tgz
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
Include /usr/local/jserv/etc/jserv.conf
--------------------------------------------------
jserv.conf config
--------------------------------------------------
<IfModule mod_jserv.c>
ApJServManual off
ApJServProperties /usr/local/jserv/etc/jserv.properties
ApJServLogFile /usr/local/jserv/logs/mod_jserv.log
ApJServLogLevel notice
ApJServDefaultProtocol ajpv12
ApJServDefaultPort 8007
ApJServSecretKey DISABLED
ApJServMount /servlets /root
ApJServMount /servlet /root
ApJServMountCopy on
<Location /jserv/>
SetHandler jserv-status
order deny,allow
deny from all
allow from localhost
</Location>
</IfModule>
---
Gary
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]