mansree sreeal

Greenhorn
+ Follow
since Jun 29, 2021
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
7
Given in last 30 days
0
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(DispatcherServlet.java:1303)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:977)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.serviceInternal(HttpServlet.java:741)
at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)

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
org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL was not normalized.
at org.springframework.security.web.firewall.StrictHttpFirewall.getFirewalledRequest(StrictHttpFirewall.java:248)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:194)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
at org.apache.catalina.core.StandardwrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1723)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runworker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$wrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:750)
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/"
</Proxy>
ProxyPass        "/" "balancer://mycluster"
ProxyPassReverse "/" "balancer://mycluster"

ProxyRequests Off
ProxyPreserveHost off


web.xml

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

<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

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

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>


<servlet>
<servlet-name>RptDownload</servlet-name>
<servlet-class>com.Books.utils.RptDownload</servlet-class>
</servlet>

<servlet>
<servlet-name>InvView</servlet-name>
<servlet-class>com.Books.utils.InvView</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>InvView</servlet-name>
<url-pattern>/InvView</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>RptDownload</servlet-name>
<url-pattern>/RptDownload</url-pattern>
</servlet-mapping>

<error-page>
<error-code>404</error-code>
<location>/pages/commonerror.jsp</location>
</error-page>

<error-page>
<error-code>403</error-code>
<location>/pages/commonerror.jsp</location>
</error-page>

<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/pages/commonerror.jsp</location>
</error-page>

<context-param>
<param-name>defaultHtmlEscape</param-name>
<param-value>true</param-value>
</context-param>
<servlet>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<listener>
<listener-class>com.Books.filter.CustomHttpSessionListener</listener-class>
</listener>

<listener>
<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>

<listener>
<listener-class>com.Books.web.CleanUpSessionListener</listener-class>
</listener>

<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>

<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<session-config>
<session-timeout>30</session-timeout>
</session-config>

<listener>
<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>

</web-app>

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.
Link1
Link2

Please help.

Code


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(AbstractDocReport.java:745)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.ClibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:747)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.transaction.Interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
at org.springframework.transaction.interceptor.TransactionInterceptor.Invoke(TransactionInterceptor.java:98)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.ooxml.POIXMLTypeLoader
at org.apache.pol.xwpf.usermodel.XWPFDocument.onDocumentRead(XMPFDocument.java:161)
at org.apache.pol.ooxml.PODMLDocument.load(POIXMLDocument.java:169)
at org.apache.poi.pf.usermodel.XWPFDocument.<init>(XWPFDocument.java:126)
at fr.opensagres.xdocreport.comverter.docx.poi.itext.XWPF2PDFVialTextConverter.convert(XWPF2PDFVialTextConverter.java:66)
at fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:710)

pom.xml
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.
https://stackoverflow.com/questions/46897681/issue-when-enable-cors-on-spring-security

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



dispatcher-servlet


spring-security
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] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["https-jsse-nio-8443"]
INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector 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:
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
java.net.SocketInputStream.read(SocketInputStream.java:171)
java.net.SocketInputStream.read(SocketInputStream.java:141)
oracle.net.ns.Packet.receive(Packet.java:282)
oracle.net.ns.DataPacket.receive(DataPacket.java:103)
oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:230)
oracle.net.ns.NetInputStream.read(NetInputStream.java:175)
oracle.net.ns.NetInputStream.read(NetInputStream.java:100)
oracle.net.ns.NetInputStream.read(NetInputStream.java:85)
oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamwWrapper.java:122)
oracle.jdbc.driver.T4CSocketInputStreamwrapper.read(T4CSocketInputStreamWrapper.java:78)
oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1179)
oracle.jdbc.driver.T4CMAREngine.unmarsha1SB1(T4CMAREngine.java:1155)
oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:279)
oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:521)
oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:202)
oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1005)
oracle.jdbc.driver.OracleStatement.doExecutewithTimeout(OracleStatement.java:1307)
oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3449)
oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3493)
oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
oracle.AQ.AQOracleQueue.dequeue(AQOracleQueue.java:1625)
oracle.AQ.AQOracleQueue.dequeue(AQOracleQueue.java:1326)

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(WebappClassLoaderBase.java:1435)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1423)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1262)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1223)
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.

