org.springframework.security.authentication.InternalAuthenticationServiceException: while authenticate user with oracle db - spring5

Dears,
I am trying to authenticate user with oracle db.
This is my security context spring configuration file:
<?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:security="http://www.springframework.org/schema/security"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-5.2.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.3.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<security:authentication-manager>
<security:authentication-provider>
<security:jdbc-user-service data-source-ref="dataSource"
users-by-username-query="select user_name username, password, 'true' enabled from USERS where user_name=?"
authorities-by-username-query="select u.user_name username, ur.authority from USERS u, USERS_ROLES ur where u.user_id = ur.user_id and u.user_name = ?"/>
<security:password-encoder ref="passwordEncoder" />
</security:authentication-provider>
</security:authentication-manager>
<security:http use-expressions="true">
<security:intercept-url pattern="/CreateOffer" access="isAuthenticated()" />
<security:intercept-url pattern="/docreate" access="isAuthenticated()" />
<security:intercept-url pattern="/static/**" access="permitAll" />
<security:intercept-url pattern="/" access="permitAll" />
<security:intercept-url pattern="/newaccount" access="permitAll" />
<security:intercept-url pattern="/createaccount" access="permitAll" />
<security:intercept-url pattern="/createaccountvalidation" access="permitAll" />
<security:intercept-url pattern="/login" access="permitAll" />
<security:intercept-url pattern="/ShowOffer" access="permitAll" />
<security:intercept-url pattern="/**" access="denyAll" />
<security:form-login login-page="/login"
login-processing-url="/login" username-parameter="custom_username"
password-parameter="custom_password"
authentication-failure-url="/login?error=true" />
</security:http>
<jee:jndi-lookup jndi-name="jdbc/myoracle"
id="dataSource" expected-type="javax.sql.DataSource">
</jee:jndi-lookup>
<bean id="passwordEncoder"
class="org.springframework.security.crypto.password.NoOpPasswordEncoder">
</bean>
</beans>
User:
Name Null? Type
--------- ----- -------------
USER_ID NUMBER(10)
USER_NAME VARCHAR2(50)
PASSWORD VARCHAR2(100)
ENABLED CHAR(1)
EMAIL VARCHAR2(50)
Users_roles:
Name Null? Type
------------ ----- ------------
USER_ROLE_ID NUMBER
USER_ID NUMBER
AUTHORITY VARCHAR2(45)
I believe error is coming because it is not able to convert char ( enabled column) to boolean. I have checked but couldn't find any solution. Even I have hardcorded 'true' as the value for enabled but still it is not working.
Caused by: java.sql.SQLException: Fail to convert to internal representation
at oracle.jdbc.driver.CharCommonAccessor.getBoolean(CharCommonAccessor.java:185)
Complete Error message:
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name: Apache Tomcat/9.0.37
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Jun 30 2020 20:09:49 UTC
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version number: 9.0.37.0
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 10
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.0
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jdk-12.0.2
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 12.0.2+10
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: D:\projects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Program Files\Apache Software Foundation\Tomcat 9.0
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=D:\projects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 9.0
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=D:\projects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Aug 23, 2020 12:09:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Aug 23, 2020 12:09:12 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [C:\Program Files\Java\jdk-12.0.2\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jdk-12.0.2/bin/server;C:/Program Files/Java/jdk-12.0.2/bin;c:\app\Sanjay\product\11.2.0\dbhome_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Java\jdk-12.0.2\bin;C:\Program Files\Apache Software Foundation\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin;C:\Program Files\Apache Software Foundation\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin;C:\Users\Sanjay\AppData\Local\Microsoft\WindowsApps;;C:\WINDOWS\system32;;.]
Aug 23, 2020 12:09:13 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8686"]
Aug 23, 2020 12:09:13 PM org.apache.catalina.startup.Catalina load
INFO: Server initialization in [782] milliseconds
Aug 23, 2020 12:09:13 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Aug 23, 2020 12:09:13 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.37]
Aug 23, 2020 12:09:13 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [153] milliseconds.
Aug 23, 2020 12:09:15 PM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
WARNING: Name = myoracle Property maxActive is not used in DBCP2, use maxTotal instead. maxTotal default value is 8. You have set value of "20" for "maxActive" property, which is being ignored.
Aug 23, 2020 12:09:15 PM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
WARNING: Name = myoracle Property maxWait is not used in DBCP2 , use maxWaitMillis instead. maxWaitMillis default value is -1. You have set value of "-1" for "maxWait" property, which is being ignored.
Aug 23, 2020 12:09:15 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: 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.
Aug 23, 2020 12:09:15 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Aug 23, 2020 12:09:15 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring DispatcherServlet 'offer'
Aug 23, 2020 12:09:15 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: Initializing Servlet 'offer'
Aug 23, 2020 12:09:15 PM org.springframework.security.core.SpringSecurityCoreVersion performVersionChecks
INFO: You are running with Spring Security Core 5.2.6.RELEASE
Aug 23, 2020 12:09:15 PM org.springframework.security.config.SecurityNamespaceHandler <init>
INFO: Spring Security 'config' module version is 5.2.6.RELEASE
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'isAuthenticated()' for /CreateOffer
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'isAuthenticated()' for /docreate
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'permitAll' for /static/**
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'permitAll' for /
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'permitAll' for /newaccount
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'permitAll' for /createaccount
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'permitAll' for /createaccountvalidation
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'permitAll' for /login
Aug 23, 2020 12:09:15 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'permitAll' for /ShowOffer
Aug 23, 2020 12:09:16 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'denyAll' for /**
Aug 23, 2020 12:09:16 PM org.springframework.security.config.http.HttpSecurityBeanDefinitionParser checkFilterChainOrder
INFO: Checking sorted filter chain: [Root bean: class [org.springframework.security.web.context.SecurityContextPersistenceFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 200, Root bean: class [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 400, Root bean: class [org.springframework.security.web.header.HeaderWriterFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 500, Root bean: class [org.springframework.security.web.csrf.CsrfFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 700, <org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0>, order = 1200, Root bean: class [org.springframework.security.web.savedrequest.RequestCacheAwareFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1900, Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.security.config.http.HttpConfigurationBuilder$SecurityContextHolderAwareRequestFilterBeanFactory#0; factoryMethodName=getBean; initMethodName=null; destroyMethodName=null, order = 2000, Root bean: class [org.springframework.security.web.authentication.AnonymousAuthenticationFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 2300, Root bean: class [org.springframework.security.web.session.SessionManagementFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 2400, Root bean: class [org.springframework.security.web.access.ExceptionTranslationFilter]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 2500, <org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0>, order = 2600]
Aug 23, 2020 12:09:16 PM org.hibernate.validator.internal.util.Version <clinit>
INFO: HV000001: Hibernate Validator 6.1.5.Final
Aug 23, 2020 12:09:17 PM org.springframework.security.provisioning.JdbcUserDetailsManager initDao
INFO: No authentication manager set. Reauthentication of users when changing passwords will not be performed.
Aug 23, 2020 12:09:17 PM org.springframework.security.web.DefaultSecurityFilterChain <init>
INFO: Creating filter chain: any request, [org.springframework.security.web.context.SecurityContextPersistenceFilter#299c86f0, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#4fbed6fc, org.springframework.security.web.header.HeaderWriterFilter#1b1d93e9, org.springframework.security.web.csrf.CsrfFilter#129b0ed, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#4ccf1d3e, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#75ff2b6d, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#20a7ce0, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#4ee80a94, org.springframework.security.web.session.SessionManagementFilter#7afac89a, org.springframework.security.web.access.ExceptionTranslationFilter#76d220eb, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#276eafad]
Aug 23, 2020 12:09:17 PM org.springframework.security.config.http.DefaultFilterChainValidator checkLoginPageIsntProtected
INFO: Checking whether login URL '/login' is accessible with your configuration
Aug 23, 2020 12:09:17 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: Completed initialization in 2225 ms
Aug 23, 2020 12:09:17 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8686"]
Aug 23, 2020 12:09:17 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in [4343] milliseconds
Aug 23, 2020 12:09:25 PM org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter doFilter
SEVERE: An internal error occurred while trying to authenticate the user.
org.springframework.security.authentication.InternalAuthenticationServiceException: PreparedStatementCallback; uncategorized SQLException for SQL [select user_name username, password, 'true' enabled from USERS where user_name=?]; SQL state [99999]; error code [17059]; Fail to convert to internal representation; nested exception is java.sql.SQLException: Fail to convert to internal representation
at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:123)
at org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:144)
at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:175)
at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:195)
at org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication(UsernamePasswordAuthenticationFilter.java:95)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:212)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:141)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1589)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [select user_name username, password, 'true' enabled from USERS where user_name=?]; SQL state [99999]; error code [17059]; Fail to convert to internal representation; nested exception is java.sql.SQLException: Fail to convert to internal representation
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:89)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1443)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:669)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:700)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:712)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:763)
at org.springframework.security.provisioning.JdbcUserDetailsManager.loadUsersByUsername(JdbcUserDetailsManager.java:150)
at org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl.loadUserByUsername(JdbcDaoImpl.java:181)
at org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:108)
... 41 more
Caused by: java.sql.SQLException: Fail to convert to internal representation
at oracle.jdbc.driver.CharCommonAccessor.getBoolean(CharCommonAccessor.java:185)
at oracle.jdbc.driver.T4CCharAccessor.getBoolean(T4CCharAccessor.java:697)
at oracle.jdbc.driver.OracleResultSetImpl.getBoolean(OracleResultSetImpl.java:640)
at org.apache.tomcat.dbcp.dbcp2.DelegatingResultSet.getBoolean(DelegatingResultSet.java:358)
at org.apache.tomcat.dbcp.dbcp2.DelegatingResultSet.getBoolean(DelegatingResultSet.java:358)
at org.springframework.security.provisioning.JdbcUserDetailsManager.lambda$loadUsersByUsername$0(JdbcUserDetailsManager.java:155)
at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:94)
at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:61)
at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:679)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617)
... 48 more
Thanks in advance for your help.

I was using char as enabled datatype and char is converted to java.lang.String or oracle.sql.CHAR.
I changed it to number as number can be converted to boolean and it worked fine.
Please use the below link for complete reference:
https://docs.oracle.com/cd/E11882_01/java.112/e16548/apxref.htm#JJDBC28906

Related

Converting a Storm 1 Kafka Topology to Heron, have a few questions

Been experimenting with switching a Storm 1.0.6 topology to Heron. Taking a baby step by removing all but the Kafka spout to see how things go. Have a main method as follows (modified from the original Flux version):
import org.apache.heron.eco.Eco;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class KafkaTopology {
public static void main(String[] args) throws Exception {
List<String> argList = new ArrayList<String>(Arrays.asList(args));
String file = KafkaTopology.class.getClassLoader().getResource("topology.yaml").getFile();
argList.add("local");
argList.add("--eco-config-file");
argList.add(file);
file = KafkaTopology.class.getClassLoader().getResource("dev.properties").getFile();
argList.add("--props");
argList.add(file);
argList.add("--sleep");
argList.add("36000000");
String[] ecoArgs = argList.toArray(new String[argList.size()]);
Eco.main(ecoArgs);
}
}
YAML is this:
name: "kafkaTopology-XXX_topologyVersion_XXX"
type: "storm"
config:
topology.workers: ${workers.config}
topology.max.spout.pending: ${max.spout.pending}
topology.message.timeout.secs: 120
topology.testing.always.try.serialize: true
storm.zookeeper.session.timeout: 30000
storm.zookeeper.connection.timeout: 30000
storm.zookeeper.retry.times: 5
storm.zookeeper.retry.interval: 2000
properties:
kafka.mapper.zkServers: ${kafka.mapper.zkServers}
kafka.mapper.zkPort: ${kafka.mapper.zkPort}
bootstrap.servers: ${bootstrap.servers}
kafka.mapper.brokerZkStr: ${kafka.mapper.brokerZkStr}
kafka.topic.name: ${kafka.topic.name}
components:
- id: "zkHosts"
className: "org.apache.storm.kafka.ZkHosts"
constructorArgs:
- ${kafka.mapper.brokerZkStr}
- id: "rawMessageAndMetadataScheme"
className: "org.acme.storm.spout.RawMessageAndMetadataScheme"
- id: "messageMetadataSchemeAsMultiScheme"
className: "org.apache.storm.kafka.MessageMetadataSchemeAsMultiScheme"
constructorArgs:
- ref: "rawMessageAndMetadataScheme"
- id: "kafkaSpoutConfig"
className: "org.apache.storm.kafka.SpoutConfig"
constructorArgs:
# brokerHosts
- ref: "zkHosts"
# topic
- ${kafka.topic.name}
# zkRoot
- "/zkRootKafka.kafkaSpout.builder"
# id
- ${kafka.topic.name}
properties:
- name: "scheme"
ref: "messageMetadataSchemeAsMultiScheme"
- name: zkServers
value: ${kafka.mapper.zkServers}
- name: zkPort
value: ${kafka.mapper.zkPort}
# Retry Properties
- name: "retryInitialDelayMs"
value: 60000
- name: "retryDelayMultiplier"
value: 1.5
- name: "retryDelayMaxMs"
value: 14400000
- name: "retryLimit"
value: 0
# spout definitions
spouts:
- id: "kafka-spout"
className: "org.apache.storm.kafka.KafkaSpout"
parallelism: ${kafka.spout.parallelism}
constructorArgs:
- ref: "kafkaSpoutConfig"
Relevant POM entries:
<dependency>
<groupId>org.apache.heron</groupId>
<artifactId>heron-api</artifactId>
<version>0.20.3-incubating</version>
</dependency>
<dependency>
<groupId>org.apache.heron</groupId>
<artifactId>heron-storm</artifactId>
<version>0.20.3-incubating</version>
</dependency>
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-kafka</artifactId>
<version>1.0.6</version>
</dependency>
Main method seems to run fine:
Apr 30, 2021 4:38:49 PM org.apache.heron.eco.parser.EcoParser loadTopologyFromYaml
INFO: Parsing eco config file
Apr 30, 2021 4:38:49 PM org.apache.heron.eco.parser.EcoParser loadTopologyFromYaml
INFO: Performing property substitution.
Apr 30, 2021 4:38:49 PM org.apache.heron.eco.parser.EcoParser loadTopologyFromYaml
INFO: Performing environment variable substitution.
topology type is Storm
Apr 30, 2021 4:38:49 PM org.apache.heron.eco.builder.storm.EcoBuilder buildConfig
INFO: Building topology config
Apr 30, 2021 4:38:49 PM org.apache.heron.eco.Eco printTopologyInfo
INFO: ---------- TOPOLOGY DETAILS ----------
Apr 30, 2021 4:38:49 PM org.apache.heron.eco.Eco printTopologyInfo
INFO: Topology Name: kafkaTopology-XXX_topologyVersion_XXX
Apr 30, 2021 4:38:49 PM org.apache.heron.eco.Eco printTopologyInfo
INFO: --------------- SPOUTS ---------------
Apr 30, 2021 4:38:49 PM org.apache.heron.eco.Eco printTopologyInfo
INFO: kafka-spout [1] (org.apache.storm.kafka.KafkaSpout)
Apr 30, 2021 4:38:49 PM org.apache.heron.eco.Eco printTopologyInfo
INFO: ---------------- BOLTS ---------------
Apr 30, 2021 4:38:49 PM org.apache.heron.eco.Eco printTopologyInfo
INFO: --------------- STREAMS ---------------
Apr 30, 2021 4:38:49 PM org.apache.heron.eco.Eco printTopologyInfo
INFO: --------------------------------------
Apr 30, 2021 4:38:49 PM org.apache.heron.eco.builder.storm.EcoBuilder buildTopologyBuilder
INFO: Building components
Apr 30, 2021 4:38:49 PM org.apache.heron.eco.builder.storm.EcoBuilder buildTopologyBuilder
INFO: Building spouts
Apr 30, 2021 4:38:49 PM org.apache.heron.eco.builder.storm.EcoBuilder buildTopologyBuilder
INFO: Building bolts
Apr 30, 2021 4:38:49 PM org.apache.heron.eco.builder.storm.EcoBuilder buildTopologyBuilder
INFO: Building streams
Process finished with exit code 0
Question 1: The topology exits immediately, is there an Eco flag equivalent to Flux '--sleep' to keep it running for a while (to debug, etc.)?
Question 2: Was a little surprised that I needed to pull storm-kafka in (thought there would be a Heron equivalent) - is this correct (or some other artifact?) and if so, is 1.0.6 an OK version to use or does Heron work better with another version?
Question 3: The above was with type: "storm" in the YAML, trying type: "heron" gives the following error:
INFO: Building spouts
Exception in thread "main" java.lang.ClassCastException: class org.apache.storm.kafka.KafkaSpout cannot be cast to class org.apache.heron.api.spout.IRichSpout (org.apache.storm.kafka.KafkaSpout and org.apache.heron.api.spout.IRichSpout are in unnamed module of loader 'app')
at org.apache.heron.eco.builder.heron.SpoutBuilder.buildSpouts(SpoutBuilder.java:42)
at org.apache.heron.eco.builder.heron.EcoBuilder.buildTopologyBuilder(EcoBuilder.java:70)
at org.apache.heron.eco.Eco.submit(Eco.java:125)
at org.apache.heron.eco.Eco.main(Eco.java:161)
at KafkaTopology.main(KafkaTopology.java:26)
Process finished with exit code 1
Is this just the way it is using Kafka, type needs to be storm and not heron, or is there some workaround here?
Question 1: I'm not sure why the topology would shut down on you. Try to run your submit with the --verbose flag. At this time the functionality of the --sleep argument does not exist. It could be a feature added if you need.
Question 2: There is a Heron equivalent. After Heron was donated to Apache quite a lot of work had to be done to get binary releases out. Most of that work has been done. With the next release I would hope that all binary artifacts will be distributed appropriately.
Question 3:This issue occurs because based on the type specified it looks for bolts/spouts in a certain package. When "storm" is input it expects the classes it implements or extends to be of "org.apache.storm". When "heron" is input it expects the classes it implements or extends to be of "org.apache.heron". If you use the dependency storm-kafka the type will need to be "storm". The heron equivalents can be found here. https://search.maven.org/search?q=heron-kafka
https://search.maven.org/search?q=heron-kafka
There are several Kafka Spouts for Heron. I use Storm(storm-kafka-client-2.1) clone and use it in Production.
https://search.maven.org/artifact/com.github.thinker0.heron/heron-kafka-client/1.0.4.1/jar

javax.ejb.NoSuchEJBException: EJBCLIENT000079 with JBoss 7.1 and Eclipse

I am quite new to JavaEE and tried to get a little Hello World example running (https://ibytecode.com/blog/how-to-create-a-simple-ejb3-project-in-eclipse-jboss-7-1/), but I am stuck with an
Exception in thread "main" javax.ejb.NoSuchEJBException: EJBCLIENT000079: Unable to discover destination for request for EJB StatelessEJBLocator for "/HelloWorldSessionBean/HelloWorldBean", view is interface com.ibytecode.business.HelloWorld, affinity is None
It is probably only some beginner's error, but I am lost here.
Here is my source code:
HelloWorld.java
package com.ibytecode.business;
import javax.ejb.Remote;
#Remote
public interface HelloWorld {
public String sayHello();
}
HelloWorldBean.java
package com.ibytecode.businesslogic;
import com.ibytecode.business.HelloWorld;
import javax.ejb.Stateless;
/**
* Session Bean implementation class HelloWorldBean
*/
#Stateless
public class HelloWorldBean implements HelloWorld {
public HelloWorldBean() {
}
#Override
public String sayHello() {
return "Hello World !!!";
}
}
I created a JBoss 7.1 Server in Eclipse, started and deployed the HelloWorldSessionBean. That seemed to work well:
...
10:23:17,999 INFO [org.jboss.as.ejb3.deployment] (MSC service thread 1-8) WFLYEJB0473: JNDI bindings for session bean named 'HelloWorldBean' in deployment unit 'deployment "HelloWorldSessionBean.jar"' are as follows:
java:global/HelloWorldSessionBean/HelloWorldBean!com.ibytecode.business.HelloWorld
java:app/HelloWorldSessionBean/HelloWorldBean!com.ibytecode.business.HelloWorld
java:module/HelloWorldBean!com.ibytecode.business.HelloWorld
java:jboss/exported/HelloWorldSessionBean/HelloWorldBean!com.ibytecode.business.HelloWorld
java:global/HelloWorldSessionBean/HelloWorldBean
java:app/HelloWorldSessionBean/HelloWorldBean
java:module/HelloWorldBean
...
Here's the client code:
package com.ibytecode.client;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import com.ibytecode.business.HelloWorld;
public class EJBApplicationClient {
public static void main(String[] args) {
InitialContext context = null;
HelloWorld bean = null;
try {
Properties properties = new Properties();
properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
//properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
context = new InitialContext(properties);
String lookupName = "ejb:/HelloWorldSessionBean/HelloWorldBean!com.ibytecode.business.HelloWorld";
bean = (HelloWorld) context.lookup(lookupName);
} catch (NamingException e) {
e.printStackTrace();
}
System.out.println(bean.sayHello());
}
}
And I put jboss-ejb-client.properties in the class path:
endpoint.name=client-endpoint
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=localhost
remote.connection.default.port = 4447
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.default.username=admin
remote.connection.default.password=admin
When I run the client as plain Java application, I get this output:
Mär 07, 2019 2:35:57 PM org.wildfly.naming.client.Version <clinit>
INFO: WildFly Naming version 1.0.7.Final-redhat-1
Mär 07, 2019 2:35:57 PM org.wildfly.security.Version <clinit>
INFO: ELY00001: WildFly Elytron version 1.1.7.Final-redhat-1
Mär 07, 2019 2:35:57 PM org.jboss.ejb.client.naming.ejb.ejbURLContextFactory <clinit>
INFO: EJBCLIENT000064: org.jboss.ejb.client.naming.ejb.ejbURLContextFactory is deprecated; new applications should use org.wildfly.naming.client.WildFlyInitialContextFactory instead
Mär 07, 2019 2:35:57 PM org.jboss.ejb.client.EJBClient <clinit>
INFO: JBoss EJB Client version 4.0.9.Final-redhat-1
Mär 07, 2019 2:35:57 PM org.jboss.naming.remote.client.InitialContextFactory <clinit>
INFO: WFNAM00025: org.jboss.naming.remote.client.InitialContextFactory is deprecated; new applications should use org.wildfly.naming.client.WildFlyInitialContextFactory instead
Mär 07, 2019 2:35:57 PM org.jboss.ejb.client.legacy.LegacyPropertiesConfiguration configure
INFO: EJBCLIENT000072: Using legacy jboss-ejb-client.properties EJB client configuration
Mär 07, 2019 2:35:57 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.5.4.Final-redhat-1
Mär 07, 2019 2:35:57 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.5.4.Final-redhat-1
Mär 07, 2019 2:35:57 PM org.jboss.ejb.client.legacy.RemotingLegacyConfiguration getConfiguredEndpoint
INFO: EJBCLIENT000070: Using legacy jboss-ejb-client.properties Remoting configuration
Mär 07, 2019 2:35:57 PM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 5.0.5.Final-redhat-1
Mär 07, 2019 2:35:57 PM org.jboss.ejb.client.legacy.ElytronLegacyConfiguration getConfiguredAuthenticationContext
INFO: EJBCLIENT000069: Using legacy jboss-ejb-client.properties security configuration
Exception in thread "main" javax.ejb.NoSuchEJBException: EJBCLIENT000079: Unable to discover destination for request for EJB StatelessEJBLocator for "/HelloWorldSessionBean/HelloWorldBean", view is interface com.ibytecode.business.HelloWorld, affinity is None
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:567)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
at org.jboss.ejb.protocol.remote.RemotingEJBClientInterceptor.handleInvocationResult(RemotingEJBClientInterceptor.java:56)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:569)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
at org.jboss.ejb.client.TransactionPostDiscoveryInterceptor.handleInvocationResult(TransactionPostDiscoveryInterceptor.java:133)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:569)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
at org.jboss.ejb.client.DiscoveryEJBClientInterceptor.handleInvocationResult(DiscoveryEJBClientInterceptor.java:108)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:569)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
at org.jboss.ejb.client.NamingEJBClientInterceptor.handleInvocationResult(NamingEJBClientInterceptor.java:78)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:569)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
at org.jboss.ejb.client.TransactionInterceptor.handleInvocationResult(TransactionInterceptor.java:172)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:569)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
at org.jboss.ejb.client.EJBClientInvocationContext.awaitResponse(EJBClientInvocationContext.java:913)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:177)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:112)
at com.sun.proxy.$Proxy0.sayHello(Unknown Source)
at com.ibytecode.client.EJBApplicationClient.main(EJBApplicationClient.java:53)
Suppressed: java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
at org.xnio.nio.WorkerThread$ConnectHandle.handleReady(WorkerThread.java:327)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
at ...asynchronous invocation...(Unknown Source)
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:570)
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:536)
at org.jboss.remoting3.ConnectionInfo$None.getConnection(ConnectionInfo.java:82)
at org.jboss.remoting3.ConnectionInfo.getConnection(ConnectionInfo.java:55)
at org.jboss.remoting3.EndpointImpl.doGetConnection(EndpointImpl.java:487)
at org.jboss.remoting3.EndpointImpl.getConnectedIdentity(EndpointImpl.java:433)
at org.jboss.remoting3.Endpoint.getConnectedIdentity(Endpoint.java:122)
at org.jboss.remoting3.Endpoint.getConnectedIdentity(Endpoint.java:135)
at org.jboss.remoting3.Endpoint.getConnection(Endpoint.java:212)
at org.jboss.ejb.client.legacy.RemotingLegacyConfiguration.getConfiguredEndpoint(RemotingLegacyConfiguration.java:81)
at org.jboss.remoting3.ConfigurationEndpointSupplier$Holder.lambda$static$0(ConfigurationEndpointSupplier.java:58)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.remoting3.ConfigurationEndpointSupplier$Holder.<clinit>(ConfigurationEndpointSupplier.java:45)
at org.jboss.remoting3.ConfigurationEndpointSupplier.get(ConfigurationEndpointSupplier.java:84)
at org.jboss.remoting3.ConfigurationEndpointSupplier.get(ConfigurationEndpointSupplier.java:40)
at org.wildfly.common.context.ContextManager.getPrivileged(ContextManager.java:282)
at org.jboss.remoting3.Endpoint.getCurrent(Endpoint.java:80)
at org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider.<init>(RemotingEJBDiscoveryProvider.java:92)
at org.jboss.ejb.protocol.remote.RemoteTransportProvider.notifyRegistered(RemoteTransportProvider.java:43)
at org.jboss.ejb.client.EJBClientContext.<init>(EJBClientContext.java:275)
at org.jboss.ejb.client.EJBClientContext$Builder.build(EJBClientContext.java:788)
at org.jboss.ejb.client.ConfigurationBasedEJBClientContextSelector.loadConfiguration(ConfigurationBasedEJBClientContextSelector.java:71)
at org.jboss.ejb.client.ConfigurationBasedEJBClientContextSelector.<clinit>(ConfigurationBasedEJBClientContextSelector.java:52)
at org.jboss.ejb.client.EJBClientContext.getDefault(EJBClientContext.java:109)
at org.wildfly.common.context.ContextManager.getPrivileged(ContextManager.java:282)
at org.jboss.ejb.client.EJBClientContext.getCurrent(EJBClientContext.java:798)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:161)
... 3 more
Suppressed: java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
at org.xnio.nio.WorkerThread$ConnectHandle.handleReady(WorkerThread.java:327)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
at ...asynchronous invocation...(Unknown Source)
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:570)
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:536)
at org.jboss.remoting3.ConnectionInfo$None.getConnection(ConnectionInfo.java:82)
at org.jboss.remoting3.ConnectionInfo.getConnection(ConnectionInfo.java:55)
at org.jboss.remoting3.EndpointImpl.doGetConnection(EndpointImpl.java:487)
at org.jboss.remoting3.EndpointImpl.getConnectedIdentity(EndpointImpl.java:433)
at org.jboss.remoting3.UncloseableEndpoint.getConnectedIdentity(UncloseableEndpoint.java:51)
at org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider.getConnectedIdentityUsingClusterEffective(RemotingEJBDiscoveryProvider.java:311)
at org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider$DiscoveryAttempt.lambda$connectAndDiscover$0(RemotingEJBDiscoveryProvider.java:384)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider$DiscoveryAttempt.connectAndDiscover(RemotingEJBDiscoveryProvider.java:384)
at org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider$DiscoveryAttempt.countDown(RemotingEJBDiscoveryProvider.java:468)
at org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider$DiscoveryAttempt$1.handleFailed(RemotingEJBDiscoveryProvider.java:350)
at org.jboss.ejb.protocol.remote.RemotingEJBDiscoveryProvider$DiscoveryAttempt$1.handleFailed(RemotingEJBDiscoveryProvider.java:342)
at org.xnio.IoFuture$HandlingNotifier.notify(IoFuture.java:215)
at org.xnio.AbstractIoFuture$NotifierRunnable.run(AbstractIoFuture.java:720)
at org.jboss.remoting3.EndpointImpl$TrackingExecutor.lambda$execute$0(EndpointImpl.java:926)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I put the jboss-client.jar from $JBOSS-HOME/bin/client in the classpath.
Any suggestions what I did wrong?
Thanks a lot!
Edit: Probably, it's worth noting that the NoSuchEJBException occurs because of bean.sayHello(). So, maybe it's not a problem with the lookup, but with the connection?
It seems that your lookupName (JNDI) of HelloWorldBean is wrong. Try this:
java:jboss/HelloWorldBean
ALso you can watch this article and find proper JNDI name of your bean on JBOSS admin page.
How to find JNDI name in JBoss-7?

