mansree sreeal

+ Follow
since Jun 29, 2021
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by mansree sreeal

Thank you, Tim

I have a UI page with an image icon (export to excel) to download the report

Steps for loading data into CSV file:
1) Data pull from database table using PreparedStatement.
2) Condition applied to skip the rows.
3) Data are appended in an object array.
4) Header columns are formed using a PreparedStatement (the header columns vary based on step1).
5) Data load to CSV file from the object array and writing to the file using XSSFWorkbook.

Getting out of memory error in step5 while writing the data into the CSV file.

As you said, loading into RAM and adopting a streaming approach is the solution or any other approach?
1 month ago
I am trying to export data in an Excel file, there are 100k rows to be exported. I am getting java.lang.OutOfMemoryError: GC overhead limit exceeded error and other warning messages.

I have increased the heap memory to 8GB but still getting the out-of-memory error.   Please know any code change that needs to be done or to look at the server configuration settings.

I am using Spring MVC 4. x, Java 8 and Tomcat version 7 for the development.

For the data download,  I am using jdbctemplate query and byte array

Code Snippet

Error Log

Handler processing failed; nested exception is java.lang.OutOfMemoryError: GC overhead limit exceeded
at org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(
at org.springframework.web.servlet.DispatcherServlet.doDispatch(
at org.springframework.web.servlet.DispatcherServlet.doService(
at org.springframework.web.servlet.FrameworkServlet.processRequest(
at org.springframework.web.servlet.FrameworkServlet.doPost(
at javax.servlet.http.HttpServlet.service(
at org.springframework.web.servlet.FrameworkServlet.service(
at javax.servlet.http.HttpServlet.serviceInternal(
at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(

WARN JDBC Connection to reset not identical to originally prepared Connection - please make sure to use connection release mode ON_CLOSE (the default) and to run against Hibernate 4.2+ (or switch HibernateJpaDialect’s prepareConnection flag to false

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread

1 month ago
I have developed a Springmvc application and deployed the application in AWS cloud server, the application is running on Tomcat and Apache as the proxy server.
Also I have created application load balancer url and registered two under the aws trusted group and configured Apache loadbalancer configuration.

While testing in the browser, the application is always redirecting to my application error page.
I am getting error message The request was rejected because the URL was not normalized.

Please help from which part this error is occuring.

Error Log
SEVERE [http-nio-8880-exec-5] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [dispatcher] in context with path [/BOOKS] threw exception The request was rejected because the URL was not normalized.
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardwrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.service(
at org.apache.coyote.AbstractProcessorLight.process(
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(
at java.util.concurrent.ThreadPoolExecutor.runworker(
at java.util.concurrent.ThreadPoolExecutor$
at org.apache.tomcat.util.threads.TaskThread$
INFO (main) org.apache.catalina.core.ApplicationContext.log Destroying Spring FrameworkServlet 'dispatcher'
INFO [main] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext

Apache Load Balancer Configuration
<Proxy "balancer://mycluster">
   BalancerMember "http://192.168.101.xx:80/"
   BalancerMember "http://192.168.101.xx:80/"
ProxyPass        "/" "balancer://mycluster"
ProxyPassReverse "/" "balancer://mycluster"

ProxyRequests Off
ProxyPreserveHost off


<?xml version="1.0" encoding="UTF-8"?>


<param-name>context ConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml, /WEB-INF/spring-security.xml</param-value>



















3 months ago
I have a requirement

I need to show the userid, URI and datetime stamp details in the log file.

I tried applying the pattern changes (%u) in the Valve tag under the server.xml.

I am using CA Single Sign On (SSO) to login the application. I am getting datetime, URI but the userid remains showing "-" instead of the actual user id who login to the application.

It's a SpringMVC 5.x framework and Tomcat version 9.x.

Please help me what pattern setting I need to apply in the server.xml.
4 months ago
We are migrating Oracle DB version from 11 to 19. While testing the application, we are unable to view the PDF content and download the PDF. We are using Java version 8, Spring-MVC 5 framework for the application development and the code is running on Tomcat version 9.

We are able to view the content and download the PDF when the application running on Oracle  DB version 11 but not on version 19.

This issue happening only for the PDF view and not on the Doc, Xls file extensions.

I also referred the below links but it did not work.

Please help.


Error Details
Systemld Unknown; Line #1; Column #17907; The entity name must immediately follow the '& in the entity reference.
fr.opensagres.xdocreport.converter.XDocConverterException: java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.ooxml.POIXMLTypeloader
at fr.opensagres.xdocreport.document.AbstractXocReport.convert(
at org.springframework.cglib.proxy.MethodProxy.invoke(
at org.springframework.aop.framework.ClibAopProxy$CglibMethodInvocation.invokeJoinpoint(
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
at org.springframework.transaction.Interceptor.TransactionAspectSupport.invokeWithinTransaction(
at org.springframework.transaction.interceptor.TransactionInterceptor.Invoke(
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.ooxml.POIXMLTypeLoader
at org.apache.pol.xwpf.usermodel.XWPFDocument.onDocumentRead(
at org.apache.pol.ooxml.PODMLDocument.load(
at fr.opensagres.xdocreport.comverter.docx.poi.itext.XWPF2PDFVialTextConverter.convert(
at fr.opensagres.xdocreport.document.AbstractXDocReport.convert(

1) I have a logout link in my application, while clicking on the logout link, page redirect to logout without any issues.

2) When there is no user intervention on the application for 20 minutes, the session expires and while clicking on any of the links, it is not redirecting to logout page and here I see the CORS error message (in the browser developer tools).

3) I also have a popup window (AngularJS code) for the session time extension having Continue and Exit button. If I click on the Exit button, it is not redirecting to logout page. Here too I see the same CORS error message.

The Application and Logout page are two different domain URLs. In this application, we use SSO for login and logout.
7 months ago
When I am trying to download the file from UI, a part of the filename is truncated and I am unable to download the file. For example:- if the actual file name is "testscript.doc", while reading through the servletrequest getparameter method, the filename is truncated and I am getting the file name as "test.doc". Here the word "script" is missing from the file name.

This is happening only when I use "script" anywhere in the filename.

The UI part is  written in AngularJS and the background processing is through Java.

I have debugged using developer tools. I could see the actual file name for downloading but at the background processing (servlet) I could see a part of the filename truncated and unable to download the file.

The application is developed using SpringMVC framework.  For download logic, I am using Java Servlet and AngularJS. The application is hosted on the Tomcat server.

A part of the filename is truncated after the request is sent from UI due to which I am unable to download the file. Please help.

Code snippet

7 months ago
In ou application we are using AngularJS, SpringMVC 5, Tomcat and single-sign-on (SSO). Issue is when the application session is timed-out or Invalid session, the application URL is not redirected back to login page. I am getting CORS error message.

I referred to the below link by changing the dispatcher-servlet and spring-security settings but it did not work.

Here is the sample JavaScript code for Invalid Session and Session timeout, please help how to apply CORS on the below code.


7 months ago

I am developing a Queue message proof of concept on Spring-MVC 5.x, Java 8 and Tomcat server 9.x. While reading the queue messages from the Oracle table, thread warning messages appending in the Catalina log file.

If I try to shutdown and start the tomcat server, the tomcat server is not shutting down during the first time but on the next call tomcat server is shutting down and a memory leak warning message is logged in the log file.

Please help why I am unable to shutdown the tomcat server during the first time.

Log details

INFO [main] org.apache.catalina.core.Aprlifecyclelistener.lifecycleEvent The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path
INFO [main] org.apache.coyote.Abstract Protocol.init Initializing ProtocolHandler ["http-nio-9090"]
INFO [main] Using a shared selector for servlet write/read
INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["https-jsse-nio-8443"]
INFO [main] Using a shared selector for servlet write/read
INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 912 ms
INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.53]
INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/apps/opt/tomcat/webapps/Books.war]
WARNING [localhost-startStop-1] org.apache.tomcat.util.descriptor.web.WebXml.setVersion Unknown version string [4.0]. Default version will be used.
INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup: time and JSP compilation time.
INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/apps/opt/tomcat/webapps/Books.war] has finished in [62,365] ms
INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-9090"]
INFO [main] org.apache.coyote.AbstractProtocol.start Starting Protocollandler ["https-jsse-nio-8443"]
INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 82019 ms
INFO [main] org.apache.catalina.core.StandardServer.await A valid shutdown command was received via the shutdown port. Stopping the Server instance.

INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-9090"]
INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["https-jsse-nio-8443"]
INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferences Threads The web application [Books] appears to have started a thread named [AQThread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Thread.sleep(Native Method)

WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferences Threads The web application [Books] appears to have started a thread named [AQThread] but has failed to stop it. This is very likely to create a nemory leak. Stack trace of thread: Method)

INFO [AQThread] org.apache.catalina.loader WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load [oracle.AQ.AQOracleQueue]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.

java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [oracle.AQ.AQOracleQueue]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(
7 months ago
Thank you, issue resolved
8 months ago
I have placed the Websphere and the Tomcat migration code. For the Tomcat migration, I have made the code changes in the existing WebSphere class "UtilityConnectionService" in the Step3.

Also added the server.xml file.

I am getting java.lang.AbstractMethodError error message.

Please let me know whether I have to apply any changes in the server.xml file and could you provide suggestion for closing connection.

(Websphere DB Connection)

Step2 (Tomcat Migration)
Its working when I tried hard-code the DB connection in my "dequeMsg" method but when I tried to call the connection method from the Utility class it is failing as in Step3



 <Resource name="jdbc/bookds" auth="Container" type="javax.sql.DataSource"
              maxTotal="100" maxIdle="30" maxWaitMillis="10000" maxWait="10000" maxActive="100"
              username="test" password="test123" jdbcInterceptors="ConnectionState;StatementFinalizer"
              url="jdbc:oracle:thin:@localhost:1521:booksdb/" validationQuery="select 1 from dual" />

8 months ago
I was using (which is part of IBM Websphere) for Oracle DB connectivity and now migrating code part of Tomcat webserver version 9.x I am getting java.lang.AbstractMethodError error message. I referred to the link dbconnection but still getting the error java.lang.classcastexception incompatible with oracle.jdbc.oracleConnection.

The DB connection is established while trying to AQqueue.

Please help.

Error log
at org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.unwrap(
at org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.unwrap(
at com.Books.util.UtilitySvc.ConnectionPvtNativeAcquire(
at com.Books.util.UtilitySvc.execute(
at com.Books.util.UtilitySvc.ConnectionNativeAcquire(
at org.apache.catalina.core.StandardWrapper.initServlet(
at org.apache.catalina.core.StandardWrapper.loadServlet(
at org.apache.catalina.core.StandardWrapper.load(
at org.apache.catalina.core.StandardContext.loadOnStartup(
at org.apache.catalina.core.StandardContext.startInternal(
at org.apache.catalina.util.LifecycleBase.start(
at org.apache.catalina.core.ContainerBase.addChildInternal(
at org.apache.catalina.core.ContainerBase.addChild(
at org.apache.catalina.core.StandardHost.addChild(
at org.apache.catalina.startup.HostConfig.deployWAR(
at org.apache.catalina.startup.HostConfig$
at java.util.concurrent.Executors$
at org.apache.tomcat.util.threads.InlineExecutorService.execute(
at java.util.concurrent.AbstractExecutorService.submit(
at org.apache.catalina.startup.HostConfig.deployWARS(
at org.apache.catalina.startup.HostConfig.deployApps (
at org.apache.catalina.startup.HostConfig.start(
at org.apache.catalina.startup.HostConfig.lifecycleEvent(
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(
at org.apache.catalina.util.LifecycleBase.setStateInternal(
at org.apache.catalina.util.LifecycleBase.setState(
at org.apache.catalina.core.ContainerBase.startInternal(
at org.apache.catalina.core.StandardHost.startInternal(
at org.apache.catalina.util.LifecycleBase.start(
at org.apache.catalina.core.ContainerBase$
at org.apache.catalina.core.ContainerBase$
at org.apache.tomcat.util.threads.InlineExecutorService.execute(
at java.util.concurrent.AbstractExecutorService.submit(
at org.apache.catalina.core.ContainerBase.startInternal(
at org.apache.catalina.core.StandardEngine.startInternal(
at org.apache.catalina.util.LifecycleBase.start(
at org.apache.catalina.core.StandardService.startInternal(Standard
at org.apache.catalina.util.LifecycleBase.start(
at org.apache.catalina.core.StandardServer.startInternal(
at org.apache.catalina.util.LifecycleBase.start(
at org.apache.catalina.startup.Catalina.start(
at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.apache.catalina.startup.Bootstrap.start(
at org.apache.catalina.startup.Bootstrap.main(
8 months ago
In my application we have bouncy castle dependency is used. I want this dependency to be excluded from the pom.xml file.
Even after removing this dependency from the pom file, it is still appearing in the .m2 repository folder.
While deploying there are two different versions of bcprov ( bcprov-jdk14 and bcprov-jdk15on) dependencies.
I need to exclude both bcprov-jdk14 and bcprov-jdk15on from the pom.xml file.


I also tried looking on this link but it did not worked for me.

I ran the mvc dependency:tree command and this is the link on the tree output

Please help how to exclude these dependencies.
9 months ago
Issue : After providing credentials in the login page, the page is redirected to http://localhost:8080/BOOKS/j_spring_security_check. I am using custom login page for authenticating. This application runs on Tomcat 9 and it is a spring mvc 5 framework

Could you please check why it is redirected to j_spring_security_check instead of target page.

Here is my spring-security.xml file

<beans:beans xmlns=""
xmlns:beans="" xmlns:xsi=""

<http pattern="/resources/**" security="none" />
<http entry-point-ref="loginUrlAuthenticationEntryPoint" use-expressions="true">
<intercept-url pattern="/web/**" access="permitAll" />
<intercept-url pattern="/j_spring security_check" access="isAnonymous()" />
<intercept-url pattern="/web/j_spring security_check" access="isAnonymous()" /> <intercept-url pattern="/**" access="hasAnyRole('USER_ROLE', 'USER_ADMIN')" />
<logout success-handler-ref="CustomLogoutHandler" invalidate-session="true" delete-cookies="JSESSIONID" />
<access-denied-handler error-page="/web/Index.html" />

<custom-filter position="CONCURRENT_SESSION_FILTER" ref="concurrencySesFilter" />
<custom-filter position="FORM_LOGIN_FILTER" ref="FormFilter"/>
<custom-filter position="LAST" ref="appFilter" />
<session-management session-authentication strategy-ref="comsess" invalid-session-url="/web/Sessioninvalid.html" />

   <authentication-manager alias="authenticationManager">
<authentication-provider ref="CustomAuthenticationProvider"/>

   <beans:bean id="springSecurityFilterChain" class="org.springframework.web.filter.DelegatingFilterProxy"/>
   <beans:bean id="CustomLogoutHandler" class="com.books.authentication.CustomLogoutHandler"/>
   <beans:bean id="CustomAuthentication Provider" class="com.books.authentication.CustomAuthenticationProvider"/>
   <beans:bean id="customAuthenticationSuccessHandler" class="com.books.authentication.CustomAuthenticationSuccessHandler"/>
   <beans:bean id="appFilter" class="com.books.vamp.filter.ApplicationFilter"/>
   <beans:bean id="customAuthenticationFailureHandler" class="com.books.authentication.CustomAuthenticationFailureHandler"/>

   <beans:bean id="redirectSessionInformationExpiredStrategy" class="">
      <beans:constructor-arg name="invalidSessionUrl" value="/web/Sessioninvalid.html" />

   <beans:bean id="concurrencySesFilter" class="">
<beans:constructor-arg name="sessionRegistry" ref="sessionRegistry" />
<beans:constructor-arg name="sessionInformationExpiredStrategy" ref="redirectSessionInformationExpiredStrategy" />

   <beans:bean id="FormFilter" class="">
<beans:property name="sessionAuthenticationStrategy" ref="comsess" />
<beans:property name="authenticationManager" ref="authentication Manager" />
<beans:property name="authenticationFailureHandler" ref="customAuthenticationFailureHandler"/>
<beans:property name="authenticationSuccessHandler" ref="customAuthenticationSuccessHandler"/>
<beans:property name="usernameParameter" value="username"/>
<beans:property name="passwordParameter" value="password"/>

<beans:bean id="sessionRegistry" class="" />

   <beans:bean id="loginUrlAuthenticationEntryPoint" class="">
<beans:constructor-arg name="loginFormUrl" value="/web/Index.html" />

<beans:bean id="comsess" class="">

<beans:bean class="">
<beans:constructor-arg ref="sessionRegistry"/>
<beans:property name="maximumSessions" value="1" />
<beans:property name="exceptionIfMaximumExceeded" value="false" />

<beans:bean class="">

<beans:bean class="">
<beans:constructor-arg ref="sessionRegistry"/>



<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns=""

<mvc: annotation-driven />

<context: annotation-config />
<context:component-scan base-package="" />
<context:component-scan base-package="" />

<!-- added for spring5 mvc -->
<beans:bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping">
<property name="useDefaultSuffixPattern" value="false" />
<beans:bean class="org.springframework.web.servlet.mvc.annotation.Request MappingHandlerMapping" />

<!-- JSP -->
<beans:bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/views/" />
<property name="suffix" value=".jsp" />

<!-- Resource -->
<- <mvc:resources mapping="/resources/*** location="/resources/" />-->
<resources mapping="/resources/*** location="/resources/" />

<!-- DB -->
<beans:bean id="vampjdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />

<beans:bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">

<tx:annotation-driven transaction-manager="transactionManager" />

<beans:bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" scope="singleton">
<property name="dataSource" ref="dataSource" />


10 months ago