Step1
(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



Step3


Server.xml

 <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 com.ibm.ws.rsadapter.jdbc.wsjdbcconnection (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 com.ibm.ws.rsadapter.jdbc.wsjdbcconnection incompatible with oracle.jdbc.oracleConnection.

The DB connection is established while trying to AQqueue.

Please help.



Error log
java.lang.AbstractMethodError
at org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.unwrap(DelegatingConnection.java:811)
at org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.unwrap(DelegatingConnection.java:811)
at com.Books.util.UtilitySvc.ConnectionPvtNativeAcquire(UtilitySvc.java:8)
at com.Books.util.UtilitySvc.execute(UtilitySvc.java:7)
at com.Books.util.UtilitySvc.ConnectionNativeAcquire(UtilitySvc.java:2)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1143)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1096)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:989)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5264)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:728)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1024)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1911)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at org.apache.catalina.startup.HostConfig.deployWARS(HostConfig.java:825)
at org.apache.catalina.startup.HostConfig.deployApps (HostConfig.java:475)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1618)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:948)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1388)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:921)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(Standard Service.java:437)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:934)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:772)
at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:342)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)
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.

<dependency>
<groupId>bouncycastle</groupId>
<artifactId>bcprov-jdk14</artifactId>
<version>140</version>
</dependency>

I also tried looking on this link  https://stackoverflow.com/questions/9975167/maven-transitive-dependency-issue but it did not worked for me.

I ran the mvc dependency:tree command and this is the link on the tree output https://github.com/Wens1/books/blob/main/mavendependencies.txt

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="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">

<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" />
</http>

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

   <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="org.springframework.security.web.session.SimpleRedirectSessionInformationExpiredStrategy">
      <beans:constructor-arg name="invalidSessionUrl" value="/web/Sessioninvalid.html" />
   </beans:bean>

   <beans:bean id="concurrencySesFilter" class="org.springframework.security.web.session.ConcurrentSessionFilter">
<beans:constructor-arg name="sessionRegistry" ref="sessionRegistry" />
<beans:constructor-arg name="sessionInformationExpiredStrategy" ref="redirectSessionInformationExpiredStrategy" />
   </beans:bean>

   <beans:bean id="FormFilter" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">
<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>

<beans:bean id="sessionRegistry" class="org.springframework.security.core.session.SessionRegistryImpl" />

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

<beans:bean id="comsess" class="org.springframework.security.web.authentication.session.CompositeSessionAuthenticationStrategy">
<beans:constructor-arg>
<beans:list>

<beans:bean class="org.springframework.security.web.authentication.session.ConcurrentSessionControlAuthenticationStrategy">
<beans:constructor-arg ref="sessionRegistry"/>
<beans:property name="maximumSessions" value="1" />
<beans:property name="exceptionIfMaximumExceeded" value="false" />
</beans:bean>

<beans:bean class="org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy">
</beans:bean>

<beans:bean class="org.springframework.security.web.authentication.session.RegisterSessionAuthenticationStrategy">
<beans:constructor-arg ref="sessionRegistry"/>
</beans:beans>
</beans:list>
</beans:constructor-arg>
</beans:beans>


</beans:beans>


dispatcher-servlet.xml

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

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:cache="http://www.springframework.org/schema/cache"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee.xsd
http://www.springframework.org/schema/lang
http://www.springframework.org/schema/lang/spring-lang.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache.xsd">


<mvc: annotation-driven />

<context: annotation-config />
<context:component-scan base-package="com.books.book.utils" />
<context:component-scan base-package="com.books.book.vamp" />

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

<!-- 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>

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

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

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

</beans>





10 months ago