HTTP error 404 while running my servlet page meant for downloading Long BLOB file from database using JSP and servlet

This is my JSP page which displays a table and redirects to the url of servlet. The error which I am receiving when I click on "save" button is
"HTTP Status 404- Not Found".
PS. I have also made another jsp and it's servlet to upload files using doPost instead and it works just fine but only this part of the project is something which has been bugging me for almost a week now!
<%# page import="java.sql.ResultSet" %>
<%# page import="java.sql.Statement" %>
<%# page import="java.sql.Connection" %>
<%# page import="java.sql.DriverManager" %>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Admin's page</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="<%=request.getContextPath() %>/bootstrap/css/bootstrap.min.css">
<script src="bootstrap/js/jquery.min.js"></script>
<script src="bootstrap/js/popper.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<!-- <div class="container-fluid">
<h1>Admin's page</h1>
<p>Table with downloadable files uploaded by each manager</p>
<div class="row">
<div class="col-sm-4" style="background-color:lavender;">User IDs</div>
<div class="col-sm-8" style="background-color:lavenderblush;">Uploaded File</div>
</div>
</div>
</body>
</html> -->
<div class="container-fluid">
<h2 style="text-align: center">Admin's page</h2>
<p style="text-align: center">Table with downloadable files uploaded by each manager</p>
<table class="table">
<thead class="thead-light">
<tr>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>File</th>
</tr>
</thead>
<tbody>
<%
try
{
Class.forName("com.mysql.cj.jdbc.Driver");
String url="jdbc:mysql://localhost:3306/login";
String username="root";
String password="your-password";
String query="select * from employeesloginaccount";
Connection conn=DriverManager.getConnection(url, username, password);
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery(query);
while(rs.next())
{
%>
<tr>
<td><%=rs.getInt("id") %></td>
<td><%=rs.getString("first_name") %></td>
<td><%=rs.getString("last_name") %></td>
<td>
<form method="get" action="<%=request.getContextPath()%>/downloadFileServlet/?id="<%=rs.getInt("id") %> >
<input style="text-align: center" type="submit" value="Save">
</form>
</td>
</tr>
<%
}
%>
</tbody>
</table>
<%
rs.close();
stmt.close();
conn.close();
}
catch(Exception e)
{
e.printStackTrace();
}
%>
</div>
</body>
</html>
my servlet page,
package servlets;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
#WebServlet("/downloadFileServlet")
#MultipartConfig(maxFileSize = 536870912)
public class DBFileDownloadServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
// size of byte buffer to send file
private static final int BUFFER_SIZE = 536870912;
// database connection settings
private String dbURL = "jdbc:mysql://localhost:3306/login";
private String dbUser = "root";
private String dbPass = "your-password";
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// get upload id from URL's parameters
int uploadId = Integer.parseInt(request.getParameter("id"));
Connection conn = null;
String message="";// connection to the database
try {
// connects to the database
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
conn = DriverManager.getConnection(dbURL, dbUser, dbPass);
// queries the database
String sql = "SELECT file FROM employeesloginaccount WHERE upload_id = ?";
PreparedStatement statement = conn.prepareStatement(sql);
statement.setInt(1, uploadId);
ResultSet result = statement.executeQuery();
if (result.next()) {
// gets file name and file blob data
String fileName = result.getString("file_name");
Blob blob = result.getBlob("file_data");
InputStream inputStream = blob.getBinaryStream();
int fileLength = inputStream.available();
System.out.println("fileLength = " + fileLength);
ServletContext context = getServletContext();
// sets MIME type for the file download
String mimeType = context.getMimeType(fileName);
if (mimeType == null) {
mimeType = "application/octet-stream";
}
// set content properties and header attributes for the response
response.setContentType(mimeType);
response.setContentLength(fileLength);
String headerKey = "Content-Disposition";
String headerValue = String.format("attachment; filename=\"%s\"", fileName);
response.setHeader(headerKey, headerValue);
// writes the file to the client
OutputStream outStream = response.getOutputStream();
byte[] buffer = new byte[BUFFER_SIZE];
int bytesRead = -1;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outStream.write(buffer, 0, bytesRead);
}
inputStream.close();
outStream.close();
message="File successfully downloaded";
} else {
// no file found
message="No file to be downloaded";
response.getWriter().print("File not found for the id: " + uploadId);
}
} catch (SQLException ex) {
ex.printStackTrace();
response.getWriter().print("SQL Error: " + ex.getMessage());
} catch (IOException ex) {
ex.printStackTrace();
response.getWriter().print("IO Error: " + ex.getMessage());
} finally {
if (conn != null) {
// closes the database connection
try {
conn.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
// sets the message in request scope
request.setAttribute("Message", message);
// forwards to the message page
getServletContext().getRequestDispatcher("/JSPs/Message.jsp").forward(request, response);
}
}
}
Console displays the following but I still have to find any error through it.
May 17, 2018 4:03:31 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:MajorProject' did not find a matching property.
May 17, 2018 4:03:31 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:registration' did not find a matching property.
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.5.30
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Apr 3 2018 20:04:09 UTC
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.5.30.0
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 8.1
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.3
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre1.8.0_162
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_162-b12
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: E:\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: E:\Stationery\apache-tomcat-8.5.30
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=E:\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=E:\Stationery\apache-tomcat-8.5.30
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=E:\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=E:\Stationery\apache-tomcat-8.5.30\endorsed
May 17, 2018 4:03:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
May 17, 2018 4:03:31 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jre1.8.0_162\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_162/bin/server;C:/Program Files/Java/jre1.8.0_162/bin;C:/Program Files/Java/jre1.8.0_162/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin;C:\Program Files\Java\jdk1.8.0_162\bin;E:\eclipse1;;.]
May 17, 2018 4:03:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
May 17, 2018 4:03:32 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 17, 2018 4:03:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
May 17, 2018 4:03:32 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 17, 2018 4:03:32 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 932 ms
May 17, 2018 4:03:32 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
May 17, 2018 4:03:32 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.30
May 17, 2018 4:03:32 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: 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.
May 17, 2018 4:03:33 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: 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.
May 17, 2018 4:03:33 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
May 17, 2018 4:03:33 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
May 17, 2018 4:03:33 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 981 ms
The stack trace for the new error HTTP Status 500 Internal Server Error is gieven below but first I have mentioned the part of Stack Trace given in chrome while running the code
java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
servlets.DBFileDownloadServlet.doGet(DBFileDownloadServlet.java:41)
javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
May 17, 2018 10:50:57 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:MajorProject' did not find a matching property.
May 17, 2018 10:50:57 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:registration' did not find a matching property.
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.5.30
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Apr 3 2018 20:04:09 UTC
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.5.30.0
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 8.1
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.3
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre1.8.0_162
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_162-b12
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: E:\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: E:\Stationery\apache-tomcat-8.5.30
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=E:\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=E:\Stationery\apache-tomcat-8.5.30
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=E:\eclipse\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=E:\Stationery\apache-tomcat-8.5.30\endorsed
May 17, 2018 10:50:57 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
May 17, 2018 10:50:57 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jre1.8.0_162\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_162/bin/server;C:/Program Files/Java/jre1.8.0_162/bin;C:/Program Files/Java/jre1.8.0_162/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin;C:\Program Files\Java\jdk1.8.0_162\bin;E:\eclipse1;;.]
May 17, 2018 10:50:57 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
May 17, 2018 10:50:58 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 17, 2018 10:50:58 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
May 17, 2018 10:50:58 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 17, 2018 10:50:58 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2107 ms
May 17, 2018 10:50:58 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
May 17, 2018 10:50:58 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.30
May 17, 2018 10:50:59 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: 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.
May 17, 2018 10:50:59 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: 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.
May 17, 2018 10:50:59 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
May 17, 2018 10:50:59 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
May 17, 2018 10:50:59 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1584 ms
1
May 17, 2018 10:53:08 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [servlets.DBFileDownloadServlet] in context with path [/MajorProject] threw exception
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at servlets.DBFileDownloadServlet.doGet(DBFileDownloadServlet.java:41)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
java.sql.SQLSyntaxErrorException: Unknown column 'upload_id' in 'where clause'
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:118)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:960)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1019)
at servlets.DBFileDownloadServlet.doGet(DBFileDownloadServlet.java:56)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
May 17, 2018 10:55:45 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [servlets.DBFileDownloadServlet] in context with path [/MajorProject] threw exception
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at servlets.DBFileDownloadServlet.doGet(DBFileDownloadServlet.java:41)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Form get URL in JSP is incorrect, remove "/" after servlet name and before query parameters.

