tomcat启动报错:java.lang.ClassCastException: org.apache.jasper.runtime.ELContextImpl cannot be cast to..

启动tomcat的项目报错如下:



解决思路:

1.看到这个错误,java.lang.ClassCastException: org.apache.jasper.runtime.ELContextImpl cannot be cast to org.apache.jasper.el.ELContextImpl,包名不同,类名相同,我首先想到的就是包冲突了,就是tomcat中的包与项目中的包冲突了。

2.在eclipse中找到这个类,Ctrl+Shift+T(这个快捷键是用来查找项目中的类,包括引用的jar文件中的类也会被找到,要与Ctrl+Shift+R区分开来),把ELContextImpl粘贴到搜索框里,


可以看到,这个类在这个包下。然后点击OK按钮,就会找到这个类所在的jar包:



到这里,我们就找到这个jar包了。下一步就是在pom里找到它的依赖,

3. 打开项目的pom.xml文件,打开Dependency Hierarchy选项卡,


幸运的是,我一下就找到了这个jar包,不幸运的是,通过截图可以看到,这个jar包的字体是灰色的,区别于上面那些黑色字体(log4j,mybatis,mybatis-spring,neethi)的jar包,灰色字体的jar包表示它是被间接引入到项目中。

如何在pom.xml中查找是哪个依赖间接引入了org.apache.jasper.glassfish***.jar,这个方法我就不知道了,有看到这个博客的大神,希望能够指点一二,再次不胜感谢。

好吧,我写博客的时候,大神还没有指导我。我就说下我解决的思路,双击这个jar,会打开一个页面显示关于这个jar包的pom信息,


通过截图,可以看到这个jar包的Group Id和它的parent中都有jetty的身影,所以我就直接到我的pom文件里找关于jetty的引用,


有两个关于jetty的引用,我选择的方法是删除其中一个,看看这个org.apache.jasper.glassfish***.jar还是否在项目中存在,最后确定是下面这个依赖引入的它。然后加上一段依赖排除的代码,这个包包就不在项目的引用中了。再次启动项目也成功了,呵呵呵......

java.lang.ClassCastException: java.util.ArrayList cannot be cast错误

04-26

Messages: rnjava.util.ArrayList cannot be cast to org.ygh.vo.SysUserrnFile: org/ygh/dao/impl/SysUserDAOImpl.javarnLine number: 19rnStacktracesrnjava.lang.ClassCastException: java.util.ArrayList cannot be cast to org.ygh.vo.SysUserrnrn org.ygh.dao.impl.SysUserDAOImpl.checkLogin(SysUserDAOImpl.java:19)rn org.ygh.service.impl.SysUserServiceImpl.checkLogin(SysUserServiceImpl.java:29)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn java.lang.reflect.Method.invoke(Method.java:606)rn org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)rn org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)rn org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)rn org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)rn org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)rn com.sun.proxy.$Proxy12.checkLogin(Unknown Source)rn org.ygh.action.SysUserAction.checkLogin(SysUserAction.java:39)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn java.lang.reflect.Method.invoke(Method.java:606)rn ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:891)rn ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1293)rn ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)rn com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:117)rn com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:108)rn ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1369)rn ognl.ASTMethod.getValueBody(ASTMethod.java:90)rn ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)rn ognl.SimpleNode.getValue(SimpleNode.java:258)rn ognl.Ognl.getValue(Ognl.java:494)rn ognl.Ognl.getValue(Ognl.java:458)rn com.opensymphony.xwork2.ognl.OgnlUtil$2.execute(OgnlUtil.java:309)rnrn[code=java]public SysUser checkLogin(SysUser sysUser) rn String strHQL="From SysUser u Where u.userName=? And u.userPassword=? And u.userFlag=1";rn Object [] values=sysUser.getUserName(),sysUser.getUserPassword();rn sysUser=(SysUser)this.getHibernateTemplate().find(strHQL, values);rn return sysUser;[/code]rnrnrnobject 就是报错那一行。rn rnrn

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integ

12-04

