File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes mod_jk error with POST request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "mod_jk error with POST request" Watch "mod_jk error with POST request" New topic
Author

mod_jk error with POST request

Alexis Gamarra
Greenhorn

Joined: Aug 18, 2010
Posts: 3
Hi all,
I hope than any can help me with this problem.
The topology that I try to do is that:

[App-1]====>(Post request)====>[Balancer]=====>[App2 - JBoss instance]

* The parameter sended via Post is a XML that represents an entity

The JBoss server is listen the port 8009 but mi App2 have a service that is listen the port 8900, this service is configured with Mule-ESB.

I try this configurations:
1.- Worker port: 8900
In this case App2 receive an unexpected message (see result.png)
2.- Worker port: 8009
The message is sended to App2 by balancer (I know that because the message in "access.log" is: "127.0.0.1 - - [23/Aug/2011:15:00:47 -0500] "POST /orderReceiver HTTP/1.1" 404 988") but this is not attended by App2
3.- Worker port: 8009 and App2 listen the same port 8009
The same result as scenario #1

In case #1, when I set "JkLogLevel debug" in mod-jk.conf I see that the XML is sendend but preceded by some meta-information, I suspect that this information is nos recognized by my service and for this reason I obtain the result shown in result.png

sending to ajp13 pos=4 len=184 max=8192
0000 12 34 00 B4 02 04 00 08 48 54 54 50 2F 31 2E 31 - .4......HTTP/1.1
0010 00 00 0E 2F 6F 72 64 65 72 52 65 63 65 69 76 65 - .../orderReceive
0020 72 00 00 09 31 32 37 2E 30 2E 30 2E 31 00 FF FF - r...127.0.0.1...
0030 00 09 6C 6F 63 61 6C 68 6F 73 74 00 00 50 00 00 - ..localhost..P..
0040 03 A0 0E 00 1E 4A 61 6B 61 72 74 61 20 43 6F 6D - .....Jakarta.Com
0050 6D 6F 6E 73 2D 48 74 74 70 43 6C 69 65 6E 74 2F - mons-HttpClient/
0060 33 2E 31 00 A0 0B 00 09 6C 6F 63 61 6C 68 6F 73 - 3.1.....localhos
0070 74 00 A0 08 00 03 34 33 30 00 06 00 05 6E 6F 64 - t.....430....nod
0080 6F 32 00 0A 00 0F 41 4A 50 5F 52 45 4D 4F 54 45 - o2....AJP_REMOTE
0090 5F 50 4F 52 54 00 00 04 32 31 35 37 00 0A 00 10 - _PORT...2157....
00a0 4A 4B 5F 4C 42 5F 41 43 54 49 56 41 54 49 4F 4E - JK_LB_ACTIVATION
00b0 00 00 03 41 43 54 00 FF 00 00 00 00 00 00 00 00 - ...ACT..........
ajp_send_request::jk_ajp_common.c (1684): (nodo2) request body to send 430 - request body to resend 0
ajp_send_request::jk_ajp_common.c (1789): (nodo2) sending 430 bytes of request body
sending to ajp13 pos=4 len=436 max=8192
0000 12 34 01 B0 01 AE 3C 55 73 61 67 65 52 65 71 75 - .4....<UsageRequ
0010 65 73 74 3E 0A 20 20 3C 61 63 63 6F 75 6E 74 4E - est>...
...
0160 64 65 72 52 65 71 75 65 73 74 3E 0A 20 20 3C 64 - ..............<d
0170 61 74 65 52 65 71 75 65 73 74 3E 32 30 31 31 2D - ateRequest>2011-
0180 30 38 2D 32 33 20 31 35 3A 32 34 3A 34 38 2E 34 - 08-23.15:24:48.4
0190 34 37 20 43 4F 54 3C 2F 64 61 74 65 52 65 71 75 - 47.COT</dateRequ
01a0 65 73 74 3E 0A 3C 2F 55 73 61 67 65 52 65 71 75 - est>.</UsageRequ
01b0 65 73 74 3E 00 00 00 00 00 00 00 00 00 00 00 00 - est>............

