Bilal-S / iis2tomcat

AJP Connector between Internet Information Services (IIS) and Apache Tomcat
http://www.boncode.net/boncode-connector
49 stars 32 forks source link

requestXML is empty or null #106

Closed umashankar1988 closed 3 years ago

umashankar1988 commented 3 years ago

We are using Boncode version 1.0.36 and we are facing an issue in updating xml file. We get the following errors requestXML is empty or null when updating the XML file. Tomcat version is 8.0.45 and IIS version 10.0.14393 and Windows 2016.

Please find the boncode settings file and tomcat server.xml. Also, attached is the log file containing the error. Could you guys help us find out what can be the possible cause or a workaround to fix this issue?

Boncode setting

<Settings>
  <Port>8009</Port>
  <Server>localhost</Server>   
  <MaxConnections>200</MaxConnections>
<PacketSize>65500</PacketSize>
  <LogLevel>4</LogLevel> 
<LogDir>D:\GeodataFiles\BonCode</LogDir>
<TomcatConnectErrorURL1>http://msn.com</TomcatConnectErrorURL1>
  <FlushThreshold>0</FlushThreshold>
  <EnableRemoteAdmin>False</EnableRemoteAdmin>
</Settings>

Tomcat server.xml

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->

    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443"  />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation that requires the JSSE
         style configuration. When using the APR/native implementation, the
         OpenSSL style configuration is required as described in the APR/native
         documentation -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" connectionTimeout="120000" packetSize="65500" />

    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="localhost">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>
    </Engine>
  </Service>
</Server>

Boncode logs

2021-04-05 16:36:35 BonCodeAJP13.TomcatPackets.TomcatSendHeaders 10 bytes

 begin of packet ====> 
Type:4
User Data High:0
User Data Low:200
 OK  
 <==== end of packet

2021-04-05 16:36:35 BonCodeAJP13.TomcatPackets.TomcatSendBodyChunk  40 bytes

 begin of packet ====> 
Type:3
User Data High:0
User Data Low:36
<b>requestXML is empty or null</b>

 <==== end of packet

2021-04-05 16:36:35 BonCodeAJP13.TomcatPackets.TomcatSendBodyChunk  4 bytes

 begin of packet ====> 
Type:3
User Data High:0
User Data Low:0

 <==== end of packet

2021-04-05 16:36:35 BonCodeAJP13.TomcatPackets.TomcatEndResponse  2 bytes

 begin of packet ====> 
Type:5
 <==== end of packet

2021-04-05 16:36:35 warning Incorrect response received from Tomcat
2021-04-05 16:36:35 warning Empty packet received from tomcat
2021-04-05 16:36:35 Closing Stream
2021-04-05 16:36:35 BonCodeAJP13.TomcatPackets.TomcatSendHeaders 110 bytes
 > Set-Cookie : USERSESSION=b1161695d98f985633c37f88efb4c7293c41ba5a; Path=/
 > Content-Type : application/json;charset=UTF-8

 begin of packet ====> 
Type:4
User Data High:0
User Data Low:200
 OK  � <USERSESSION=b1161695d98f985633c37f88efb4c7293c41ba5a; Path=/ � application/json;charset=UTF-8
 <==== end of packet

2021-04-05 16:36:35 BonCodeAJP13.TomcatPackets.TomcatSendBodyChunk  42 bytes

 begin of packet ====> 
Type:3
User Data High:0
User Data Low:38
<b>requestXML is empty or null</b>

 <==== end of packet

2021-04-05 16:36:35 BonCodeAJP13.TomcatPackets.TomcatSendBodyChunk  4 bytes

 begin of packet ====> 
Type:3
User Data High:0
User Data Low:0

 <==== end of packet

Tomcat logs