at org.hibernate.type.IntegerType.set(IntegerType.java:64)rn at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:154)rn at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136)rn at org.hibernate.param.PositionalParameterSpecification.bind(PositionalParameterSpecification.java:62)rn at org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:514)rn at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1589)rn at org.hibernate.loader.Loader.doQuery(Loader.java:696)rn at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)rn at org.hibernate.loader.Loader.doList(Loader.java:2228)rn at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)rn at org.hibernate.loader.Loader.list(Loader.java:2120)rn at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)rn at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)rn at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)rn at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)rn at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)rn at com.scu.service.impl.BaseServiceImpl.getResult(BaseServiceImpl.java:55)rn at com.scu.service.impl.StudentServiceImpl.check(StudentServiceImpl.java:16)rn at com.scu.struts.action.UserLoginAction.userLogin(UserLoginAction.java:77)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)rn at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)rn at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:110)rn at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)rn at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)rn at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)rn at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)rn at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)rn at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)rn at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)rn at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)rn at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)rn

java.lang.ClassCastException: java.lang.Float cannot be cast to java.lang.Inte

01-11

package card.struts;rnrnimport global.hibernate.MyBeanFactory;rnimport history.hibernate.History;rnrnimport java.util.List;rnimport java.util.Map;rnrnimport org.apache.struts2.interceptor.SessionAware;rnrnimport allDao.CardDao;rnimport allDao.HistoryDao;rnimport card.hibernate.Card;rnrnimport com.opensymphony.xwork2.ActionSupport;rnrnpublic class ChoiseCardAction extends ActionSupport implements SessionAwarern /**rn * rn */rn private static final long serialVersionUID = 1L;rn private int cardId;rn private CardDao cardDao;rn private HistoryDao historyDao;rn @SuppressWarnings("rawtypes")rn private Map session;rnrn @SuppressWarnings("rawtypes")rn public Map getSession() rn return session;rn rnrn public void setSession(@SuppressWarnings("rawtypes") Map session) rn this.session = session;rn rn public int getCardId() rn return cardId;rn rnrn public void setCardId(int cardId) rn this.cardId = cardId;rn rnrn @SuppressWarnings("unchecked")rn public String execute()rn rn System.out.println("正在执行choiseCard请求!"); rn if(this.cardDao==null)rn rn this.cardDao=(CardDao)MyBeanFactory.MyGetBean("cardDao");rn rn if(this.historyDao==null)rn rn this.historyDao=(HistoryDao)MyBeanFactory.MyGetBean("historyDao");rn rn Card card=this.cardDao.queryById(this.cardId);rn System.out.println("选择的卡号为:"+cardId);rn System.out.println("卡里还有的钱:"+card.getBalance()); rn this.session.put("card",card);rn List listOfHistory=this.historyDao.queryByCard(this.cardId);//问题就在这里rn System.out.println("此卡共有消费记录条数:"+listOfHistory.size());rn this.session.put("listOfHistory", listOfHistory);rn return "success";rn rnrnrn下面是控制台的输出:rn正在执行choiseCard请求!rn选择的卡号为:7951rn卡里还有的钱:100.0rnrn问题是listOfHistory=this.historyDao.queryByCard(this.cardId);中如果我把this.cardId改成7951就能运行通过,但是用this.cardId就会报错:rnrnjava.lang.ClassCastException: java.lang.Float cannot be cast to java.lang.Integerrn org.hibernate.type.descriptor.java.IntegerTypeDescriptor.unwrap(IntegerTypeDescriptor.java:36)rn org.hibernate.type.descriptor.sql.IntegerTypeDescriptor$1.doBind(IntegerTypeDescriptor.java:57)rn org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:92)rn org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:305)rn org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:300)rn org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:57)rn org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2602)rn org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2983)rn org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2918)rn org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3247)rn org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:140)rn org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)rn org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354)rn org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:276)rn org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326)rn org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)rn org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1214)rn org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:403)rn org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)rn org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)rn org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:480)rn org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)rn org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)rn org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)rn org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)rn allDao.HistoryDao$$EnhancerByCGLIB$$ca6aaefe.queryByCard()rn card.struts.ChoiseCardAction.execute(ChoiseCardAction.java:60)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn java.lang.reflect.Method.invoke(Method.java:601)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)rn com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)rn org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)rn org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)rnrnrn个人感觉好像是bug,求大侠看一下,哪里有问题?

java.lang.ClassCastException: java.lang.String cannot be cast to common.User

11-08

