I work with IntelliJ and when I run it in a web browser, it returns 503 error :
Problem accessing / MySampleApplication.html. Reason:
Service Unavailable"*
The bug should be somewhere in the XML file and it seems to be something wrong with the servlet path.
XML:
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.8.0//EN"
"http://gwtproject.org/doctype/2.8.0/gwt-module.dtd">
<module rename-to="MySampleApplication">
<inherits name='com.google.gwt.user.User'/>
<entry-point class='com.mySampleApplication.client.MySampleApplication'/>
<servlet path='/MySampleApplicationService' class='com.mySampleApplication.server.ServiceImpl'/>>
/>
</module>
Console:
Code server started in 12.55 s ms
2019-03-06 13:09:20.410:INFO:oejs.Server:main: Started #13836ms
Loading modules
com.mySampleApplication.MySampleApplication
Validating <servlet> tags for module 'MySampleApplication'
For additional info see: file:/Users/simonemettesorensen/Downloads/gwt-2.8.2/doc/helpInfo/servletMappings.html
[WARN] Module declares a servlet class 'com.mySampleApplication.server.ServiceImpl' with a mapping to '/MySampleApplication/MySampleApplicationService', but the web.xml has no corresponding mapping; please add the following lines to your web.xml:
<servlet-mapping>
<servlet-name>com.mySampleApplication.MySampleApplication Service</servlet-name>
<url-pattern>/MySampleApplication/MySampleApplicationService</url-pattern>
</servlet-mapping>
2019-03-06 13:09:20.549:INFO:oejs.Server:main: jetty-9.2.z-SNAPSHOT
Starting Jetty on port 8888
[WARN] Failed startup of context c.g.g.d.s.j.WebAppContextWithReload#41aa7994{/,file:/Users/simonemettesorensen/Library/Caches/IntelliJIdea2018.2/gwt/%C3%B8velsemedrpc.9e5e27b2/oevelseMedRPC.6c3e6f2f/run/www/,STARTING}{/Users/simonemettesorensen/Library/Caches/IntelliJIdea2018.2/gwt/øvelsemedrpc.9e5e27b2/oevelseMedRPC.6c3e6f2f/run/www}
java.lang.NullPointerException
at java.lang.String.compareTo(String.java:1155)
at org.eclipse.jetty.servlet.ServletHolder.compareTo(ServletHolder.java:209)
at org.eclipse.jetty.servlet.ServletHolder.compareTo(ServletHolder.java:70)
at java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:321)
at java.util.ComparableTimSort.sort(ComparableTimSort.java:188)
at java.util.Arrays.sort(Arrays.java:1246)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:865)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:550)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:140)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:387)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:354)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:760)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:636)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:923)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:706)
at com.google.gwt.dev.DevMode.main(DevMode.java:432)
2019-03-06 13:09:22.470:INFO:oejs.ServerConnector:main: Started ServerConnector#1006dd06{HTTP/1.1}{127.0.0.1:8888}
2019-03-06 13:09:22.470:INFO:oejs.Server:main: Started #15896ms
Dev Mode initialized. Startup URL:
http://127.0.0.1:8888/MySampleApplication.html
[ERROR] 503 - GET /MySampleApplication.html (127.0.0.1) 312 bytes
Request Headers
Host: 127.0.0.1:8888
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: da-DK,da;q=0.9,en-US;q=0.8,en;q=0.7
Response headers
Date: Wed, 06 Mar 2019 12:09:22 GMT
Cache-Control: must-revalidate,no-cache,no-store
Content-Type: text/html; charset=ISO-8859-1
Content-Length: 312
And if I add this, it won't run because of an unexpected error: "servlet mapping :
<servlet-mapping>
<servlet-name>com.mySampleApplication.MySampleApplication Service</servlet-name>
<url-pattern>/MySampleApplication/MySampleApplicationService</url-pattern>
</servlet-mapping>
I would really appreciate any help.
Simone, welcome to the GWT world!
If that servlet uses GWT-RPC I would strongly suggest you to look into creating a JSON endpoint. Moving forward the RPC part will be dropped, JSON is standard and future-proof.
It's also waaaaaaay easier to debug and mock up, makes working with GWT significantly easier.
You need to replace the <servlet> from your *.gwt.xml file with a <servlet-mapping> (and <servlet>) in your WEB-INF/web.xml (a standard servlet mapping, not GWT-specific, like in any other, non-GWT, servlet development)
Related
I wrote these Virtual Host entries for force https and to proxy the requests to a embed tomcat running at local 8080 for a Java Spring JSF app.
It works fine for subdirectories like https://my.site.com/something.jsf but not to root https domain https://my.site.com, that gots redirect to just index.html (with no domain prefix).
For http request http://my.site.com it is correctly redirect to https with no issues.
When I had just *:80 with the same proxypass it worked just fine.
<VirtualHost *:80>
ServerName my.site.com
RedirectPermanent / https://my.site.com/
</VirtualHost>
<VirtualHost *:443>
ServerName my.site.com
ServerAlias my.site.com
ProxyPreserveHost On
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
SSLEngine On
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
</VirtualHost>
httpd access_log:
https requests to root produces this log line:
201.8.25.80 - - [12/Feb/2021:14:37:21 -0300] "GET / HTTP/1.1" 302 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36"
No error is reported in httpd error_log.
Tomcat log:
I got this stacktrace in the application log, but I'm not sure that is related, cause is's not logged everytime that root https is called.
INFO 3093 --- [http-nio-8080-exec-3] o.apache.coyote.http11.Http11Processor : Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:479) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:684) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
I'm looking for possible solutions and reasons for this behavior for days, and got nothing...
If someone can help, I'll be grateful.
I didn't discover why the requests to root in https was being wrong redirected. But it's been solved by adding a <LocationMatch> that match to root and redirect to index.jsf, keeping the proxy directives, like so:
<VirtualHost *:443>
ServerName my.site.com
SSLEngine On
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
<LocationMatch "^/?$">
Redirect / /index.jsf
</LocationMatch>
ProxyPreserveHost On
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</VirtualHost>
I have a Spring MVC webapp, that as part of its operation runs off and performances several SQL queries, that can take up to 15 minutes to run.
If you delete the deployment while a query is running, the weblogic log will print the following stacktrace:
POST /MyWebapp/submitQuery HTTP/1.1
x-requested-with: XMLHttpRequest
Accept-Language: en-nz
Referer: http://server:1111/mywebapp/
Accept: */*
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Content-Length: 268
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: JSESSIONID=KgJ5VnFLpWTp1ZNjwt3p1D4FHxmSQnPpTTwX18TDyMxnpgGBXWTD!1657710130; ADMINCONSOLESESSION=tSWjVnXJb6MPn0Bj9h4FPWvyzHC5pbCf2H20ZgfGHLTKpykMN82m!802748838
]] Root cause of ServletException.
java.lang.NoClassDefFoundError: org/apache/log4j/DefaultThrowableRenderer
at org.apache.log4j.spi.ThrowableInformation.getThrowableStrRep(ThrowableInformation.java:87)
at org.apache.log4j.spi.LoggingEvent.getThrowableStrRep(LoggingEvent.java:413)
at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:313)
at org.apache.log4j.WriterAppender.append(WriterAppender.java:162)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
at org.apache.log4j.Category.callAppenders(Category.java:206)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.log(Category.java:856)
at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:166)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:989)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3717)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
If you wait for queries to finish before deleting the deployment, then the errors will not be posted.
I've been told that it's not acceptable for this stacktrace to be thrown.
Two questions:
What actually happens if you delete a deployment while a thread is running?
How can I get Weblogic to handle it gracefully?
I have the following config in my /users//settings.xml.
Under PluginsGroup:
<pluginGroup>org.apache.tomcat.maven</pluginGroup>
Under servers:
<server>
<id>localhost</id>
<username>tom</username>
<password>cat</password>
</server>
Under profiles:
<plugin>
<configuration>
<server>localhost</server>
<url>http://localhost:8080/manager/text</url>
<path>/</path>
</configuration>
</plugin>
I ran the maven command with -X options, and I see the following:
[DEBUG] Reading global settings from C:\Tools\apache-maven-3.1.1\bin\..\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\<user>\.m2\settings.xml
I have the manager-script role in tomcat users xml file.
When I manually verify the access through browser, it works fine. But when I run mvn tomcat7:deploy I get the following:
Receiving response: HTTP/1.1 401 Unauthorized
User name and password are correct. I verified it manually. What else could be wrong?
Googling did not help much.
Edit: More details from Log.
HTTP/1.1 401 Unauthorized
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Wed, 31 Dec 1969 18:00:00 CST
WWW-Authenticate: Basic realm="Tomcat Manager Application"
Set-Cookie: JSESSIONID=7320C7326C51E8F7FF9F4D23A39E6971; Path=/manager/; HttpOnly
Content-Type: text/html;charset=ISO-8859-1
Transfer-Encoding: chunked
Date: Thu, 24 Apr 2014 02:56:27 GMT
Cookie accepted: "[version: 0][name: JSESSIONID][value: 7320C7326C51E8F7FF9F4D23A39E6971]
[domain: localhost][path: /manager/][expiry: null]".
Connection can be kept alive indefinitely
Authentication required
localhost:8080 requested authentication
Authorization challenge processed
Authentication failed
Clearing cached auth scheme for http://localhost:8080
Edit:
Well, this is what I found out. When I pass username and password from mvn command, its working fine. But its not picking up from settings.xml.
Does it ring any bell? I tried moving the config stuff to MAVEN_HOME/config/settings.xml as well. (Deleted the user settings.xml). But still the same.
Any settings cache?
Edit:
I turned on the debugger with -X. Even though I deleted /user/.m2/settings.xml, it says its reading that file.
[DEBUG] Reading global settings from C:\Tools\apache-maven-3.1.1\bin\..\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\<user>\.m2\settings.xml
How to flush?
The pluging configuration should be like that:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<server>text</server>
<url>http://localhost:8080/manager/text</url>
</configuration>
</plugin>
This should work
I am guessing that the application you want to deploy is named text. If it is not replace text with your web application name.
Also I would try removing the last <path>/</path> element to see if this helps or not...
Can somebody please explain in plain English how this works (or at least why my structure doesn't)? I want a function called ExportLicenseInfo in my Jersey servlet resource, which I have called ExportResource, to map to http://example.com/myApp/export/software_licenses.{year}-{month}.{format}, for example: http://example.com/myApp/export/software_licenses_2013-10.csv
Servlet config in web.xml:
<servlet>
<servlet-name>ExportServlet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.mycompany.app.ExportApplication</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
My servlet mapping in web.xml:
<servlet-mapping>
<servlet-name>ExportServlet</servlet-name>
<url-pattern>/export</url-pattern>
</servlet-mapping>
My code with #Path annotations:
#Path("/export")
public class ExportResource {
...
#GET
#Produces({"text/csv", "application/json"})
#Path("/software_licenses_{year: [0-9][0-9][0-9][0-9]}-{month: [0-1][0-9]}.{format}")
public String ExportLicenseInfo( ... ) {
...
}
When I try to access the resource, I get a 404. Jersey trace log:
Feb 21, 2014 2:41:46 PM org.glassfish.jersey.filter.LoggingFilter log
INFO: 6 * LoggingFilter - Request received on thread http-bio-8080-exec-67
6 > GET http://localhost:8080/app/export/software_licenses_2013-10.csv
6 > host: localhost:8080
6 > connection: keep-alive
6 > cache-control: max-age=0
6 > accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
6 > user-agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36
6 > accept-encoding: gzip,deflate,sdch
6 > accept-language: en
6 > cookie: JSESSIONID=DB64E0B066BDEE8CABFC94686AD6ACDC.test; JSESSIONIDSSO=61B51CEED61F8F6CE8A8DB46B38BAC9F; i18next=en
Feb 21, 2014 2:41:46 PM org.glassfish.jersey.filter.LoggingFilter log
INFO: 6 * LoggingFilter - Response received on thread http-bio-8080-exec-67
6 < 404
Try mapping the jersey servlet like this:
<servlet-mapping>
<servlet-name>ExportServlet</servlet-name>
<url-pattern>/export/*</url-pattern>
</servlet-mapping>
Im trying to set up a cgi script for my RMI webserver, but it is giving me an HTTP 500 all the time.
My CGI script look like this.
# This class will support a QUERY_STRING of the form "forward=<port>"
# with a REQUEST_METHOD "POST". The body of the request will be
# forwarded (as another POST request) to the server listening on the
# specified port (must be >= 1024). The response from this forwarded
# request will be the response to the original request.
#
# CONFIGURATION:
#
# Fill in correct absolute path to Java interpreter below. For example,
# the "PATH=" line might be changed to the follow if the JDK is installed
# at the path "/home/peter/java":
#
# PATH=/home/peter/java/bin:$PATH
#
PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH
exec java \
-DAUTH_TYPE="$AUTH_TYPE" \
-DCONTENT_LENGTH="$CONTENT_LENGTH" \
-DCONTENT_TYPE="$CONTENT_TYPE" \
-DGATEWAY_INTERFACE="$GATEWAY_INTERFACE" \
-DHTTP_ACCEPT="$HTTP_ACCEPT" \
-DPATH_INFO="$PATH_INFO" \
-DPATH_TRANSLATED="$PATH_TRANSLATED" \
-DQUERY_STRING="$QUERY_STRING" \
-DREMOTE_ADDR="$REMOTE_ADDR" \
-DREMOTE_HOST="$REMOTE_HOST" \
-DREMOTE_IDENT="$REMOTE_IDENT" \
-DREMOTE_USER="$REMOTE_USER" \
-DREQUEST_METHOD="$REQUEST_METHOD" \
-DSCRIPT_NAME="$SCRIPT_NAME" \
-DSERVER_NAME="$SERVER_NAME" \
-DSERVER_PORT="$SERVER_PORT" \
-DSERVER_PROTOCOL="$SERVER_PROTOCOL" \
-DSERVER_SOFTWARE="$SERVER_SOFTWARE" \
sun.rmi.transport.proxy.CGIHandler
In my access.log it says:
"POST /cgi-bin/java-rmi.cgi?forward=1099 HTTP/1.1" 500 415 "-" "Java/1.7.0"
In my error.log it says:
(104)Connection reset by peer: ap_content_length_filter: apr_bucket_read() failed
I am using RMISocketFactory.setSocketFactory(new sun.rmi.transport.proxy.RMIHttpToCGISocketFactory()); to force Http-to-cgi.
I can't figure out what i'm doing wrong..
I have put my java-rmi.cgi file in /usr/lib/cgi-bin/
Am i suppose to add something else to the script?
The java error i get is:
java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
java.io.IOException: HTTP request failed
EDIT: Visiting my cgi script as a website it give me(maybe you can't do that):
Java RMI Client Error
invalid command.
I traced this into the CGICommandHandler.java and it returns invalid command when the handler is null.
This is the debug output when i run bash -x:
+ PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
+ exec java -DAUTH_TYPE= -DCONTENT_LENGTH= -DCONTENT_TYPE= -DGATEWAY_INTERFACE= -DHTTP_ACCEPT= -DPATH_INFO= -DPATH_TRANSLATED= -DQUERY_STRING= -DREM OTE_ADDR= -DREMOTE_HOST= -DREMOTE_IDENT= -DREMOTE_USER= -DREQUEST_METHOD= -DSCRIPT_NAME= -DSERVER_NAME= -DSERVER_PORT= -DSERVER_PROTOCOL= -DSERVER_S OFTWARE= sun.rmi.transport.proxy.CGIHandler
Status: 400 Bad Request: invalid command.
Content-type: text/html
<HTML><HEAD><TITLE>Java RMI Client Error</TITLE></HEAD><BODY>
<H1>Java RMI Client Error</H1>
invalid command.
</BODY></HTML>
And if i echo out my cgi i file i get this:
AUTH_TYPE=
CONTENT_LENGTH=
CONTENT_TYPE=
GATEWAY_INTERFACE=CGI/1.1 HTTP_ACCEPT=text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 PATH_INFO=
PATH_TRANSLATED=
QUERY_STRING=
REMOTE_ADDR=xx.xxx.x.xx
REMOTE_HOST=
REMOTE_IDENT=
REMOTE_IDENT REMOTE_USER=
REQUEST_METHOD=GET SCRIPT_NAME=/cgi-bin/java-rmi.cgi.sh
SERVER_NAME=xx.xxx.xxx.xxx
SERVER_PORT=80 SERVER_PROTOCOL=HTTP/1.1
SERVER_SOFTWARE=Apache/2.2.22 (Ubuntu) Status: 400 Bad Request: invalid command. Content-type: text/html
As you can see my many strings are empty...
EDIT 2: Now my acess log brings me this:
"POST http://xx.xxx.xxx.xxx/cgi-bin/java-rmi.cgi?forward=1099 HTTP/1.1" 500 415 "-" "Java/1.7.0"
Still HTTP 500, my error log gives my the same as before..
EDIT 3:
I now tried to implement the servlet of java-rmi.cgi and it's giving me errors.
My http.conf lookes like this:
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_ajp_module /usr/lib/apache2/modules/mod_proxy_ajp.so
<Location /cgi-bin/java-rmi.cgi>
ProxyPass ajp://localhost:8009/rmi/ServletHandler
</Location>
What should be the port and adress? In the guide it says localhost:8009(https://forums.oracle.com/message/4804030).
This is where i've placed ServletHandler.class:
/var/lib/tomcat7/webapps/rmi/WEB_INF/classes
My web.xml(inside WEB_INF) looks like this:
<servlet>
<servlet-name>ServletHandler</servlet-name>
<servlet-class>ServletHandler</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ServletHandler</servlet-name>
<url-pattern>/ServletHandler</url-pattern>
</servlet-mapping>
I've installed tomcat 7 properly.
My access log gives me the same but my error log now gives me(with localhost:8009 set in httpd.conf):
[Fri Nov 15 08:16:26 2013] [error] [client 127.0.0.1] Invalid method in request \x124\x01\xb2\x02\x02
[Fri Nov 15 08:16:26 2013] [error] ajp_check_msg_header() got bad signature 3c21
[Fri Nov 15 08:16:26 2013] [error] ajp_ilink_receive() received bad header
[Fri Nov 15 08:16:26 2013] [error] ajp_read_header: ajp_ilink_receive failed
[Fri Nov 15 08:16:26 2013] [error] (120007)APR does not understand this error code: proxy: read response failed from (null) (localhost)
Error log when setting my global ip and port 80 in http.conf:
[Fri Nov 15 08:13:26 2013] [error] [client xx.xxx.xxx.xxx] Invalid method in request \x124\x01\xb2\x02\x02
[Fri Nov 15 08:13:26 2013] [error] ajp_check_msg_header() got bad signature 3c21
[Fri Nov 15 08:13:26 2013] [error] ajp_ilink_receive() received bad header
[Fri Nov 15 08:13:26 2013] [error] ajp_read_header: ajp_ilink_receive failed
[Fri Nov 15 08:13:26 2013] [error] (120007)APR does not understand this error code: proxy: read response failed from (null) (xx.xxx.xxx.xxx)
EDIT 4:
Now it lookes like this:
web.xml:
<servlet>
<servlet-name>ServletHandler</servlet-name>
<servlet-class>rmiservlethandler.ServletHandler</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ServletHandler</servlet-name>
<url-pattern>/ServletHandler</url-pattern>
</servlet-mapping>
httpd.conf:
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_ajp_module /usr/lib/apache2/modules/mod_proxy_ajp.so
<Location /cgi-bin/java-rmi.cgi>
ProxyPass ajp://xx.xxx.xxx.xxx:8009/rmi/ServletHandler
</Location>
I tried localhost:8009 but that gives me error, entering my servers global adress makes my webserver to halt, HTTP 503. Stop responding.
My error log for localhost:
[Fri Nov 15 12:20:53 2013] [error] (111)Connection refused: proxy: AJP: attempt to connect to 127.0.0.1:8009 (localhost) failed
[Fri Nov 15 12:20:53 2013] [error] ap_proxy_connect_backend disabling worker for (localhost)
[Fri Nov 15 12:20:53 2013] [error] proxy: AJP: failed to make connection to backend: localhost
error log for global ip:
[Fri Nov 15 12:37:23 2013] [error] (110)Connection timed out: proxy: AJP: attempt to connect to xx.xxx.xxx.xxx:8009 (xx.xxx.xxx.xxx) failed
[Fri Nov 15 12:37:23 2013] [error] ap_proxy_connect_backend disabling worker for (xx.xxx.xxx.xxx)
[Fri Nov 15 12:37:23 2013] [error] proxy: AJP: failed to make connection to backend: xx.xxx.xxx.xxx
Tomcatlog gives me this:
My tomcatlog gives me this:
xx.xxx.x.xx - - [15/Nov/2013:13:32:14 +0000] "POST /rmi/ServletHandler?forward=1099 HTTP/1.1" 404 987
EDIT 5.
Didn't work, i get 404 for /rmi/ServletHandler.
Here is my httpd.conf(taking away .cgi):
<Location /cgi-bin/java-rmi> ProxyPass ajp://localhost:8009/rmi/ServletHandler </Location>
This is web.xml:
<?xml version="1.0" encoding="UTF-8"?> <web-app> <servlet>
<servlet-name>ServletHandler</servlet-name>
<servlet-class>rmiservlethandler.ServletHandler</servlet-class>
<load-on-startup>1</load-on-startup> </servlet>
<servlet-mapping> <servlet-name>ServletHandler</servlet-name>
<url-pattern>/ServletHandler</url-pattern>
</servlet-mapping>
</web-app>
The folder setup is now:
/var/lib/tomcat7/webapps/rmi/WEB_INF.
WEB_INF contains web.xml and classes/rmiservlethandler/ where rmiservlethandler is where all my class files are(package structure).
Why isn't this working?
My /usr/lib/cgi-bin/ is empty that is should be right?
My servlet dosen't run...
Thanks!
Solved it!
My folder setup were correct(except WEB-INF instead of WEB_INF), the problem was that my localhost adress in ServletHandler wasn't resolved properly(my localhost name wasn't localhost..).
Other things like WEB_INF should be WEB-INF...
Following this gave my exceptions in tomcat catalina.out and local host log files.
So if you think your servlet is running properly, look there for exceptions. I modified my ServletHandler with logs so i could se everything that was going on.
This is what my POST from the client looks now inside tomcat logs:
xx.xxx.x.xx - - [18/Nov/2013:13:17:23 +0000] "POST /rmi/ServletHandler?forward=1099 HTTP/1.1" 200 1
My http.conf:
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_ajp_module /usr/lib/apache2/modules/mod_proxy_ajp.so
<Location /cgi-bin/java-rmi.cgi>
ProxyPass ajp://localhost:8009/rmi/ServletHandler
</Location>
My web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<servlet>
<servlet-name>ServletHandler</servlet-name>
<servlet-class>com.foo.bl.server.ServletHandler</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ServletHandler</servlet-name>
<url-pattern>/ServletHandler</url-pattern>
</servlet-mapping>
</web-app>
Folder structure:
/var/lib/tomcat7/webapps/rmi/WEB-INF/classes/
Inside classes you put the same folder structure you have in your java IDE.
Web.xml should be placed inside WEB-INF.
Any lib files needed should be placed in WEB-INF/lib.
Hope it helps someone out there!
Regards Gustav