Not able to load data in to MySQL DB using spring batch

I am using org.springframework.batch.item.database.JdbcBatchItemWriter to write the files into DB and using org.springframework.batch.item.file.mapping.PassThroughFieldSetMapper to map the columns. Data was not getting inserted in to DB and not getting any error in logs.
<bean id="ItemWriter" class="org.springframework.batch.item.database.JdbcBatchItemWriter">
<property name="dataSource" ref="dataSource" />
<property name="sql">
<value>
<![CDATA[
insert into Student_Details(Name,Id,ClassId,Rank) values (:Name, :Id, :ClassId, :Rank)
]]>
</value>
</property>
<property name="itemSqlParameterSourceProvider">
<bean class="org.springframework.batch.item.database.BeanPropertyItemSqlParameterSourceProvider" />
</property>
2016-04-28 05:45:59,904 INFO [com.sam.test.mine.scheduler.SchedulerService] [fileFirmsChannelPool-2] INFO - <Ok file received: Student_details_20160116.OK>
Apr 28, 2016 5:45:59 AM org.springframework.batch.core.launch.support.SimpleJobLauncher run
INFO: Job: [FlowJob: [name=StudentDetailsJob]] launched with the following parameters: [{groupId=0, size=0,filename=file:/app/data/Student_details_20160116.txt, filenames=file:/app/data/Student_details_20160116.txt, now=1461836759909,type=STUDENT_DET}]
Apr 28, 2016 5:46:00 AM org.springframework.batch.core.job.SimpleStepHandler handleStep
INFO: Executing step: [cleanStudentDetails]
2016-04-28 05:46:00,362 INFO [com.sam.test.mine.batch.JdbcUpdateTasklet] [fileFirmsChannelPool-2] INFO - <Deleted table Student_Details successfully.>
Apr 28, 2016 5:46:00 AM org.springframework.batch.core.job.SimpleStepHandler handleStep
INFO: Executing step: [studentDetailsStep]
Apr 28, 2016 5:46:00 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
Apr 28, 2016 5:46:00 AM org.springframework.jdbc.support.SQLErrorCodesFactory <init>
INFO: SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase, Hana]
Apr 28, 2016 5:46:00 AM org.springframework.batch.core.job.SimpleStepHandler handleStep
INFO: Executing step: [archiveStudentDetails]
2016-04-28 05:46:00,894 INFO [com.sam.test.mine.batch.FileArchiverTasklet] [fileFirmsChannelPool-2] INFO - <Archiving ... >
2016-04-28 05:46:00,902 INFO [com.sam.test.mine.batch.FileArchiverTasklet] [fileFirmsChannelPool-2] INFO - <success moving file to archive: /app/data/Student_details_20160116.txt to /app/archive/20160428/Student_details_20160116.txt.execution#33912>
Apr 28, 2016 5:46:00 AM org.springframework.batch.core.launch.support.SimpleJobLauncher run
INFO: Job: [FlowJob: [name=StudentDetailsJob]] completed with the following parameters: [{groupId=0, size=0, filename=file:/app/data/Student_details_20160116.txt, filenames=file:/app/data/Student_details_20160116.txt, now=1461836759909, type=STUDENT_DET}] and the following status: [COMPLETED]
2016-04-28 05:46:00,975 INFO [com.sam.test.mine.scheduler.SchedulerService] [fileFirmsChannelPool-2] INFO - <finish deleting Ok file /app/data/Student_details_20160116.OK>>
I am seeing READ_COUNT values in BATCH_STEP_EXECUTION table but WRITE_COUNT as 0 and WRITE_SKIP_COUNT too same as read count.
-Amuthan
When your READ_COUNT matches your WRITE_SKIP_COUNT, it implies an exception is being thrown in your JdbcBatchItemWriter which has been registered as a Skippable exception in the skippable-exception-classes property.
<step id="step1">
<tasklet>
<chunk reader="soemReader" writer="jdbcWriter"
commit-interval="10" skip-limit="10">
<skippable-exception-classes>
<include class="com.package.YourException"/>
</skippable-exception-classes>
</chunk>
</tasklet>
</step>
I'd remove any Skippable exceptions unless you have a real business to swallow errors like this.

