error 1935500:javax.servlet.servletexception:beanuti

javax.servlet.ServletException: Servlet execution threw an exception
(Tomcat forum at JavaRanch)
This week's book giveaway is in the
forum.We're giving away four copies of Getting MEAN with Mongo, Express, Angular, and Node and have Simon Holmes on-line!See
for details.
A friendly place for programming greenhorns!
Big Moose Saloon
Win a copy of
this week in the
javax.servlet.ServletException: Servlet execution threw an exception
I am running
with mod_jk connector for apache - Centos 6x on dedicated server. I am facing the following problem. When I restart the server its working fine but after sometime its throwing again the following exception. Please advise.
HTTP Status 500 - Servlet execution threw an exception
type Exception report
message Servlet execution threw an exception
description The server encountered an internal error that prevented it from fulfilling this request.
javax.servlet.ServletException: Servlet execution threw an exception
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
root cause
java.lang.NoSuchMethodError: oracle.i18n.text.converter.CharacterConverterOGS.getInstance(I)Loracle/i18n/text/converter/CharacterC
oracle.sql.converter.CharacterConverterFactoryOGS.make(CharacterConverterFactoryOGS.java:40)
oracle.sql.CharacterSetWithConverter.getInstance(CharacterSetWithConverter.java:135)
oracle.sql.CharacterSetFactoryThin.make(CharacterSetFactoryThin.java:195)
oracle.sql.CharacterSet.make(CharacterSet.java:554)
oracle.jdbc.driver.DBConversion.init(DBConversion.java:234)
oracle.jdbc.driver.DBConversion.&init&(DBConversion.java:131)
oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1618)
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:353)
oracle.jdbc.driver.PhysicalConnection.&init&(PhysicalConnection.java:547)
oracle.jdbc.driver.T4CConnection.&init&(T4CConnection.java:225)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:29)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:556)
java.sql.DriverManager.getConnection(DriverManager.java:571)
java.sql.DriverManager.getConnection(DriverManager.java:215)
DB.getOracleConnection(DB.java:14)
Status.domains(Status.java:628)
DomainsIndex.doGet(DomainsIndex.java:28)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs.
Apache Tomcat/7.0.47
Best regards
It looks like you are obtaining your database connection by brute force from within your web application. Recommended practice is to define a Connection Pool in Tomcat and have your webapp use that pool to get connections.
The fault that you are actually seeing is entirely within Oracle code. Either the driver you are trying to use is defective or you have a problem in your driver environment.
A very likely cause of such a problem would be if you had a copy of a Oracle
driver in both your WAR (WEB-INF/lib) and TOMCAT_HOME/lib directories. Such a setup would be prone to classpath conflicts causing incompatible parts of both drivers to be used at the same time.
Customer surveys are for companies who didn't pay proper attention to begin with.
Tim Holloway wrote:It looks like you are obtaining your database connection by brute force from within your web application. Recommended practice is to define a Connection Pool in Tomcat and have your webapp use that pool to get connections.
Thanks Tim for your favorable reply. I set the classpath of Orai18n.jar and it seems fine now but waiting to check either its throwing this error again or not.
Can you please refer me to any doc as to how can configure connection pooling in Tomcat?
Best regards
Thanks from the bottom of my heart
This exception happened again. I checked catalina.out and it says:
SEVERE: The web application [/medical] appears to have started a thread named [Timer-9] but has failed to stop it. This is very likely to create a memory leak.
Feb 14, :00 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
Feb 14, :00 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
Feb 14, :05 AM org.apache.tomcat.util.net.AbstractEndpoint shutdownExecutor
WARNING: The executor associated with thread pool [ajp-bio-8009] has not fully shutdown. Some application threads may still be running.
Feb 14, :05 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Feb 14, :05 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
Best regards
I'm not sure if you mean that you are still getting the original
exception or you're just concerned about the warning on shutdown.
If you're running a timer service such as Quartz, it's a good idea to put a
in the webapp that will detect when the app is being terminated and shutdown the timer service explicitly. That should get rid of the leaking timer thread(s).
Thanks for your favorable replies
I am not running any timer services and this error appears on my dedicated server. I don't know which servlet is throwing this error. Catalina.out is showing only directory [/medical] but not pointing to the servlet.
Is there anyway to know which servlet class is involved?
Best regards
Farakh khan wrote:Thanks for your favorable replies
I am not running any timer services and this error appears on my dedicated server. I don't know which servlet is throwing this error. Catalina.out is showing only directory [/medical] but not pointing to the servlet.
Is there anyway to know which servlet class is involved?
Best regards
Not directly. Once spawned, a thread doesn't care what class contained the spawning code, only what class anchors the thread itself.
Your best bet is to locate that class and figure out how it was instantiated. What I normally do is run Tomcat under a debugger, pause the thread of interest, and look at its stacktrace in the debugger.
With a name like "Timer-9", it's possible that the thread itself might have been spawned by a timer sleep function, but use of timer sleep in a servlet is a violation of
There are some classes that are using Thread.sleep(1000); Thread.sleep(250); May I check these classes?
Thanks again
You should. I was just looking at the servlet spec and I can't find the specific forbiddings against meddling with threads and thread resources. Although from a practical point of view, I can tell you that in Tomcat, any resources that a request doesn't let go of before exiting the servlet service() method are likely to wreak havoc with whatever process inherits the thread next.
Timer waits are not a good idea because the idea is that the request/response cycle should process as quickly as possible. Even discounting impatient users, the longer a thread is processing one request, the less time that thread has to process someone else's request, since there's a limit to the number of threads in the processing pool.
What I did now is: added System.exit(0); in finally block and waiting to see if the problem occurs again or not?
Best regards
You should never use System.exit in code running in a servlet container. What are you trying to achieve by that?
I am trying to exit after running the thread because if many threads ran then our server display the error in my first post and I have to restart the server manually as by restarting tomcat its not work
You need to address the actual problem, which has something to do with the DB driver, as Tim said in his first post. Shutting down the server isn't a solution, and should be entirely unnecessary.
I copy pasted all drivers from $ORACLE_HOME/jdbc/lib to tomcat/lib as well as $ORACLE_HOME/jlib/i18n.jar
to tomcat/lib but again faced the problem of my first post. When I seen catalina.out its displays following:
SEVERE: The web application [/medical] appears to have started a thread named [Timer-9] but has failed to stop it. This is very likely to create a memory leak.
Feb 14, :00 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
Feb 14, :00 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
Feb 14, :05 AM org.apache.tomcat.util.net.AbstractEndpoint shutdownExecutor
WARNING: The executor associated with thread pool [ajp-bio-8009] has not fully shutdown. Some application threads may still be running.
Feb 14, :05 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Feb 14, :05 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
What else I can check to know more about it?
Thanks again
Leaking a resource isn't great, but it may not even be related to the original problem, and should in any case not be a big issue in a production setting (where restarting web apps should be rare, and where I would advise never to do it, but instead to restart the server).
If this was my problem I would specifically searc you don't seem to be the first one to whom it happens.
My mind is not working to point out exact problem. The exception displayed in tomcat says i18n problem but catalina.out says thread problem. I tried to search both and nothing found that I not applied to the server. Please help me to point out exact problem that can explored and fixed.
Thanks again
If you could work out the exact problem you wouldn't need to post here
I'm talking about the exception messag searching for that is a good start. You said you searched for that already - what did you find?
The catalina log doesn't mention anything useful - as I said, the message about a leaked resource may have different reasons, and is anyway not the cause of the problem.
In first view this thread appealed me to the near root cause of my problem
I applied whatever said in this thread. I mean I downloaded and copy pasted orai18n.jar to tomcat lib and set its classpath as well.
I am here to hear from you or waiting to have any useful link from your end please
Thanks again
I doubt that a
would be caused by a missing jar file. Much more likely is a mismatch of jar files that go with different versions of the JDBC driver (along the lines of posts #10 and #11 in that discussion).
I copy pasted from my Oracle 11g 2.0.2 directory /u01/app/oracle/product/11.2.0/xe/jdbc/lib/* to tomcat/lib that in my view the accurate versions.
Thanks again
Have you made sure that there are no leftover jar files from other versions: not in WEB-INF/lib, not in any of the JRE directories, and not in any of the Tomcat directories?
Sorry for late reply
=============================================================================================================
Please NOTE: The server is production server and working fine but sometime its throwing exception that I mentioned in my first post. Only solution is to restart the server
=============================================================================================================
Today I again faced this error. What I tried so far is:
1) Downloaded new jar files as per my Oracle version 11.2.0.2.0 from this link: .
2) I downloaded: jdbc6.jar, jdbc6_g.jar, ojdbc6dms.jar, ojdbc6dms_g.jar, ori18n.jar
3) Set the classpath as /u01/app/oracle/product/11.2.0/xe/jlib/orai18n.jar.jar
4) Checked all folders and make sure there is no duplicate jar file
5) I am seeing description with orai18n.jar: NLS classes for use with JDK 1.5, and 1.6. It contains classes for NLS support in Oracle Object and Collection types. This jar file replaces the old nls_charset jar/zip files.
It means its suitable for jdk1.5 or 1.6 whereas I checked my jdk version and found:
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
Is that the problem?
Please advise
Thanks in anticipation.
Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
subject: javax.servlet.ServletException: Servlet execution threw an exception
Similar Threads
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter在构建SPRING3.2 MVC 中出现的问题
&!-- 扩展名至mimeType的映射,即 /blog.json =& application/json --&
&property name="mediaTypes"&
&entry key="html" value="text/html" /&
&entry key="pdf" value="application/pdf" /&
&entry key="xsl" value="application/vnd.ms-excel" /&
&entry key="xml" value="application/xml" /&
&entry key="json" value="application/json" /&
&/property&
我一加上上面的这个东西我的项目在访问的时候报错 错误信息是
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0' defined in class path resource [conf/springMVC.xml]: Invocation o nested exception is java.lang.ClassCastException: java.lang.String cannot be cast to org.springframework.http.MediaType
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1466)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:420)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1188)
at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:277)
at org.springframework.web.servlet.DispatcherServlet.initViewResolvers(DispatcherServlet.java:666)
at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:447)
at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:432)
at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:768)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1060)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1057)
at org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:51)
at org.springframework.context.event.SourceFilteringListener.onApplicationEventInternal(SourceFilteringListener.java:96)
at org.springframework.context.event.SourceFilteringListener.onApplicationEvent(SourceFilteringListener.java:68)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:857)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to org.springframework.http.MediaType
at org.springframework.web.accept.MappingMediaTypeFileExtensionResolver.&init&(MappingMediaTypeFileExtensionResolver.java:54)
at org.springframework.web.accept.AbstractMappingContentNegotiationStrategy.&init&(AbstractMappingContentNegotiationStrategy.java:42)
at org.springframework.web.accept.PathExtensionContentNegotiationStrategy.&init&(PathExtensionContentNegotiationStrategy.java:74)
at org.springframework.web.accept.ServletPathExtensionContentNegotiationStrategy.&init&(ServletPathExtensionContentNegotiationStrategy.java:47)
at org.springframework.web.accept.ContentNegotiationManagerFactoryBean.afterPropertiesSet(ContentNegotiationManagerFactoryBean.java:166)
at org.springframework.web.servlet.view.ContentNegotiatingViewResolver.afterPropertiesSet(ContentNegotiatingViewResolver.java:270)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1525)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1463)
... 46 more
13:56:34 org.apache.catalina.core.ApplicationContext log
严重: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0' defined in class path resource [conf/springMVC.xml]: Invocation o nested exception is java.lang.ClassCastException: java.lang.String cannot be cast to org.springframework.http.MediaType
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1466)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:420)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1188)
at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:277)
at org.springframework.web.servlet.DispatcherServlet.initViewResolvers(DispatcherServlet.java:666)
at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:447)
at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:432)
at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:768)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1060)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1057)
at org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:51)
at org.springframework.context.event.SourceFilteringListener.onApplicationEventInternal(SourceFilteringListener.java:96)
at org.springframework.context.event.SourceFilteringListener.onApplicationEvent(SourceFilteringListener.java:68)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:857)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to org.springframework.http.MediaType
at org.springframework.web.accept.MappingMediaTypeFileExtensionResolver.&init&(MappingMediaTypeFileExtensionResolver.java:54)
at org.springframework.web.accept.AbstractMappingContentNegotiationStrategy.&init&(AbstractMappingContentNegotiationStrategy.java:42)
at org.springframework.web.accept.PathExtensionContentNegotiationStrategy.&init&(PathExtensionContentNegotiationStrategy.java:74)
at org.springframework.web.accept.ServletPathExtensionContentNegotiationStrategy.&init&(ServletPathExtensionContentNegotiationStrategy.java:47)
at org.springframework.web.accept.ContentNegotiationManagerFactoryBean.afterPropertiesSet(ContentNegotiationManagerFactoryBean.java:166)
at org.springframework.web.servlet.view.ContentNegotiatingViewResolver.afterPropertiesSet(ContentNegotiatingViewResolver.java:270)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1525)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1463)
... 46 more
13:56:34 org.apache.catalina.core.StandardWrapperValve invoke
严重: Allocate exception for servlet springMVC
java.lang.ClassCastException: java.lang.String cannot be cast to org.springframework.http.MediaType
at org.springframework.web.accept.MappingMediaTypeFileExtensionResolver.&init&(MappingMediaTypeFileExtensionResolver.java:54)
at org.springframework.web.accept.AbstractMappingContentNegotiationStrategy.&init&(AbstractMappingContentNegotiationStrategy.java:42)
at org.springframework.web.accept.PathExtensionContentNegotiationStrategy.&init&(PathExtensionContentNegotiationStrategy.java:74)
at org.springframework.web.accept.ServletPathExtensionContentNegotiationStrategy.&init&(ServletPathExtensionContentNegotiationStrategy.java:47)
at org.springframework.web.accept.ContentNegotiationManagerFactoryBean.afterPropertiesSet(ContentNegotiationManagerFactoryBean.java:166)
at org.springframework.web.servlet.view.ContentNegotiatingViewResolver.afterPropertiesSet(ContentNegotiatingViewResolver.java:270)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1525)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1463)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:420)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1188)
at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:277)
at org.springframework.web.servlet.DispatcherServlet.initViewResolvers(DispatcherServlet.java:666)
at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:447)
at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:432)
at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:768)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1060)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1057)
at org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:51)
at org.springframework.context.event.SourceFilteringListener.onApplicationEventInternal(SourceFilteringListener.java:96)
at org.springframework.context.event.SourceFilteringListener.onApplicationEvent(SourceFilteringListener.java:68)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:857)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
13:56:44 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring FrameworkServlet 'springMVC'
13:56:44 org.springframework.web.servlet.FrameworkServlet initServletBean
信息: FrameworkServlet 'springMVC': initialization started
13:56:44 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing WebApplicationContext for namespace 'springMVC-servlet': startup date [Wed Nov 14 13:56:44 CST 2012]; parent: Root WebApplicationContext
13:56:44 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [conf/springMVC.xml]
13:56:44 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@d2ee5d: defining beans [testController,testDaoImpl,testServiceImpl,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,mvcContentNegotiationManager,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0,org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0,org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0,org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0,org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0,org.springframework.web.servlet.handler.MappedInterceptor#1,org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#1,org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#1,org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0,webExceptionResolver,multipartResolver,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@1eaefc5
13:56:44 org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
信息: Mapped "{[/test],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.able.controller.TestController.test(org.springframework.ui.Model)
13:56:44 org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
信息: Mapped "{[/testjson],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.Map com.able.controller.TestController.tesjson()
13:56:44 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
信息: Mapped URL path [/**] onto handler 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0'
13:56:44 org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
信息: Mapped URL path [/**] onto handler 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#1'
13:56:44 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
信息: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@d2ee5d: defining beans [testController,testDaoImpl,testServiceImpl,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,mvcContentNegotiationManager,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0,org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0,org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0,org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0,org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0,org.springframework.web.servlet.handler.MappedInterceptor#1,org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#1,org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#1,org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0,webExceptionResolver,multipartResolver,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@1eaefc5
13:56:44 org.springframework.web.servlet.FrameworkServlet initServletBean
严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0' defined in class path resource [conf/springMVC.xml]: Invocation o nested exception is java.lang.ClassCastException: java.lang.String cannot be cast to org.springframework.http.MediaType
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1466)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:420)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1188)
at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:277)
at org.springframework.web.servlet.DispatcherServlet.initViewResolvers(DispatcherServlet.java:666)
at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:447)
at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:432)
at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:768)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1060)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1057)
at org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:51)
at org.springframework.context.event.SourceFilteringListener.onApplicationEventInternal(SourceFilteringListener.java:96)
at org.springframework.context.event.SourceFilteringListener.onApplicationEvent(SourceFilteringListener.java:68)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:857)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to org.springframework.http.MediaType
at org.springframework.web.accept.MappingMediaTypeFileExtensionResolver.&init&(MappingMediaTypeFileExtensionResolver.java:54)
at org.springframework.web.accept.AbstractMappingContentNegotiationStrategy.&init&(AbstractMappingContentNegotiationStrategy.java:42)
at org.springframework.web.accept.PathExtensionContentNegotiationStrategy.&init&(PathExtensionContentNegotiationStrategy.java:74)
at org.springframework.web.accept.ServletPathExtensionContentNegotiationStrategy.&init&(ServletPathExtensionContentNegotiationStrategy.java:47)
at org.springframework.web.accept.ContentNegotiationManagerFactoryBean.afterPropertiesSet(ContentNegotiationManagerFactoryBean.java:166)
at org.springframework.web.servlet.view.ContentNegotiatingViewResolver.afterPropertiesSet(ContentNegotiatingViewResolver.java:270)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1525)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1463)
... 46 more
13:56:44 org.apache.catalina.core.ApplicationContext log
严重: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0' defined in class path resource [conf/springMVC.xml]: Invocation o nested exception is java.lang.ClassCastException: java.lang.String cannot be cast to org.springframework.http.MediaType
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1466)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:420)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1188)
at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:277)
at org.springframework.web.servlet.DispatcherServlet.initViewResolvers(DispatcherServlet.java:666)
at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:447)
at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:432)
at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:768)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1060)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1057)
at org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:51)
at org.springframework.context.event.SourceFilteringListener.onApplicationEventInternal(SourceFilteringListener.java:96)
at org.springframework.context.event.SourceFilteringListener.onApplicationEvent(SourceFilteringListener.java:68)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:857)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to org.springframework.http.MediaType
at org.springframework.web.accept.MappingMediaTypeFileExtensionResolver.&init&(MappingMediaTypeFileExtensionResolver.java:54)
at org.springframework.web.accept.AbstractMappingContentNegotiationStrategy.&init&(AbstractMappingContentNegotiationStrategy.java:42)
at org.springframework.web.accept.PathExtensionContentNegotiationStrategy.&init&(PathExtensionContentNegotiationStrategy.java:74)
at org.springframework.web.accept.ServletPathExtensionContentNegotiationStrategy.&init&(ServletPathExtensionContentNegotiationStrategy.java:47)
at org.springframework.web.accept.ContentNegotiationManagerFactoryBean.afterPropertiesSet(ContentNegotiationManagerFactoryBean.java:166)
at org.springframework.web.servlet.view.ContentNegotiatingViewResolver.afterPropertiesSet(ContentNegotiatingViewResolver.java:270)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1525)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1463)
... 46 more
13:56:44 org.apache.catalina.core.StandardWrapperValve invoke
严重: Allocate exception for servlet springMVC
java.lang.ClassCastException: java.lang.String cannot be cast to org.springframework.http.MediaType
at org.springframework.web.accept.MappingMediaTypeFileExtensionResolver.&init&(MappingMediaTypeFileExtensionResolver.java:54)
at org.springframework.web.accept.AbstractMappingContentNegotiationStrategy.&init&(AbstractMappingContentNegotiationStrategy.java:42)
at org.springframework.web.accept.PathExtensionContentNegotiationStrategy.&init&(PathExtensionContentNegotiationStrategy.java:74)
at org.springframework.web.accept.ServletPathExtensionContentNegotiationStrategy.&init&(ServletPathExtensionContentNegotiationStrategy.java:47)
at org.springframework.web.accept.ContentNegotiationManagerFactoryBean.afterPropertiesSet(ContentNegotiationManagerFactoryBean.java:166)
at org.springframework.web.servlet.view.ContentNegotiatingViewResolver.afterPropertiesSet(ContentNegotiatingViewResolver.java:270)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1525)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1463)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:420)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1188)
at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:277)
at org.springframework.web.servlet.DispatcherServlet.initViewResolvers(DispatcherServlet.java:666)
at org.springframework.web.servlet.DispatcherServlet.initStrategies(DispatcherServlet.java:447)
at org.springframework.web.servlet.DispatcherServlet.onRefresh(DispatcherServlet.java:432)
at org.springframework.web.servlet.FrameworkServlet.onApplicationEvent(FrameworkServlet.java:768)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1060)
at org.springframework.web.servlet.FrameworkServlet$ContextRefreshListener.onApplicationEvent(FrameworkServlet.java:1057)
at org.springframework.context.event.GenericApplicationListenerAdapter.onApplicationEvent(GenericApplicationListenerAdapter.java:51)
at org.springframework.context.event.SourceFilteringListener.onApplicationEventInternal(SourceFilteringListener.java:96)
at org.springframework.context.event.SourceFilteringListener.onApplicationEvent(SourceFilteringListener.java:68)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:857)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
采纳的答案
java.lang.ClassCastException: java.lang.String cannot be cast to org.springframework.http.MediaType&
spring3.2的bug
ContentNegotiatingViewResolver
public void setMediaTypes(Map&String, String& mediaTypes)
& {
&&& if (mediaTypes != null)
&&&&& ManagerFactoryBean.getMediaTypes().putAll(mediaTypes);
& }
MappingMediaTypeFileExtensionResolver构造器:
public MappingMediaTypeFileExtensionResolver(Map&String, MediaType& mediaTypes)
& {
&&& if (mediaTypes != null)
&&&&& for (Map.Entry entries : mediaTypes.entrySet()) {
&&&&&&& String extension = ((String)entries.getKey()).toLowerCase(Locale.ENGLISH);
&&&&&&& MediaType mediaType = (MediaType)entries.getValue();
&&&&&&& addMapping(extension, mediaType);
&&&&& }
& }
Map的value是不兼容的。
而且spring3.2开始不推荐使用setMediaTypes等直接设置这些数据, 而是通过ContentNegotiationManager(ContentNegotiationManagerFactoryBean)

&bean class="ContentNegotiatingViewResolver"&
&& &property name="contentNegotiationManager"&
&&&&&&&& &bean class="ContentNegotiationManagerFactoryBean"&
&&&&&&&&&&&& &property name="mediaTypes"&
&&&&&&&&&&&&&&&&&& &props&注入即可
&&&&&&&&&&&& &/property&
&&&&&&&& &/bean&
&& &/property&
&/bean&
已解决问题
未解决问题}

我要回帖

更多关于 runtime error 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信