Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!

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
5
Given in last 30 days
4
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by mansree sreeal

Thank you, issue resolved
2 weeks 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" />



2 weeks 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)
2 weeks 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.
1 month 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>





2 months ago