java.lang.ClassCastException: java.lang.String cannot be cast to common.Userrn at Server.RequestProcessor.logout(RequestProcessor.java:147)rn at Server.RequestProcessor.run(RequestProcessor.java:38)rn at java.lang.Thread.run(Thread.java:662)rnrn其中User是rnpublic class User implements Serializable rn private static final long serialVersionUID = -427838794924380991L;rn private String id;rn private String password; rn private String box1;rn private String grade;rn private String department;rn private String ip;rnrn public User(String id,String password, String box1, String department,String grade,String ip) rn this.id=id;rn this.password = password;rn this.box1 = box1; rn this.department =department;rn this.grade = grade;rn this.ip = ip;rn rn rn public User(String id, String password) rn this.id = id;rn this.password = password;rn rnrn报错的地方是:rn /** 客户端退出 */rn public boolean logout(OnlineClientIOCache oio, Request request) throws IOExceptionrn System.out.println(currentClientSocket.getInetAddress().getHostAddress()+ ":" + currentClientSocket.getPort() + "走了");rn [color=#FF0000]User user0 = (User)request.getAttribute("user");[/color]rn rn ServerDataBuffer.onlineUserIOCacheMap.remove(user0.getid());//把当前上线客户端的IO从Map中删除 rn ServerDataBuffer.onlineUsersMap.remove(user0.getid());//从在线用户缓存Map中删除当前用户rn rn Response response = new Response(); //创建一个响应对象rn response.setType(ResponseType.LOGOUT);rn response.setData("logoutUser", user0);rn oio.getOos().writeObject(response); //把响应对象往客户端写rn oio.getOos().flush();rn currentClientSocket.close(); //关闭这个客户端Socket rn ServerDataBuffer.onlineUserTableModel.remove(String.valueOf(user0.getid())); //把当前下线用户从在线用户表Model中删除 rn return false; //断开监听rn rnrn这是什么原因啊?

java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Obj

12-29

java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Object;rnat com.six.biz.impl.ReportBizImpl.createPdf(ReportBizImpl.java:153)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)rn at $Proxy1.createPdf(Unknown Source)rn at com.six.action.ReportAction.createPdf(ReportAction.java:71)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)rn at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)rn at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)rn at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at com.six.filter.EncodeFilter.doFilter(EncodeFilter.java:40)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)rn

求助java.lang.ClassCastException: entity.User cannot be cast to java.lang.String

09-18

java.lang.ClassCastException: entity.User cannot be cast to java.lang.Stringrn org.hibernate.type.StringType.toString(StringType.java:67)rn org.hibernate.type.NullableType.nullSafeToString(NullableType.java:117)rn org.hibernate.type.NullableType.nullSafeSet(NullableType.java:158)rn org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136)rn org.hibernate.param.PositionalParameterSpecification.bind(PositionalParameterSpecification.java:68)rn org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:514)rn org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1593)rn org.hibernate.loader.Loader.doQuery(Loader.java:696)rn org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)rn org.hibernate.loader.Loader.doList(Loader.java:2232)rn org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)rn org.hibernate.loader.Loader.list(Loader.java:2124)rn org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)rn org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)rn org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)rn org.hibernate.impl.SessionImpl.list(SessionImpl.java:1149)rn org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)rn org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:921)rn org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:1)rn org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)rn org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)rn org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:912)rn org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:908)rn dao.Impl.UserDAOImpl.findByProperty(UserDAOImpl.java:122)rn dao.Impl.UserDAOImpl.findByUsername(UserDAOImpl.java:133)rn service.Impl.UserServiceImpl.findByUsername(UserServiceImpl.java:71)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn java.lang.reflect.Method.invoke(Method.java:597)rn org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)rn org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)rn org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:108)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)rn $Proxy9.findByUsername(Unknown Source)rn web.UserAction.select(UserAction.java:93)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn java.lang.reflect.Method.invoke(Method.java:597)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)rn com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)rn org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)rn org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)rnrnrnnote The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.rn

同类却不同转换 java.lang.ClassCastException: dynamic.test2.Personal cannot be cast to dynamic.test2.Personal

05-15