2021-04-05 16:36:35,513 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.methods.EntityEnclosingMethod] - Request body sent
2021-04-05 16:36:35,513 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpConnection] - enter HttpConnection.flushRequestOutputStream()
2021-04-05 16:36:35,513 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpMethodBase] - enter HttpMethodBase.readResponse(HttpState, HttpConnection)
2021-04-05 16:36:35,513 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpMethodBase] - enter HttpMethodBase.readStatusLine(HttpState, HttpConnection)
2021-04-05 16:36:35,513 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpConnection] - enter HttpConnection.readLine()
2021-04-05 16:36:35,513 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readLine(InputStream, String)
2021-04-05 16:36:35,513 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readRawLine()
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [httpclient.wire.header] - << "HTTP/1.1 200 OK[\r][\n]"
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpMethodBase] - enter HttpMethodBase.readResponseHeaders(HttpState,HttpConnection)
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpConnection] - enter HttpConnection.getResponseInputStream()
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HeaderParser.parseHeaders(InputStream, String)
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readLine(InputStream, String)
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readRawLine()
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readLine(InputStream, String)
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readRawLine()
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readLine(InputStream, String)
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readRawLine()
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readLine(InputStream, String)
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readRawLine()
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readLine(InputStream, String)
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readRawLine()
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readLine(InputStream, String)
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readRawLine()
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readLine(InputStream, String)
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readRawLine()
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readLine(InputStream, String)
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpParser] - enter HttpParser.readRawLine()
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [httpclient.wire.header] - << "Cache-Control: private[\r][\n]"
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [httpclient.wire.header] - << "Content-Type: text/html[\r][\n]"
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [httpclient.wire.header] - << "Server: Microsoft-IIS/8.5[\r][\n]"
2021-04-05 16:36:35,528 [DEBUG] [ajp-nio-8009-exec-9] [httpclient.wire.header] - << "X-AspNet-Version: 4.0.30319[\r][\n]"
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [httpclient.wire.header] - << "X-Powered-By: ASP.NET[\r][\n]"
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [httpclient.wire.header] - << "Date: Mon, 05 Apr 2021 14:36:35 GMT[\r][\n]"
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [httpclient.wire.header] - << "Content-Length: 36[\r][\n]"
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpMethodBase] - enter HttpMethodBase.processResponseHeaders(HttpState, HttpConnection)
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpMethodBase] - enter HttpMethodBase.processCookieHeaders(Header[], HttpState, HttpConnection)
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpMethodBase] - enter HttpMethodBase.readResponseBody(HttpState, HttpConnection)
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpMethodBase] - enter HttpMethodBase.readResponseBody(HttpConnection)
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpConnection] - enter HttpConnection.getResponseInputStream()
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpMethodBase] - enter HttpMethodBase.canResponseHaveBody(int)
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [geonetwork.util.HelperUtility] - Returncode 200
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [httpclient.wire.content] - << "<b>requestXML is empty or null</b>[\r][\n]"
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpMethodBase] - Resorting to protocol version default close connection policy
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpMethodBase] - Should NOT close connection, using HTTP/1.1
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpConnection] - enter HttpConnection.isResponseAvailable()
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpConnection] - enter HttpConnection.releaseConnection()
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [org.apache.commons.httpclient.HttpConnection] - Releasing connection back to connection manager.
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [geonetwork.metadata.MetadataManagementServlet] - Time taken for actual validation 313
2021-04-05 16:36:35,544 [DEBUG] [ajp-nio-8009-exec-9] [geonetwork.metadata.MetadataManagementServlet] - Overall Time taken for validation 1938
Bilal-S commented 3 years ago

Would it be possible to upgrade to version 1.0.41 to verify that the issue still exists?

umashankar1988 commented 3 years ago

Sure, Let me try to upgrade and test the same. Will keep you posted.

umashankar1988 commented 3 years ago

We upgraded the boncode adapter but the issue remains the same.

Here are the logs after the upgrade of the adapter to 1.0.42

2021-04-07 08:53:02 BonCodeAJP13.TomcatPackets.TomcatSendHeaders 10 bytes

 begin of packet ====> 
Type:4
User Data High:0
User Data Low:200
 OK  
 <==== end of packet

2021-04-07 08:53:02 BonCodeAJP13.TomcatPackets.TomcatSendBodyChunk  40 bytes

 begin of packet ====> 
Type:3
User Data High:0
User Data Low:36
<b>requestXML is empty or null</b>

 <==== end of packet

2021-04-07 08:53:02 BonCodeAJP13.TomcatPackets.TomcatSendBodyChunk  4 bytes

 begin of packet ====> 
Type:3
User Data High:0
User Data Low:0

 <==== end of packet