Salesforce.com login page not accessible from java code from with in a proxy

I am new to salesforce.com platform. I am trying to execute the demo application given at http://wiki.developerforce.com/page/Getting_Started_with_the_Force.com_REST_API. The sample application is able to successfully connect to salesforce.com and obtain authentication token(indicated in bold in server log). However it is not able to reach the login page https://login.salesforce.com.
I am working from within a proxy server and have configured the same in my code. Still tomcat7 log is displaying following error:
Jun 11, 2013 5:56:23 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\app\product\11.2.0\dbhome_1\bin;E:\app\GreyMatter\product\11.2.0\dbhome_1\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin;C:\Sun\jwsdp-2.0\jwsdp-shared\bin;C:\Users\GreyMatter\AppData\Roaming\Python\Scripts;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\app\product\11.2.0\dbhome_1\bin;E:\app\GreyMatter\product\11.2.0\dbhome_1\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin;C:\Program Files (x86)\Java\jdk1.7.0_02\bin;E:\maven\apache-maven-3.0.4-bin_2\apache-maven-3.0.4\bin;;E:\springsource-tool-suite\springsource\sts-2.9.2.RELEASE;;.
Jun 11, 2013 5:56:24 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:RestTest1' did not find a matching property.
Jun 11, 2013 5:56:24 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:RestTest' did not find a matching property.
Jun 11, 2013 5:56:24 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 11, 2013 5:56:24 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8443"]
Jun 11, 2013 5:56:24 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 11, 2013 5:56:24 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 801 ms
Jun 11, 2013 5:56:24 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 11, 2013 5:56:24 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.8
Jun 11, 2013 5:56:25 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jun 11, 2013 5:56:25 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8443"]
Jun 11, 2013 5:56:25 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jun 11, 2013 5:56:25 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 677 ms
**Auth successful - got callback**
Jun 11, 2013 5:57:13 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [oauth] in context with path [/RestTest] threw exception
java.net.UnknownHostException: login.salesforce.com
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
at sun.security.ssl.SSLSocketImpl.<init>(Unknown Source)
at sun.security.ssl.SSLSocketFactoryImpl.createSocket(Unknown Source)
at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(Unknown Source)
at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(Unknown Source)
at org.apache.commons.httpclient.HttpConnection.open(Unknown Source)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Unknown Source)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(Unknown Source)
at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown Source)
at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown Source)
at OAuthServlet.doGet(OAuthServlet.java:102)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:383)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
The place where I have configured proxy settings is given below:
#WebServlet(name = "oauth", urlPatterns = { "/oauth/*", "/oauth" }, initParams = {
// clientId is 'Consumer Key' in the Remote Access UI
#WebInitParam(name = "clientId", value = "xxxx"),
// clientSecret is 'Consumer Secret' in the Remote Access UI
#WebInitParam(name = "clientSecret", value = "xxxxx"),
// This must be identical to 'Callback URL' in the Remote Access UI
#WebInitParam(name = "redirectUri", value = "https://localhost:8443/RestTest/oauth/_callback"),
#WebInitParam(name = "environment", value = "https://login.salesforce.com") })
public class OAuthServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final String ACCESS_TOKEN = "ACCESS_TOKEN";
private static final String INSTANCE_URL = "INSTANCE_URL";
private String clientId = null;
private String clientSecret = null;
private String redirectUri = null;
private String environment = null;
private String authUrl = null;
private String tokenUrl = null;
public void init() throws ServletException {
//****************************************************************
System.getProperties().put("http.proxyHost", "IP address of proxy server");
System.getProperties().put("http.proxyPort", "xxx");
System.getProperties().put("http.proxyUser", "Proxy login ID");
System.getProperties().put("http.proxyPassword", "Proxy login password");
System.getProperties().put("https.proxyHost", "IP address of proxy server");
System.getProperties().put("https.proxyPort", "xxx");
System.getProperties().put("https.proxyUser", "Proxy login ID");
System.getProperties().put("https.proxyPassword", "Proxy login password");
//**************************************************************
clientId = this.getInitParameter("clientId");
clientSecret = this.getInitParameter("clientSecret");
redirectUri = this.getInitParameter("redirectUri");
environment = this.getInitParameter("environment");
..... (rest of code)...
It seems that my java code is not able to connect to https://login.salesforce.com.
Is there any issue with proxy setting.
Kindly help me with this issue.