一个外部jar文件,有两个类:rn/**rn * rn */rnpackage dynamic.test2;rnrnpublic class Personal extends Objectrnrn private String name="";rn private int age = 0;rn private boolean isMale = true;rn /**rn * rn */rn public String toString()rn return this.getClass().getName()+": "+name+"@"+age+"@"+isMale;rn rn public Personal() rn // TODO Auto-generated constructor stubrn rn public Personal(String _name,int _age,boolean _ismale)rn this.name = _name;rn this.age = _age;rn this.isMale = _ismale;rn rn public void setName(String value)rn this.name = value;rn rn public String getName()rn return this.name;rn rn rn public void setAge(int value)rn this.age = value;rn rn public int getAge()rn return this.age;rn rn rn public void setMale(boolean value)rn this.isMale = value;rn rn public boolean isMale()rn return this.isMale==true;rn rnrnrnrnrnrn=====rn/**rn * rn */rnpackage dynamic.test2;rnrnimport java.util.ArrayList;rnimport java.util.List;rnrnpublic class Group rnrn private List peoples = new ArrayList();rn /**rn * rn */rn public Group() rn // TODO Auto-generated constructor stubrn rnrn public void add()rn Personal item = new Personal("auto",0,true);rn peoples.add(item);rn rn public void add(String name,int age,boolean ismale)rn Personal item = new Personal(name,age,ismale);rn peoples.add(item);rn rn rn public void add(Personal item)rn peoples.add(item);rn rn rn public List getPersonals()rn return this.peoples;rn rn rnrnrn生成外部的test2.jarrn写一个测试程序,采用反射原理,动态的加载了test2.jar文件 ,调用dynamic.test2.Group.add()后,再调用dynamic.test2.Group.getPersonals()来得到list. 出错代码如下:rn...rnfm.executeFunction("add", new Object[0],cinst);rn rnrn List list = (List)fm.executeFunction("getPersonals", new Object[0],cinst);//正常rn if(list==null)rn System.out.println("result is null");rn rn elsern System.out.println(list.size()); //正常,得到大小 =1rn rn Iterator it = list.iterator(); //正常rn while(it.hasNext())rn Object o = it.next();rn System.out.println(o.getClass().getName()); //正常,输出就是 dynamic.test2.Personal rn Personal item = (Personal)o; //这句就出错了:java.lang.ClassCastException: dynamic.test2.Personal cannot be cast to dynamic.test2.Personalrn rn System.out.println(item.getName()+" "+ item.getAge()+" "+item.isMale());rn rn rn...rnrn这个问题不知怎样解决?

三大框架整合报java.lang.ClassCastException: java.lang.Integer cannot be cast to com.ylb

05-10

重新建了一次项目,整合三大框架,仍然报这个异常,哪个高手帮忙看看呗rnrnrnrnHTTP Status 500 - rnrn--------------------------------------------------------------------------------rnrntype Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnjava.lang.ClassCastException: java.lang.Integer cannot be cast to com.ylbs.entity.Articlern com.ylbs.dao.impl.ArticleDaoImpl.add(ArticleDaoImpl.java:23)rn com.ylbs.service.impl.ArticleServiceImpl.add(ArticleServiceImpl.java:17)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn java.lang.reflect.Method.invoke(Method.java:597)rn org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)rn org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)rn org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)rn $Proxy0.add(Unknown Source)rn com.ylbs.web.action.ArticleAction.add(ArticleAction.java:29)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn java.lang.reflect.Method.invoke(Method.java:597)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)rn com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)rn org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)rn org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)rnrnrnnote The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.rnrnrn--------------------------------------------------------------------------------rnrnApache Tomcat/6.0.18

Tomcat启动报错ERROR [JDBCExceptionReporter] Cannot create PoolableConnectionFactory

04-01

[size=14px]MyEclipse10启动项目tomcat如下报错,连接数据库超时,MySQL的Server已经启动了,数据库的配置信息也没有问题(如果是账号密码不是报这个错的),localhost跟177.0.0.1都试过,端口号也是3306,,之前没联网也出现过这个问题,但是前几天在连网的情况下正常跑起来了,其他项目连接数据库貌似是没有报这个错的......rnhttp://www.jb51.net/article/18421.htm 这里列出的第三个跟我这个问题很相似,请问这个问题应该怎么解决呢?有遇到过的请指点一下!多谢!!![/size]rnrn2014-04-01 20:42:36,822 ERROR [JDBCExceptionReporter] Cannot create PoolableConnectionFactory (Communications link failure due to underlying exception: rnrn** BEGIN NESTED EXCEPTION ** rnrnjava.net.ConnectExceptionrnMESSAGE: Connection timed out: connectrnrnSTACKTRACE:rnrnjava.net.ConnectException: Connection timed out: connectrn at java.net.PlainSocketImpl.socketConnect(Native Method)rn at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)rn at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)rn at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)rn at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)rn at java.net.Socket.connect(Socket.java:519)rn at java.net.Socket.connect(Socket.java:469)rn at java.net.Socket.(Socket.java:366)rn at java.net.Socket.(Socket.java:209)rn at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)rn at com.mysql.jdbc.MysqlIO.(MysqlIO.java:271)rn at com.mysql.jdbc.Connection.createNewIO(Connection.java:2771)rn at com.mysql.jdbc.Connection.(Connection.java:1555)rn at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)rn at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)rn at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)rn at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)rn at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)rn at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)rn at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)rn at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)rn at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)rn at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)rn at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)rn at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:860)rn at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:779)rn at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByName(AbstractAutowireCapableBeanFactory.java:1104)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1054)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByName(AbstractAutowireCapableBeanFactory.java:1104)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1054)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)rn at rnat org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4205)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4704)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)rn at org.apache.catalina.core.StandardService.start(StandardService.java:525)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:595)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)rnrnrn** END NESTED EXCEPTION **rnrnrnrnLast packet sent to the server was 1 ms ago.)