I've made a trivial app that recive and print a GET request and print it in console, this app works fine. I deploy this app in a default Tomcat (with default ports).. I can't test this app with POST request.

So, my questions are:
1.- mod_jk allow the POST request? It's necessary to do any change in my configuration to receive POST request?
2.- Exist any difference between the original POST and the POST received by Mule-ESB?
3.- It's necessary to do any other configuration in my JBoss instance?

I've atached my configuration files.


Any help is welcome,

Alexis Gamarra Cano


[Thumbnail for result.png]



Alexis Gamarra
Alexis Gamarra
Greenhorn

Joined: Aug 18, 2010
Posts: 3
These are the settings I used:


Configuration in Apache:
========================

In file <APACHE_HOME>/conf/httpd.conf I add this row:

# Include mod_jk configuration file
Include conf/mod-jk.conf

------------------------------------------------------------------------

Create a mod-jk.conf into <APACHE_HOME>/conf

# Load mod_jk module
# Specify the filename of the mod_jk lib
LoadModule jk_module modules/mod_jk.so

# Where to find workers.properties
JkWorkersFile conf/workers.properties

# Where to put jk logs
JkLogFile logs/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel debug

# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

# JkOptions indicates to send SSK KEY SIZE
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat
JkRequestLogFormat "%w %V %T"

# Mount your applications
JkMount /application/* loadbalancer

# You can use external file for mount points.
# It will be checked for updates each 60 seconds.
# The format of the file is: /url=worker
# /examples/*=loadbalancer
JkMountFile conf/uriworkermap.properties

# Add shared memory.
# This directive is present with 1.2.10 and
# later versions of mod_jk, and is needed for
# for load balancing to work properly
JkShmFile logs/jk.shm

# Add jkstatus for managing runtime data
<Location /jkstatus/>
JkMount status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>

------------------------------------------------------------------------

File workers.properties:

# Define list of workers that will be used
# for mapping requests
# The configuration directives are valid
# for the mod_jk version 1.2.18 and later
worker.list=loadbalancer,status

# Load-balancing behaviour
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=nodo2
worker.loadbalancer.sticky_session=1

# Definimos el nodo Nodo1
# Puerto del conector ajp de nuestro tomcat (JBoss)
#worker.nodo1.port=8009
# Ip del nodo 1.
#worker.nodo1.host=10.3.50.66
#worker.nodo1.type=ajp13
# Peso de nuestro nodo. A más peso, mas peticiones recibe.
#worker.nodo1.lbfactor=1

# Definimos el nodo Nodo2
worker.nodo2.port=8900
worker.nodo2.host=localhost
worker.nodo2.type=ajp13
worker.nodo2.lbfactor=1

# Status worker for managing load balancer
worker.status.type=status

------------------------------------------------------------------------

File uriworkermap.properties

# Simple worker configuration file
# Mount the Servlet context to the ajp13 worker
/jmx-console=loadbalancer
/jmx-console/*=loadbalancer
#/web-console=loadbalancer
#/web-console/*=loadbalancer
/orderReceiver=loadbalancer
/orderReceiver/*=loadbalancer

------------------------------------------------------------------------

Configuration in Jboss instance:
================================

In file <JBOSS_HOME>/server/all/deploy/cluster-service.xml TCP section have to be commented but instead of will be this section:


------------------------------------------------------------------------

In file jboss-web/deployer/server.xml:

Comment this part:

Uncomment this part:


Add:


------------------------------------------------------------------------

In file <JBOSS_HOME>/server/all/deploy/jboss-web.deployer/META-INF :



------------------------------------------------------------------------

In file <JBOSS_HOME>/server/all/deploy/jboss-web-cluster.sar/META-INF :
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: mod_jk error with POST request