2021-04-07 08:53:02 BonCodeAJP13.TomcatPackets.TomcatEndResponse  2 bytes

 begin of packet ====> 
Type:5
 <==== end of packet

2021-04-07 08:53:02 warning Incorrect response received from Tomcat
2021-04-07 08:53:02 warning Empty packet received from tomcat
2021-04-07 08:53:02 Closing Stream
2021-04-07 08:53:02 BonCodeAJP13.TomcatPackets.TomcatSendHeaders 110 bytes
 > Set-Cookie : USERSESSION=305c4f86cd34e1b5c17ad65c83b3af9ad706d406; Path=/
 > Content-Type : application/json;charset=UTF-8

 begin of packet ====> 
Type:4
User Data High:0
User Data Low:200
 OK  � <USERSESSION=305c4f86cd34e1b5c17ad65c83b3af9ad706d406; Path=/ � application/json;charset=UTF-8
 <==== end of packet

2021-04-07 08:53:02 BonCodeAJP13.TomcatPackets.TomcatSendBodyChunk  42 bytes

 begin of packet ====> 
Type:3
User Data High:0
User Data Low:38
<b>requestXML is empty or null</b>

 <==== end of packet

2021-04-07 08:53:02 BonCodeAJP13.TomcatPackets.TomcatSendBodyChunk  4 bytes

 begin of packet ====> 
Type:3
User Data High:0
User Data Low:0

 <==== end of packet

2021-04-07 08:53:02 BonCodeAJP13.TomcatPackets.TomcatSendBodyChunk  4 bytes

 begin of packet ====> 
Type:3
User Data High:0
User Data Low:0

 <==== end of packet

2021-04-07 08:53:02 BonCodeAJP13.TomcatPackets.TomcatSendBodyChunk  6 bytes

 begin of packet ====> 
Type:3
User Data High:0
User Data Low:2

 <==== end of packet

2021-04-07 08:53:02 BonCodeAJP13.TomcatPackets.TomcatSendBodyChunk  4 bytes

 begin of packet ====> 
Type:3
User Data High:0
User Data Low:0

 <==== end of packet

2021-04-07 08:53:02 BonCodeAJP13.TomcatPackets.TomcatEndResponse  2 bytes

 begin of packet ====> 
Type:5
 <==== end of packet

2021-04-07 08:53:02 warning Empty packet received from tomcat
2021-04-07 08:53:02 Closing Stream
Bilal-S commented 3 years ago

@umashankar1988 I am trying to find your request that causes this response. The current information only shows one side of the conversation, the tomcat response, i.e. the text that <b>requestXML is empty or null</b>. Most likely cause is that Tomcat believes that it has not received a correct request.

Can you share the full conversation. The corresponding request is missing. It should contain the words BonCodeAJP13ForwardRequest in the log.

What are you trying to do? Do you have code to use to replicate the issue?

umashankar1988 commented 3 years ago

@Bilal-S

This our setup ( We have stripped off the host details and IP information from Log)

IIS - Boncode - Tomcat - Application

We are trying to post data in XML format using the POST method. We are calling one API from our web application with the request in XML format. This is the format of the request XML where we replace the INPUTMETADATAXML with the metadata.

<?xml version="1.0" encoding="UTF-8"?><SCHEMATRONVALIDATION><SCANMODE>METADATA</SCANMODE><SCANDETAILS><METADATAXML><![CDATA[INPUTMETADATAXML]]></METADATAXML></SCANDETAILS><VALIDATION>CLASSES</VALIDATION><VALIDATIONPROJECT>METADATAKATALOGEN</VALIDATIONPROJECT></SCHEMATRONVALIDATION>

So, some metadata have a very huge structure for which we get issues. For some metadata, everything works as desired because the structure is very small.

We would not be able to provide the exact code to replicate the issue.

Attached is the log file where we face the issue.

BonCodeAJP13Connection_2_20210407.log

Bilal-S commented 3 years ago

@umashankar1988 I am seeing that the configuration for Tomcat and Boncode are out of sync when it comes to packet size. Tomcat believes the packet-size is 8096 (8KB) while BonCode is using 65500.

This is indicated by Tomcat response chuncks never exceeding 8KB or (8188 bytes on payload): 2021-04-07 08:53:00 BonCodeAJP13.TomcatPackets.TomcatSendBodyChunk 8188 bytes