java.lang.ClassCastException: weblogic.jdbc.common.internal.ConnectionEnv cannot

07-26

rn在weblogic连接mysql数据库出现了下面问题,谢谢rnrnrnrnrnrnjava.lang.ClassCastException: weblogic.jdbc.common.internal.ConnectionEnv cannot be cast to java.io.Serializablern at weblogic.iiop.IIOPOutputStream.writeObject(IIOPOutputStream.java:2266)rn at weblogic.utils.io.ObjectStreamClass.writeFields(ObjectStreamClass.java:413)rn at weblogic.corba.utils.ValueHandlerImpl.writeValueData(ValueHandlerImpl.java:235)rn at weblogic.corba.utils.ValueHandlerImpl.writeValueData(ValueHandlerImpl.java:225)rn at weblogic.corba.utils.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:182)rn at weblogic.iiop.IIOPOutputStream.write_value(IIOPOutputStream.java:1963)rn at weblogic.iiop.IIOPOutputStream.write_value(IIOPOutputStream.java:2001)rn at weblogic.iiop.IIOPOutputStream.writeObject(IIOPOutputStream.java:2266)rn at weblogic.jdbc.common.internal.RmiDataSource_WLSkel.invoke(Unknown Source)rn at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)rn at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)rn at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)rn at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)rn at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)rn at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)rn at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)rn at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)rn at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)rnrnrnrnrn源代码:rnrnpackage c;rnrnimport java.sql.Connection;rnimport java.sql.ResultSet;rnimport java.sql.SQLException;rnimport java.sql.Statement;rnimport java.util.Hashtable;rnrnimport javax.naming.Context;rnimport javax.naming.InitialContext;rnimport javax.sql.DataSource;rnrnpublic class jdbc1 rnrn /**rn * @param argsrn */rn public static void main(String[] args) rn // TODO Auto-generated method stubrn DataSource ds = null;rn Context ctx = null;rn Connection con = null;rn Statement stmt = null;rn ResultSet rs = null;rn Hashtable p = new Hashtable();rn p.put(Context.INITIAL_CONTEXT_FACTORY,rn "weblogic.jndi.WLInitialContextFactory");rn p.put(Context.PROVIDER_URL, "t3://localhost:7001");rn try rn ctx = new InitialContext(p);rn // String test = "MysqlWeblogic1";rn ds = (DataSource) ctx.lookup("MysqlWeblogic1");rn con = ds.getConnection();rn stmt = con.createStatement();rn rs = stmt.executeQuery("select * from book");rn while (rs.next())rn rn System.out.print(rs.getString("bookName"));rn catch (Exception e) rn e.printStackTrace();rn finally rnrn try rn if (rs == null)rn rs.close();rn if (stmt == null)rn stmt.close();rn if (con == null)rn con.close();rn catch (SQLException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rnrn rn rnrnrnrn

com.casinocity.bean.GameCategory cannot be cast to java.lang.Comparable

05-21

Technical Details rnjava.lang.ClassCastException: com.casinocity.bean.GameCategory cannot be cast to java.lang.Comparable at java.util.TreeMap.put(TreeMap.java:542) at com.casinocity.front.action.HomeAction.execute(HomeAction.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:619) rn

java.lang.String cannot be cast to

05-23

type Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnorg.apache.jasper.JasperException: Exception in JSP: /bookshowcart.jsp:58rnrn55: <%for(Iterator iter=cart.getItems().iterator();iter.hasNext();)rn56: rn57: ShoppingCartItem item=(ShoppingCartItem)iter.next();rn58: BookDetails book=(BookDetails)item.getItem();rn59: %>rn60: rn61: rnrnrnStacktrace:rn org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrnrnroot cause rnrnjava.lang.ClassCastException: java.lang.String cannot be cast to shop.BookDetailsrn org.apache.jsp.bookshowcart_jsp._jspService(org.apache.jsp.bookshowcart_jsp:159)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrn这句真的有错吗?rnBookDetails book=(BookDetails)item.getItem();

cannot be cast to javax.servlet.Filter

12-28

我写了一个过滤器,配置在Web.xml文件中,启动程序时候就报以下错误:rnrnrnrn 严重: Exception starting filter sessionFilterrnjava.lang.ClassCastException: com.ghb.web.filter.SessionFilter cannot be cast to javax.servlet.Filterrn at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:255)rn at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)rn at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108)rn at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3800)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4450)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)rn at org.apache.catalina.core.StandardService.start(StandardService.java:516)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:583)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)rnrnrnrn类文件:rnrn package com.ghb.web.filter;rnrnimport java.io.IOException;rnrnimport javax.servlet.FilterChain;rnimport javax.servlet.FilterConfig;rnimport javax.servlet.ServletException;rnimport javax.servlet.ServletRequest;rnimport javax.servlet.ServletResponse;rnrnpublic class SessionFilter rnrn private FilterConfig config;rnrn public void destroy() rn // TODO Auto-generated method stubrn rnrn public void doFilter(ServletRequest req, ServletResponse resp,rn FilterChain chain) throws IOException, ServletException rn String enconding = config.getInitParameter("encoding");rn req.setCharacterEncoding(enconding);rn resp.setCharacterEncoding(enconding);rn chain.doFilter(req, resp);rn rnrn public void init(FilterConfig config) throws ServletException rn this.config = config;rn rnrnrnrnrnrn web.xml文件配置信息rn rn rn sessionFilterrn com.ghb.web.filter.SessionFilterrn rn encodingrn UTF-8rn rn rn rn sessionFilterrn /*rn rnrnrnrn 我之前用myeclipse的时候,是没有错的,我换到Eclipse后就报这个错了,网上搜了一大圈,有的说是包和rntomcat冲突,rnrn 这到底是什么原因啊rn

java.util.ArrayList cannot be cast to com.hxll.hr.entity.SalaryStandard

11-25

报错:rnHibernate: select salarystan0_.SSD_ID as SSD1_25_, salarystan0_.STANDARD_ID as STANDARD2_25_, salarystan0_.STANDARD_NAME as STANDARD3_25_, salarystan0_.DESIGNER as DESIGNER25_, salarystan0_.REGISTER as REGISTER25_, salarystan0_.CHECKER as CHECKER25_, salarystan0_.CHANGER as CHANGER25_, salarystan0_.REGIST_TIME as REGIST8_25_, salarystan0_.CHECK_TIME as CHECK9_25_, salarystan0_.CHANGE_TIME as CHANGE10_25_, salarystan0_.SALARY_SUM as SALARY11_25_, salarystan0_.CHECK_STATUS as CHECK12_25_, salarystan0_.CHANGE_STATUS as CHANGE13_25_, salarystan0_.CHECK_COMMENT as CHECK14_25_, salarystan0_.REMARK as REMARK25_ from SALARY_STANDARD salarystan0_ where salarystan0_.STANDARD_ID like '10004'rn[color=#FF0000]Exception in thread "main" java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.hxll.hr.entity.SalaryStandardrn at com.hxll.hr.dao.impl.SalaryStandardDaoImpl.salaryStandardId(SalaryStandardDaoImpl.java:88)rn at com.hxll.hr.dao.impl.SalaryStandardDaoImpl.main(SalaryStandardDaoImpl.java:95)[/color]rnrn声明一下这个com.hxll.hr.entity.SalaryStandard是实体类。rn我运行这段代码:rn/**rn * 薪酬标准信息编号查询rn */rn public SalaryStandard salaryStandardId(String standardId) rn String hql = "from SalaryStandard s where s.standardId like '"+standardId+"'";rn return (SalaryStandard)super.getHibernateTemplate().find(hql);rn rn rn public static void main(String[] args) rn // TODO Auto-generated method stubrn ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");rn SalaryStandardDaoImpl salaryStandardDao=(SalaryStandardDaoImpl)context.getBean("salaryStandardDao");rn salaryStandardDao.salaryStandardId("10004");rn System.out.println(salaryStandardDao);rn rnrn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试