-2

(Please note: if not appropriate to post here, grateful if the administrator help to remove it. Thanks)

Background: there is an application that deployed on tomcat 8 in windows server 2008 r2. Currently the server is running and the application runs properly. The team leader told us the application is written by a programmer who already resigned the company two years ago. The program does not have any code changes after the programmer's resignation.

For some reasons, we have to change (upgrade) windows server 2008 r2 to windows server 2012 r2.

The application requires java 1.7 and tomcat 8 to run, so we installed those software in windows server 2012 r2.

We copy the war file from windows server 2008 r2 and paste in windows server 2012 r2. After copy and paste the war file, we deploy the war file in tomcat web application manager (the same action in windows server 2008 r2).

Once we deploy the war file, we try to start the application. However, when we click the "Start" button, we wait for a while and the tomcat message displays "FAIL - Application at context path/path-name could not be started".

We checked the software version, and they are same as in windows server 2008 r2.

We get confused about the message because the war file works in the windows server 2008 r2.

We check the localhost.2017-07-13.log file and we notice there are some exception. We would like post the content of the log here.

13-Jul-2017 15:00:42.464 INFO [http-nio-8080-exec-8] 
org.apache.catalina.core.ApplicationContext.log Initializing Spring root 
WebApplicationContext
13-Jul-2017 15:00:43.214 SEVERE [http-nio-8080-exec-8] 
org.apache.catalina.core.StandardContext.listenerStart Exception sending 
context initialized event to listener instance of class 
org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'dataSource' defined in ServletContext resource [/WEB-
INF/applicationContext.xml]: Error setting property values; nested exception 
is org.springframework.beans.PropertyBatchUpdateException; nested 
PropertyAccessExceptions (1) are:
PropertyAccessException 1: 
org.springframework.beans.MethodInvocationException: Property 
'driverClassName' threw exception; nested exception is 
java.lang.IllegalStateException: Could not load JDBC driver class 
[net.sourceforge.jtds.jdbc.Driver]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.app
lyPropertyValues(AbstractAutowireCapableBeanFactory.java:1279)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.pop
ulateBean(AbstractAutowireCapableBeanFactory.java:1010)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doC
reateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.r
un(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.cre
ateBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Abstra
ctBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingle
ton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abstract
BeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBe
anFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBe
anFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstanti
ateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactory
Initialization(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractA
pplicationContext.java:380)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(Contex
tLoader.java:244)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextL
oader.java:187)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(Context
LoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4729
)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167
)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:945)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:466)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1460)
at org.apache.catalina.manager.HTMLManagerServlet.upload(HTMLManagerServlet.java:289)
at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:210)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:213)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:614)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478)
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)
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested 
PropertyAccessExceptions (1) are:
PropertyAccessException 1: 
org.springframework.beans.MethodInvocationException: Property 
'driverClassName' threw exception; nested exception is 
java.lang.IllegalStateException: Could not load JDBC driver class 
[net.sourceforge.jtds.jdbc.Driver]
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPro
pertyAccessor.java:104)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPro
pertyAccessor.java:59)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.app
lyPropertyValues(AbstractAutowireCapableBeanFactory.java:1276)
... 64 more

We don't understand is why the program works in windows server 2008 r2 but it does not work in windows server 2012 r2?

Currently we are still finding the source code of the program but from the log file, it mentioned about [/WEB-INF/applicationContext.xml] and [net.sourceforge.jtds.jdbc.Driver], we guess when we get the source code, we need to find the xml file and the driver, is it correct?

Grateful for your advice please. Thank you.

Edit

We just find the source code and we open the applicationContext.xml and there is a bean for net.sourceforge.jtds.jdbc.Driver. Not sure why it does not work in windows server 2012 r2.

Here is code:

    <?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:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                        http://www.springframework.org/schema/tx
                        http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
                        http://www.springframework.org/schema/aop
                        http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
                        http://www.springframework.org/schema/jee
                        http://www.springframework.org/schema/jee/spring-jee-2.5.xsd">

<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />


    <property name="url" value="jdbc:jtds:sqlserver://{host}:1433;DatabaseName=myDB" /> 

    <property name="username" value="user" />
    <property name="password" value="Password" />
</bean>

</beans>
beginner
  • 192
  • 1
  • 1
  • 13
  • why did you tag the question reguardin win server 2008 /2012 with *SQL* Server tags? – sepupic Jul 13 '17 at 09:09
  • @sepupic, thanks your comment. We updated tags for the post. – beginner Jul 13 '17 at 09:15
  • still sql server and not windows server – sepupic Jul 13 '17 at 09:16
  • @sepupic, sorry for the careless mistake, tags are updated – beginner Jul 13 '17 at 09:20
  • We just find the source code, we open the applicationContext.xml (mentioned in the log file), there is a bean for net.sourceforge.jtds.jdbc.Driver. No sure why it does not work in widows server 2012 r2. – beginner Jul 13 '17 at 09:30
  • Possible duplicate of [What is a stack trace, and how can I use it to debug my application errors?](https://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors) – Raedwald Jul 14 '17 at 07:11

1 Answers1

1

You say (emphasis mine)

The application requires java 1.7 and tomcat 8 to run, so we installed those software in windows server 2012 r2.

We copy the war file from windows server 2008 r2 and paste in windows server 2012 r2. After copy and paste the war file, we deploy the war file in tomcat web application manager (the same action in windows server 2008 r2).

The error message says

java.lang.IllegalStateException: Could not load JDBC driver class [net.sourceforge.jtds.jdbc.Driver]

Means: You did not sufficiently reproduce the original implementation. As you might miss more than just this driver (it could just be the first to fail) I'm suggesting a full diff over both directories. Figure out what's deployed in both installations.

Hint: Tomcat has a global classpath in its lib directory, this contains code that every webapp can use.

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • Hello @Olaf Kock, thank you for your answer. My colleague and I extract the war file from windows server 2008 r2 and then we use WinMerge software to find differences. Those files are same. no missing or no extra files. About the Tomcat's global classpath, we compare it but the lib is the same. We still not sure why the war file is not working, but when we put the jtsd jar in the lib and create the war again and deploy on Tomcat. The application is working now. – beginner Jul 21 '17 at 09:11