In short, when BonCode sends packets that are larger than 8KB you are probably experiencing issues with the communication.

I also see that in your first message in this thread you show the server.xml with this line: <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" connectionTimeout="120000" packetSize="65500" />

Which should in theory drive Tomcat to adopt the correct packet size (65500) but it is not.

Is there a possibility that you may not use the server.xml as active configuration, or it is in the different directory?

What you can do test:

This is less efficient but may not be an issue for you. Only potential issue is when you have large HTTP headers/Cookies which I don't see for you in log.

A restart may be required.

umashankar1988 commented 3 years ago

@Bilal-S

I have removed the configuration from the Boncode settings file and did a restart

. The problem remains the same. I have attached the logs.

<Settings>
  <Port>8009</Port>
  <Server>localhost</Server>   
  <MaxConnections>200</MaxConnections>
  <LogLevel>4</LogLevel> 
<LogDir>D:\GeodataFiles\BonCode</LogDir>
<TomcatConnectErrorURL1>http://msn.com</TomcatConnectErrorURL1>
  <FlushThreshold>0</FlushThreshold>
  <EnableRemoteAdmin>False</EnableRemoteAdmin>
</Settings>

We are using the server.xml only and it is placed in the tomcat directory.

According to the Boncode Documentation we had done the setting on both boncode and server.xml

You will need to change the Apache Tomcat packetsize attribute on the AJP protocol to correspond to the PacketSize setting. The maximum value possible is 65536 bytes.

BonCodeAJP13Connection_2_20210408.log

Bilal-S commented 3 years ago

@umashankar1988 I am seeing that a HTTP Post are taking place and data is sent to Tomcat. However, on some request this is returned by Tomcat <b>requestXML is empty or null</b>. It would be helpful to understand what exactly Tomcat believes it receives. Where there any errors with more specifics in catalina logs?

In previous configuration (with large packetSize) there was a clear correlation between mismatched packet sizes. As soon as a packet with higher size than expected was sent to Tomcat it returned this response.

In the current setup I don't see an obvious reason why Tomcat should barf. The data is transmitted as HTTP post. It is clearly not an empty or null state. Could something happen in the processing of the HTTP post on the target servlet?

Other Questions: During the restart, did you restart Tomcat? Then IIS? The error: Unable to write data to the transport connection: would normally happen when only IIS is restarted and or the connection pool is not cleared.

Bilal-S commented 3 years ago

Another element to check is XML encoding itself. It looks like the XML is not complete. When I Decode one of your log examples it does not look like the last tag was closed. I also guessing the XML is human readable format with many Tabs as indicated by the +. Could that be reason tomcat is showing this error. Can you verify that the client is streaming/uploading the whole XML to IIS.

<gmd:abstract>
++++++++++++<gco:CharacterString>PBR+str+fr+planer,+bestmmelser+och+rttigheter+och+r+en+produkt+sammanstlld+och+tillhandahllen+av+Lantmteriet.+Produkten+redovisar+positionen+fr+och+utbredning+av+ett+urval+av+de+rttigheter,+gemensamhetsanlggningar,+planer+samt+bestmmelser+om+marks+anvndning+som+finns+registrerade+i+textdelen+av+Fastighetsregistrets+allmnna+del.+Bland+annat+innehller+den+de+beslut+om+bestmmelser+som+lnsstyrelserna+fattar+och+r+skyldiga+att+avisera+till+Fastighetsregistret.+Registerkartans+geometrier+har+ingen+rttsverkan.

PBR-produkten+r+i+lnsstyrelsernas+lagring+uppdelad+per+detaljtyp+(plantyp,+bestmmelsetyp+etc)+varfr+det+finns+en+lng+rad+PBR-skikt+att+tillg.+

Lantmteriet+tillhandahller+hela+PBR-p

In the above case the closing tags should at least have </gco:CharacterString></gmd:abstract> which I cannot find.

umashankar1988 commented 3 years ago

Hi Bilal,

We were able to resolve the issue by doing the following steps

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" packetSize="65500" maxPostSize="8388608" />

Restarted all the services IIS , BONCODE, TOMCAT and were able to make the same work.

Thank you for your help.

Bilal-S commented 3 years ago

Glad you were able to resolve.