工程启动报错cannot be cast to javax.servlet.Servlet 5C

错误:
严重: Servlet [SendMailServlet] in web application [/SendMail] threw load() exception
java.lang.ClassCastException: com.rl.mail.SendMailTask cannot be cast to javax.servlet.Servlet
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1050)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:989)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4913)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5223)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

代码是网上的,内容比较多,下面是地址
地址:https://blog.csdn.net/suyu_yuan/article/details/50668236

2个回答

看下web.xml里面配置有问题
SendMailServlet是不是写成SendMailTask类

qq_35979095
小鱼Ava 对,是配置有问题。。
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
cannot be cast to javax.servlet.Servlet
刚开始学习,写了一个简单的servlet:rn问题是:在Jcreator上编译通过,但是发布以后浏览器中出现rnroot cause rnrn[b]java.lang.ClassCastException: com.tsinghua.Hello cannot be cast to javax.servlet.Servletrn org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)rn org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)rn org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)rn org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)rn java.lang.Thread.run(Thread.java:619)rnrn[/b]rn请问问题何在啊?rnpublic class Hellorn rn public void init(ServletConfig parm1) throws ServletException rn // TODO: Add your code herern System.out.println("init it");rn rn rnrn rn public ServletConfig getServletConfig() rn // TODO: Add your code herern return null;rn rnrn rn rn public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException rn // TODO: Add your code herern System.out.println("sdfjsdf");rn PrintWriter pw = res.getWriter();rn pw.println("helle");rnrn rn rnrn rn public String getServletInfo() rn // TODO: Add your code herern return "";rn rnrn rn public void destroy() rn // TODO: Add your code herern System.out.println("destroy");rn rn rn rn
org.apache.tomcat.websocket.server.WsSci cannot be cast to javax.servlet.Servlet
web工程依赖一个SpringBoot工程,web工程为Tomcat插件启动rnweb工程启动的时候每次报下面三个错误中的一个。rn1.org.springframework.web.SpringServletContainerInitializer cannot be cast to javax.servletrn2.org.apache.tomcat.websocket.server.WsSci cannot be cast to javax.servlet.Servletrn3.ch.qos.logback.classic.servlet.LogbackServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializerrn两个工程的pom依赖如下,rnweb项目rn[code=java] rn junitrn junitrn 4.11rn testrn rn rn com.yhrn buspay-gatern 1.0rn rn rn org.slf4jrn slf4j-log4j12rn 1.7.21rn rn rn com.fasterxml.jackson.corern jackson-corern 2.5.1rn rn rn com.fasterxml.jackson.corern jackson-databindrn 2.5.1rn rn rn org.apache.shirorn shiro-corern 1.2.5rn rn rn org.apache.shirorn shiro-ehcachern 1.2.5rn rn rn org.apache.shirorn shiro-webrn 1.2.5rn rn rn org.apache.shirorn shiro-springrn 1.2.5rn rn rn org.apache.tomcatrn servlet-apirn 6.0.37rn providedrn rn rn org.apache.tomcatrn jsp-apirn 6.0.37rn providedrn rn rn net.sf.json-librn json-librn 2.4rn jdk15rn rn rn commons-collectionsrn commons-collectionsrn 3.2.1rn rn rn commons-fileuploadrn commons-fileuploadrn 1.3.1rn rn [/code]rnrnspringboot项目日志用的rnrnrn ch.qos.logbackrn logback-classicrn 1.2.3rn
com.java.filter.FormFilter cannot be cast to javax.servlet.Filter
严重: Exception starting filter FormFilterrnjava.lang.ClassCastException: com.java.filter.FormFilter cannot be cast to javax.servlet.Filterrn at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)rn at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)rn at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115)rn at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)rn at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)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)rn2012-9-19 17:39:02 org.apache.catalina.core.StandardContext startrn严重: Error filterStartrn2012-9-19 17:39:02 org.apache.catalina.core.StandardContext startrn严重: Context [/Servlet] startup failed due to previous errorsrn2012-9-19 17:39:02 org.apache.catalina.startup.HostConfig deployDirectory
$Proxy0 cannot be cast to org.hibernate.impl.SessionFactoryImpl
$Proxy0 cannot be cast to org.hibernate.impl.SessionFactoryImpl 請問高手這是哪里的問題 ssh+compass時出現的問題,請高手指點啊!
java.util.ArrayList cannot be cast to txgl.entity.P_Person
就是一个页面 页面数据包括俩表的数据 然后当我点击修改的时候 页面的数据帮定到修改页面的文本框里面 我现在绑定了一个表的数据 另外一个表的数据怎么绑定啊
com.casinocity.bean.GameCategory cannot be cast to java.lang.Comparable
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.util.ArrayList cannot be cast to java.lang.Integer
[code=java]rn public List searchApprovingDocuments(int userId) rn User user = getHibernateTemplate().load(User.class, userId);rn List docIds = workflowManager.searchApprovingDocuments(userrn .getUsername());rn if (docIds == null || docIds.isEmpty()) rn return null;rn rnrn return getSession().createQuery("select d from Document d where d.id in (:ids)").setParameter("ids", docIds).list();rn rn[/code]rn执行getSession().createQuery("select d from Document d where d.id in (:ids)").setParameter("ids", docIds).list()时,总是提示java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Integer。rn别人这么写就可以,为什么在我这就不行了呢???
java.util.ArrayList cannot be cast to ....pojo.SchoolInfo
做了一个修改学校的模块,如下,大家帮忙看看哪里写错了。rnrnSchoolAction.javarn[img=https://img-bbs.csdn.net/upload/201407/23/1406082906_416921.png][/img]rnrnSchoolService.javarn[img=https://img-bbs.csdn.net/upload/201407/23/1406082918_817556.png][/img]rn[img=https://img-bbs.csdn.net/upload/201407/23/1406082982_545419.png][/img]rnrnSchoolDao.javarn[img=https://img-bbs.csdn.net/upload/201407/23/1406083042_400536.png][/img]rnrnupdateschool.jsprn[img=https://img-bbs.csdn.net/upload/201407/23/1406083067_574326.png][/img]
org.eclipse.jdt.internal.ui.javaeditor.JarEntryEditorInput cannot be cast to org
java.lang.ClassCastException: org.eclipse.jdt.internal.ui.javaeditor.JarEntryEditorInput cannot be cast to org.eclipse.ui.IFileEditorInputrn at com.genuitec.eclipse.struts2.editor.Struts2Editor.setInput(Struts2Editor.java:258)rn at org.eclipse.gef.ui.parts.GraphicalEditor.init(GraphicalEditor.java:318)rn at com.genuitec.eclipse.struts2.editor.Struts2Editor.init(Struts2Editor.java:207)rn at org.eclipse.ui.part.MultiPageEditorPart.addPage(MultiPageEditorPart.java:238)rn at com.genuitec.eclipse.struts2.editor.Struts2ConfigEditor.createPages(Struts2ConfigEditor.java:59)rn at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:357)rn at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:662)rn at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:462)rn at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)rn at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:286)rn at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2857)rn at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2762)rn at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2754)rn at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2705)rn at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)rn at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2701)rn at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2685)rn at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2676)rn at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:374)rn at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:178)rn at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:229)rn at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:208)rn at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:274)rn at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:250)rn at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:373)rn at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$4.open(PackageExplorerPart.java:526)rn at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)rn at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:842)rn at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)rn at org.eclipse.core.runtime.Platform.run(Platform.java:888)rn at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)rn at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)rn at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:840)rn at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1101)rn at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1205)rn at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:264)rn at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:258)rn at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:298)rn at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)rn at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)rn at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3910)rn at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503)rn at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)rn at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)rn at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)rn at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)rn at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)rn at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)rn at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)rn at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)rn at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)rn at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)rn at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)rn at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)rn at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)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.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)rn at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)rn at org.eclipse.equinox.launcher.Main.run(Main.java:1311)rnrn================================================================================================rn今天在打开struts2-core-2.3.24.jar时碰到了,然后打开其他jar文件下的xml文件同样也是这样,求大神赐教!
java.lang.String cannot be cast to [Ljava.lang.Object;
谁能告诉我什么原因啊 求大虾·rnjava.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.Object;rn at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:104)rn at org.hibernate.loader.Loader.putResultInQueryCache(Loader.java:2208)rn at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2159)rn at org.hibernate.loader.Loader.list(Loader.java:2117)rn at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)rn at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1722)rn at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)rn at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)rn at com.gold.dao.impl.EnterpriseInfoDao.showLonName(EnterpriseInfoDao.java:114)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:307)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.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)rn at $Proxy27.showLonName(Unknown Source)rn at com.gold.service.impl.EnterpriseService.showLonName(EnterpriseService.java:68)rn at com.gold.action.EnterpriseInfoAction.showAll(EnterpriseInfoAction.java:479)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:452)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)rn at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)rn at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)rn at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)rn at com.gold.filter.MyStrutsPrepareAndExecuteFilter.doFilter(MyStrutsPrepareAndExecuteFilter.java:23)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.gold.filter.EncodingFilter.doFilter(EncodingFilter.java:26)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:233)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:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)
java.util.ArrayList cannot be cast to com.hxll.hr.entity.SalaryStandard
报错: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
android.widget.RelativeLayout cannot be cast to android.widget.LinearLayout
java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.LinearLayoutrnrnactivity 主界面是这样的rn[code=html]rnrn rn rn rn rn rn rn rn rnrnrn[/code]rnrnrnListView 中每个 item 是这样的rn[code=html]rnrnrn rn rn rnrn rnrn rnrnrn[/code]rnrnrnListView 还有个头rn[code=html]rnrnrn rn rn rnrn[/code]rnrnListView 在代码中添加这个头rn[code=java]View HeaderView = View.inflate(this, R.layout.selectedmenuheader, null);rn lv.addHeaderView(HeaderView);[/code]rnrn最后我要循环遍历 ListView 中个每个 itemrn[code=java]try rn LinearLayout layout = (LinearLayout) lv.getChildAt(i);rn TextView tvName = (TextView) layout.findViewById(R.id.labMingCheng2);rn EditText etFenShu = (EditText) layout.findViewById(R.id.iFenShu);rn CheckBox cb = (CheckBox) layout.findViewById(R.id.delete);rn rn catch (Exception ee)rn rn Log.i("44445555", ee.toString());rn [/code]rnrn总之,异常就出现在LinearLayout layout = (LinearLayout) lv.getChildAt(i);。rn就算把 LinearLayout 换成 RelativeLayout 也一样转换异常,不能转换。
Ljava.lang.Object; cannot be cast to ...问题
大家好,我在以下这段代码中遇到了上边显示的异常,rnfor(GgMarketDetailDto ggMarketDetailDto:ggMarketDetailDtoList)rn 。。。rnrn这段代码的意思是这样,GgMarketDetailDto是一个实体类,我使用了list的泛型来存储了这个实体类对象的一个集合,即ggMarketDetailDtoList是一个泛型的列表,但是在这行代码的执行中,一直遇到上边的问题,请问有谁遇到过这种问题吗?
java.lang.NoClassDefFoundError cannot be cast to java.lang.Exception
我的程序在IE里浏览时出现这样的错误:rndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnorg.apache.jasper.JasperException: An exception occurred processing JSP page /errorpage.jsp at line 13rnrn10: <%rn11: String message = "Unknown Error: Please report to your administrator."; rn12: if (exception != null )rn13: message = message+((Exception)exception).getMessage();rn14: rn15: out.println(message);rn16: rnrnrnStacktrace:rn org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:694)rn org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:665)rn org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:806)rn org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)rn org.apache.jsp.InsertNewNotice_jsp._jspService(InsertNewNotice_jsp.java:133)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rnrnrnroot cause rnrnjava.lang.ClassCastException: java.lang.NoClassDefFoundError cannot be cast to java.lang.Exceptionrn org.apache.jsp.errorpage_jsp._jspService(errorpage_jsp.java:69)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:694)rn org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:665)rn org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:806)rn org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)rn org.apache.jsp.InsertNewNotice_jsp._jspService(InsertNewNotice_jsp.java:133)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rnrn请问这是什么原因?
java.lang.Long cannot be cast to java.lang.Integer
我在做批量删除的时候,要根据用户表的id删除,id是Inreger类型的rn下面分别是DAO和Action的代码和报错信息rn请高手帮忙~~~~~~rnrnDAOrn[code=Java]public void delByIds(String[] ids)rnrn String hql = "delete TransUsers where id=?";rn try rn rn Query q = getSession().createQuery(hql);rn for (int i = 0; i < ids.length; i++) rn rn q.setParameter(0, Long.parseLong(ids[i]));rn rn q.executeUpdate();rn rn catch (HibernateException e) rn // TODO: handle exceptionrn log.error("attach failed", e);rn throw e;rn rn rn [/code]rnActionrn[code=Java]public ActionForward delByIds(ActionMapping mapping, ActionForm form,rn HttpServletRequest request, HttpServletResponse response) rn // TODO Auto-generated method stubrn ActionMessages messages = new ActionMessages();rn GloBalCookie cookie = new GloBalCookie();rn cookie.setCookie("alitransPage", "/index.trans?method=translog", response, 10*60);rn rn String[] ids=request.getParameterValues("id"); rn rn for (int i = 0; i < ids.length; i++) rn System.out.println(ids[i]);rn rn rn ActionErrors errors = new ActionErrors();rn HttpSession session = request.getSession();rn if(ids != null || ids.length<1)rn TransUsersDAO tud = new TransUsersDAO(); rn rn AdminForm adminForm = (AdminForm)session.getAttribute("adminObj");rn if(adminForm == null || adminForm.getEmailAddress().trim().equals(""))rn errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("translog.notlogin"));rn this.saveErrors(request, errors);rn return mapping.findForward("navigation.login"); rn rn Transaction tx=tud.getSession().beginTransaction(); rn tryrn tud.delByIds(ids);rn catch(RuntimeException re)rn re.printStackTrace();rn messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(rn "admin.oper.error")); rn rn tx.commit(); rn rn messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(rn "success"));rn this.saveMessages(request, messages);rn return new ActionForward("/admin/index.trans?method=userlogs");rn [/code]rnrn报错信息[code=Java]rnjava.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integerrn at org.hibernate.type.IntegerType.set(IntegerType.java:41)rn at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:83)rn at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:65)rn at org.hibernate.param.PositionalParameterSpecification.bind(PositionalParameterSpecification.java:39)rn at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:67)rn at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:334)rn at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:209)rn at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1126)rn at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)rn at com.hibernate.TransUsersDAO.delByIds(TransUsersDAO.java:288)rn at com.alitrans.admin.action.IndexAction.delByIds(IndexAction.java:478)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:589)rn at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)rn at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)rn at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)rn at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)rn at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at com.alitrans.RequestCharacterEncodingFilter.doFilter(RequestCharacterEncodingFilter.java:56)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)rn at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:833)rn at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)rn at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)rn at java.lang.Thread.run(Thread.java:619)rn[/code]
cannot be cast to javax.servlet.Filter
我写了一个过滤器,配置在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
org.apache.poi.hssf.usermodel.HSSFWorkbook cannot be cast to org.apache.poi.ss.u
org.apache.poi.hssf.usermodel.HSSFWorkbook cannot be cast to org.apache.poi.ss.usermodel.Workbook
org.hibernate.hql.ast.HqlToken cannot be cast to antlr.Token.
Jboss 版本 6.0.0.CR1. 启动报这个错rnrnjava.lang.ClassCastException: org.hibernate.hql.ast.HqlToken cannot be cast to antlr.Token.rnrn我的.ear\lib下面放了antlr.jar 和hibernate3.jar 是我的应用需要的。这样的错有办法解决吗?
java.math.BigInteger cannot be cast to com.labmanager.fw.data.bo.Lab
[code=java]rnpackage com.labmanager.fw.JUNIT;rnrnimport java.util.ArrayList;rnimport java.util.Iterator;rnimport java.util.List;rnrnimport org.hibernate.SQLQuery;rnimport org.hibernate.Session;rnimport org.hibernate.Transaction;rnrnimport com.labmanager.fw.data.bo.Lab;rnimport com.labmanager.fw.util.HibernateSessionFactory;rnrnpublic class PageDeviceTestrnrn public List getResultCount(String table)rn Session session=HibernateSessionFactory.getSession();rn Transaction ts=session.beginTransaction();rn List list=new ArrayList();rn String sql="select count(*) from "+table+" where id > 0";rn tryrn ts.begin();rn SQLQuery sqlQuery=session.createSQLQuery(sql); rn list=sqlQuery.list();rn ts.commit();rn System.out.println("查询到数据"+list.get(0).toString()+"条");rn catch(Exception e)rn ts.rollback();rn e.printStackTrace();rn finallyrn HibernateSessionFactory.closeSession();rn rn return list;rn rn public void dispaly()rn List list=new ArrayList();rn list=this.getResultCount("tblab");rn Iterator it=list.iterator();rn while(it.hasNext())rn System.out.println(((Lab)it.next()).getName());rn rn rn public static void main(String[] args)rn new PageDeviceTest().dispaly(); rn rnrnrnrn[/code]rnrnrn&rnrnConsole输出:rnrn查询到数据20条rnException in thread "main" java.lang.ClassCastException: java.math.BigInteger cannot be cast to com.labmanager.fw.data.bo.Labrn at com.labmanager.fw.JUNIT.PageDeviceTest.dispaly(PageDeviceTest.java:40)rn at com.labmanager.fw.JUNIT.PageDeviceTest.main(PageDeviceTest.java:44)rnrnrn&rnLab类是Hibernate inverse 生成的。rn主键类型为Shortrn配置文件如下rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnrn错误实在搞不明白。网上也看了搞了很久没辙了。。。
java.util.ArrayList cannot be cast to org.apache.struts.upload.FormFile
请问这个问题怎么解决?rn我在Action里面,程序经过:List uploadFileList = super.uploadFile(form, true, 0, new int[] 120, 240, 400, 640 );rn这句话的时候,就报上面的错误;rn错误提示:rnjava.lang.ClassCastException: java.util.ArrayList cannot be cast to org.apache.struts.upload.FormFilern com.ebiz.ssi.web.struts.BaseSsiAction.uploadFile(BaseSsiAction.java:255)rn com.ebiz.ssi.web.struts.BaseSsiAction.uploadFile(BaseSsiAction.java:203)rn com.ebiz.easybiz.web.struts.admin.manager.NewsInfoAllAction.save(NewsInfoAllAction.java:229)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn java.lang.reflect.Method.invoke(Unknown Source)rn org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)rn rnrn其中BaseSsiAction.java中该方法代码如下:rnprotected transient List uploadFile(ActionForm form, String uploadDir, boolean isResizeImage, int resizeType, int resizeVersions[])rn throws Exceptionrn rn if (StringUtils.isBlank(uploadDir))rn uploadDir = StringUtils.join(new String[] rn "files", "upload", ""rn , File.separator);rn String folderPatterns[] = rn "yyyy", "MM", "dd", ""rn ;rn String autoCreatedDateDir = DateFormatUtils.format(new Date(), StringUtils.join(folderPatterns, File.separator));rn String ctxDir = getServlet().getServletContext().getRealPath(File.separator);rn if (!ctxDir.endsWith(File.separator))rn ctxDir = (new StringBuilder(String.valueOf(ctxDir))).append(File.separator).toString();rn File savePath = new File((new StringBuilder(String.valueOf(ctxDir))).append(uploadDir).append(autoCreatedDateDir).toString());rn logger.debug("===> save path is: ", savePath);rn if (!savePath.exists())rn savePath.mkdirs();rn List uploadFileList = new ArrayList();rn UploadFile uploadFile = null;rn int i = 0;rn Hashtable fileh = form.getMultipartRequestHandler().getFileElements();rn for (Enumeration e = fileh.keys(); e.hasMoreElements();)rn rn String key = (String)e.nextElement();rn FormFile formFile = (FormFile)fileh.get(key);rn String fileName = formFile.getFileName().trim();rn if (!"".equals(fileName))rn rn uploadFile = new UploadFile();rn uploadFile.setContentType(formFile.getContentType());rn uploadFile.setFileSize(formFile.getFileSize());rn uploadFile.setFileName(formFile.getFileName().trim());rn uploadFile.setFormName(key);rn String fileSaveName = StringUtils.join(new String[] rn UUID.randomUUID().toString(), ".", uploadFile.getExtension()rn );rn String fileSavePath = (new StringBuilder(String.valueOf(uploadDir))).append(autoCreatedDateDir).append(fileSaveName).toString();rn uploadFile.setFileSaveName(fileSaveName);rn uploadFile.setFileSavePath(StringUtils.replace(fileSavePath, File.separator, "/"));rn logger.debug(uploadFile.toString());rn uploadFileList.add(uploadFile);rn InputStream ins = formFile.getInputStream();rn OutputStream os = new FileOutputStream((new StringBuilder(String.valueOf(ctxDir))).append(fileSavePath).toString());rn int bytesRead = 0;rn byte buffer[] = new byte[8192];rn while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) //代码中第255行rn os.write(buffer, 0, bytesRead);rn os.close();rn ins.close();rn rn return uploadFileList;rn rnrn请教高手啊 !
java.util.HashSet cannot be cast to org.hibernate.collection.PersistentCollectio
error:java.util.HashSet cannot be cast to org.hibernate.collection.PersistentCollectionrnrnhibernate在做session.merge的操作rn然后我调用flush方法同步数据库报错了rnrnmerge应该是做的update的操作,因为我修改了实体对象rn我想知道hibernate merge 这种错误一般什么原因导致的?
java.lang.String cannot be cast to
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 javassist.util.proxy.Proxy
这是我的代码结构:n![图片说明](https://img-ask.csdn.net/upload/201703/21/1490089343_799107.png)n代码下载地址(好像贴不完,有字数要求,麻烦了):http://pan.baidu.com/s/1cDzTAAn运行TestM2O时报错:nINFO: HHH000327: Error performing load command : org.hibernate.HibernateException: HHH000142: Javassist Enhancement failed: entity.Graden三月 21, 2017 5:43:35 下午 org.hibernate.event.internal.DefaultLoadEventListener doOnLoadnINFO: HHH000327: Error performing load command : org.hibernate.HibernateException: HHH000142: Javassist Enhancement failed: entity.GradenException in thread "main" org.hibernate.HibernateException: HHH000142: Javassist Enhancement failed: entity.Graden at org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.getProxy(JavassistProxyFactory.java:130)n at org.hibernate.tuple.entity.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:717)n at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:4580)n at org.hibernate.event.internal.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:359)n at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:274)n at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:121)n at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:89)n at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1142)n at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1025)n at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:639)n at org.hibernate.type.EntityType.resolve(EntityType.java:431)n at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:165)n at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:125)n at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.performTwoPhaseLoad(AbstractRowReader.java:238)n at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.finishUp(AbstractRowReader.java:209)n at org.hibernate.loader.plan.exec.process.internal.ResultSetProcessorImpl.extractResults(ResultSetProcessorImpl.java:133)n at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:122)n at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:86)n at org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader.load(AbstractLoadPlanBasedEntityLoader.java:167)n at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:4069)n at org.hibernate.event.internal.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:508)n at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:478)n at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:219)n at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:278)n at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:121)n at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:89)n at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1142)n at org.hibernate.internal.SessionImpl.access$2600(SessionImpl.java:167)n at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.doLoad(SessionImpl.java:2762)n at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.load(SessionImpl.java:2741)n at org.hibernate.internal.SessionImpl.get(SessionImpl.java:978)n at test.TestM2O.findGradeByStudent(TestM2O.java:37)n at test.TestM2O.main(TestM2O.java:14)nCaused by: java.lang.ClassCastException: entity.Grade_$$_javassist_0 cannot be cast to javassist.util.proxy.Proxyn at org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.getProxy(JavassistProxyFactory.java:123)n ... 32 morenn如果我把student.hbm.xml中的标签删除就可以运行,不知道为什么,大家能帮我解答一下吗,我用的是hibernate5.1.5nnnnnnnnnnnnnnn
com.wzk.CMS.Users cannot be cast to java.util.List
恩 我编写了一个 Users类 。。。rn[code="java"]rnpackage com.wzk.CMS;rnpublic class Users rnrn private int id;rn private int wor_id;rn private int deb_id; rn private int war_id; rn private int dep_id; rn private int fil_id; rn private int cul_id; rn private int dut_id; rn private String username; rn private String password;rn private String name;rn public int getDeb_id() rn return deb_id;rn rn public void setDeb_id(int debId) rn deb_id = debId;rn rn public int getDep_id() rn return dep_id;rn rn public void setDep_id(int depId) rn dep_id = depId;rn rn public int getId() rn return id;rn rn public void setId(int id) rn this.id = id;rn rn public int getWor_id() rn return wor_id;rn rn public void setWor_id(int worId) rn wor_id = worId;rn rn public int getWar_id() rn return war_id;rn rn public void setWar_id(int warId) rn war_id = warId;rn rn public int getFil_id() rn return fil_id;rn rn public void setFil_id(int filId) rn fil_id = filId;rn rn public int getCul_id() rn return cul_id;rn rn public void setCul_id(int culId) rn cul_id = culId;rn rn public int getDut_id() rn return dut_id;rn rn public void setDut_id(int dutId) rn dut_id = dutId;rn rn public String getUsername() rn return username;rn rn public void setUsername(String username) rn this.username = username;rn rn public String getPassword() rn return password;rn rn public void setPassword(String password) rn this.password = password;rn rn public String getName() rn return name;rn rn public void setName(String name) rn this.name = name;rn rn rnrn[/code]rn然后 编写了 一个 DAO实现方法 其中声明private static final String select_users_sql="select * from users order by id desc" ;rn[code="java"]rn//****************读取表中所有记录*******************rn rn public List getUserList() rn rn QueryRunner qr=getQueryRunner();rn List userList=null;rn rn try rn userList=(List)qr.query(select_users_sql, new BeanHandler(Users.class));rn rn catch (Exception e) rn e.printStackTrace();rn rn rn return userList;rn rn[/code]rnrnrn编译运行后 报错rn[code="java"]rnjava.lang.ClassCastException: com.wzk.CMS.Users cannot be cast to java.util.Listrn at com.wzk.CMS.dao.DaoJdbc.getUserList(DaoJdbc.java:81)rn at com.wzk.CMS.servlet.UsersServlet.getUsersList(UsersServlet.java:73)rn at com.wzk.CMS.servlet.UsersServlet.doPost(UsersServlet.java:34)rn at com.wzk.CMS.servlet.UsersServlet.doGet(UsersServlet.java:22)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)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.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)rnrn[/code]rnrnrnUsersServlet代码 为rn[code="java"]rnpublic void getUsersList(HttpServletRequest request,rn HttpServletResponse response) throws ServletException, IOException rn Dao dao = new DaoJdbc();rn List userList = dao.getUserList();rn request.setAttribute("userList", userList);rn request.getRequestDispatcher("/userList.jsp")rn .forward(request, response);rnrn rn[/code]rn怎么办呀
java.lang.String cannot be cast to java.lang.Long
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Longrnrn[code=java]rnQuery query = getSession().createQuery("select e.provinceid from Province e where e.sid=?");rn query.setParameter(0, pid);rn String father =(String)query.uniqueResult();rn System.out.println(father);rn [/code]rn这是model的属性rn private String provinceid; //这个是string类型啊rn
cannot be cast to java.lang.Integer
[code=Java]rnrn//查询表中最大记录数rnString blogName="blog";rn String newSql = "select ROWCNT from SYSINDEXES where id =OBJECT_ID('"+blogName+"') and INDID<2";rnrnint result = (Integer)db.query(newSql, null, new ScalarHandler(1));rnrn//报错:rnjava.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integerrn//写成 Integer.parseInt(db.query(newSql, null, new ScalarHandler(1)));还是抱这个错rnrnrn[/code]rn
com.mysql.jdbc.JDBC4ResultSet cannot be cast to com.mysql.jdbc.ResultSet
com.mysql.jdbc.JDBC4ResultSet cannot be cast to com.mysql.jdbc.ResultSet,,如何解决
Ljava.lang.Object; cannot be cast to mq.net.front.lookHouse.model.IookHouseModel
daornrn [img=https://img-bbs.csdn.net/upload/201404/16/1397620024_142618.jpg][/img]rnrnrnservice 方法rnrnrn[img=https://img-bbs.csdn.net/upload/201404/16/1397620050_750207.jpg][/img]rnrnrnrnaction 方法 rnrn[img=https://img-bbs.csdn.net/upload/201404/16/1397620072_708204.jpg][/img]rnrnrn错误信息[size=18px][color=#FF0000]46 行[/color][/size]rnrnrn[img=https://img-bbs.csdn.net/upload/201404/16/1397620159_440996.jpg][/img]rnrnrn求 大神 解答。。。。rnrnrn实体类 是根据 查询的结果 自己封装的 一个尸体累
cannot be cast to java.util.Collection
[code=Java]package com.hollycrm.hollyv8.zsptest.zsp.service.impl;rnrnimport ...rnpublic class UserManagerServiceImpl implements UserManagerService rn private UserManagerDao userDao;rn rn public void setUserManagerDao(UserManagerDao userDao)rn rn this.userDao = userDao ;rn rn public UserManagerDao getUserManagerDao()rn rn return this.userDao ;rn rnrnrn public void addUser(UserInfo user) rnrn this.userDao.add(user) ;rnrn rnrn public void deleteUser(String account) rn // TODO Auto-generated method stubrn this.userDao.delete(account) ;rn rn public UserInfo getUser(String account) rn // TODO Auto-generated method stubrn return this.userDao.getUserInfo(account);rn rn public UserInfo getUser(String name, String account) rn // TODO Auto-generated method stubrn List list = this.userDao.getUserInfo(name, account);rn if(list != null&&list.size() > 0)rn return list.get(0);rn elsern return null;rn rn rn public List listUser() rn // TODO Auto-generated method stubrn return this.userDao.getUserInfos();rn rn public void saveOrUpdate(UserInfo user) rn // TODO Auto-generated method stubrn this.userDao.saveOrUpdate(user);rn rn public UserInfo query() rn return this.userDao.query();rn rnrn[/code]rnrnrn[code=Java]com.hollycrm.hollyv8.zsptest.zsp.service.impl.UserManagerServiceImpl cannot be cast to java.util.Collection [/code]rnrnrn大家帮我看看这是怎么回事?
org.apache.struts.action.DynaActionForm cannot be cast to org.apache.struts.validator.DynaValidatorForm
org.apache.struts.action.DynaActionForm cannot be cast to org.apache.struts.validator.DynaValidatorFormrn有谁知道是什么问题吗???
testjpa.book.WebBookstoreBooks cannot be cast to testjpa.book.WebBookstoreBooks
List list = bw1.findAll(); rnfor (int i = 0; i < list.size(); i++) rn list.get(i).getBookId(); rn rnrn错误行:list.get(i).getBookId(); rnrn错误信息:testjpa.book.WebBookstoreBooks cannot be cast to testjpa.book.WebBookstoreBooks rnrnbw1.findAll()返回类型List rnrn我感觉是:spring和jpa整合的问题,但不知道怎么改,请教各位,谢谢
java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
在网上找了一个hibernate通用dao泛型接口代码:rnpublic interface GenericDao rn void create(T entity);rnrn void delete(T entity);rnrnrn实现类:rnpackage com.dao;rnrnimport java.io.Serializable;rnimport java.lang.reflect.ParameterizedType;rnimport java.util.List;rnimport org.hibernate.criterion.Projections;rnimport org.springframework.orm.hibernate3.support.HibernateDaoSupport;rnrnpublic class GenericHibernateDaoImpl extends HibernateDaoSupport implementsrn GenericDao rn private Class clazz;rnrn @SuppressWarnings("unchecked")rn public GenericHibernateDaoImpl() rn // 通过反射获取T的类型信息实例rn this.clazz = (Class) ((ParameterizedType) this.getClass()rn .getGenericSuperclassrnrn ()).getActualTypeArguments()[0];rn rnrn public void create(T entity) rnrn super.getSession().save(entity);rnrn rnrn public void delete(T entity) rn super.getSession().delete(entity);rn .....rn结果启动tomcat服务器的时候报java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType错误,什么问题?求解决。。。。。
flex.messaging.io.amf.ASObject cannot be cast to错误。。。
情况是这样的。。rnFlex 前台rn有个两AS类 Group 和 UserrnGroup 类里有个ArrayCollectionrnrnjava 后台rn对应的两个JPA实体类 Group 和 UserrnrnGroup里设置了 @OneToMany(fetch=FetchType.EAGER) rn这样,我在前台查询的时候, 后台程序会把User一起查询出来返送给前台,映射成为Flex的ArrayCollection(_acDP) 然后把这个 ArrayCollection做为DATAGRID的数据源。rnrn当选中某一记录进行修改的时候rnrn_acDP[dg.selectedIndex] as Group ; //这样Group 里就包含了一个 子ArrayCollection ,里面是属于该Group的User信息。rnrn然后把这个修改过的 Group对象发送至Java后台,进行保存,这时候就出现了这个错误。。。rnrnflex.messaging.io.amf.ASObject cannot be cast to...rnrn好像是因为Group里面的User信息,只是一个ArrayCollection ,没法转换成java的 User类。。rn这个具体该怎么做rnrn求教。。。。
java.lang.Integer cannot be cast to
public List findAllMaterialsByAppid(Integer appid) rn String hql1 = "select medid from Materials where appid = ? and pid = 0";rn List list = this.hibernateTemplate.find(hql1, appid);rn if (list != null && list.size() > 0) rn if(list.get(0).getMedid() != null)rn Integer medid = (Integer)list.get(0).getMedid();rn String hql2 = "from Materials where appid = ? and pid = ?";rn return this.hibernateTemplate.find(hql2, appid, medid);rn rnrnrn请教一下大家
java.lang.String cannot be cast to com.yxq.value.NameSingle
NameSingle tempuser=(NameSingle)temp.elementAt(i);报错rnjava.lang.String cannot be cast to com.yxq.value.NameSinglernrn[color=#FF0000]NameSingle.java[/color]package com.yxq.value;rnrnpublic class NameSingle rnpublic String name;rnrnrn
java.util.ArrayList cannot be cast to java.lang.String
小弟初学struts2,很多地方都不明白,遇到了很多问题,麻烦帅哥,美女,解决下!谢谢!rn从数据库里获得list (包括ID(自增),姓名,年龄)rn在strut2写的JSP里用iterator将list遍历输出rnrn下面是Actionrn[code=Java]rnpublic class UserAction extends ActionSupport rn private String name;//姓名rn private int age;//年龄rn private UserDao userdao;rn List list=new ArrayList();//获得数据库里所有的用户集合rn //下面是getter setter 方法rn public UserDao getUserdao() rn return userdao;rn rnrn public void setUserdao(UserDao userdao) rn this.userdao = userdao;rn rnrn public List getList() rn return list;rn rnrn public void setList(List list) rn this.list = list;rn rnrn public String getName() rn return name;rn rnrn public void setName(String name) rn this.name = name;rn rnrn public int getAge() rn return age;rn rnrn public void setAge(int age) rn this.age = age;rn rnrn //JSP页面里调用的action方法,从数据库中获得用户列表(ID(自增),姓名,年龄)rn public List listUser()rn list= userdao.list();rn return getList();rn rnrnrnrn[/code]rnrn这个是JSP页面rn[code=Java]rnrnrn rn rn rn rn rn rnrnrn[/code]rnrnrn运行时,就报错了。下面是错误信息rn[code=Java]rnrnjava.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Stringrn com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)rn com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)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:236)rn com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)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:236)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:236)rn com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)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:236)rn com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)rn org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)rn org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)rnrnrn[/code]rnrnrn请教大虾们,帮帮忙,谢谢!
cannot be cast to org.apache.struts.action.Action 什么问题??
formrn[code=java]rnpackage com.yourcompany.struts;rnrnimport java.io.Serializable;rnrnimport org.apache.struts.action.ActionForm;rnrn/*rn * 存放用户提交信息rn */rnpublic class LoginForm extends ActionForm implements Serializable rn private static final long serialVersionUID = 1L;rn private String username, password;rnrn public String getUsername() rn return username;rn rnrn public void setUsername(String username) rn this.username = username;rn rnrn public String getPassword() rn return password;rn rnrn public void setPassword(String password) rn this.password = password;rn rnrnrn[/code]rnrnactionrn[code=java]package com.yourcompany.struts;rnrnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnrnimport org.apache.struts.action.Action;rnimport org.apache.struts.action.ActionForm;rnimport org.apache.struts.action.ActionForward;rnimport org.apache.struts.action.ActionMapping;rnimport com.yourcompany.struts.LoginForm;rnrn/**rn * 控制转向,处理用户登录事件rn * rn * @author smaltrn * rn */rnpublic class LoginAction extends Action rn public ActionForward execute(ActionMapping mapping, ActionForm form,rn HttpServletRequest req, HttpServletResponse res) rn // 获取表单对象rn LoginForm loginform = (LoginForm) form;rn String username = loginform.getUsername();rn String password = loginform.getPassword();rnrn if (username.equals("123") && password.equals("123")) rn System.out.println("验证success");rn return new ActionForward("/pages/success.jsp");rn else rn System.out.println("验证fail");rn return new ActionForward("/pages/fail.jsp");rn rn rnrn[/code]rnrnstruts:rn[code=text]rnrnrnrn rn rn rn rn rn rn rn rnrn rn rn rnrnrn[/code]rnrnweb.xmlrn[code=text]rnrnrn rnrn actionrnrn rn org.apache.struts.action.ActionServletrn rnrn rnrn configrnrn /WEB-INF/struts-config.xmlrnrn rnrn rnrn debugrnrn 3rnrn rnrn rnrn detailrnrn 3rnrn rnrn 0rnrn rnrn rnrn actionrnrn *.dornrn rnrnrn rn index.jsprn rnrnrn[/code]
ImageSwitcher cannot be cast to Button_ClassCastException
rnrn rnrn rnrn rnrnrnrnprivate Button button1, button2;rn private ImageSwitcher imageSwitcher;rn private int index = 0;rn private int[] imageId = new int[] R.drawable.landscape1,rn R.drawable.landscape2, R.drawable.landscape3,rn R.drawable.landscape4, R.drawable.landscape5,rn R.drawable.landscape6, R.drawable.landscape7 ;rnrn @Overridern protected void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.activity_main);rn rn button1 = (Button) findViewById(R.id.button1);rn button2 = (Button) findViewById(R.id.button2);rn imageSwitcher = (ImageSwitcher) this.findViewById(R.id.imageSwitcher);rn imageSwitcher.setFactory(this);rn rn button1.setOnClickListener(this);rn button2.setOnClickListener(this);rn imageSwitcher.setImageResource(imageId[index]);rn rnrn public void onClick(View v) rn switch(v.getId()) rn case R.id.button1:rn index--;rn if (index < 0) rn index = imageId.length - 1;rn rn imageSwitcher.setImageResource(imageId[index]);rn Toast.makeText(MainActivity.this, "第" + (index + 1) + "张", 1).show();rn break;rn case R.id.button2:rn index++;rn if (index >= imageId.length) rn index = 0;rn rn imageSwitcher.setImageResource(imageId[index]);rn Toast.makeText(MainActivity.this, "第" + (index + 1) + "张", 1).show();rn break;rn rn rnrn public View makeView() rn ImageView imageView = new ImageView(MainActivity.this);rn imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);rn imageView.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));rn return imageView ;rn rnrnrn实现的是通过两个按钮来前后查看图片, 用的是ImageSwitcher rn可是在xml文件中, 如果把ImageSwitcher标签放在Button上面就会报错如下图rn[img=https://img-bbs.csdn.net/upload/201511/09/1447063525_88303.png][/img]rnImageSwitcher cannot be cast to Button_ClassCastException 但是如果像上面xml文件中放置就可以正常运行,大神们知道这是为什么吗?rnrnrnrnrn
org.apache.ibatis.executor.ExecutionPlaceholder cannot be cast to java.util.List
今天在做分页搜索的时候,出现的问题。谷歌上也搜不到什么。公司的项目是struts2+mybatis。我把代码和错误信息都贴上来,各位大神给我看看rnrn[img=https://img-bbs.csdn.net/upload/201409/25/1411614290_919820.png][/img]rnrn这是action中的代码,错误报在第115行。rnrnrn[img=https://img-bbs.csdn.net/upload/201409/25/1411614337_957864.png][/img]rnrn这是相应的数据层的代码,错误就出在第120行。第117行是计算符合条件的数据量有多少;第119行是把所有搜索条件清空了,所以第120行就是计算数据总量有多少。rnrn[img=https://img-bbs.csdn.net/upload/201409/25/1411614574_623873.png][/img]rnrn这就是第二张图片中,第120行在xml文件中的对应的sql语句。图片不是很清晰(将就一下)。上面说过由于搜索条件被清空了,所以这里的条件之后的代码其实都是没用上的rnrnrn下面就是错误信息 非常的长 我全部都贴出来rnrnrnrn
java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcResultSet cannot be cast to
java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcResultSet cannot be cast to java.lang.Stringrn org.apache.jsp.updateSpecial_005fnew_jsp._jspService(updateSpecial_005fnew_jsp.java:93)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rnrnrn问题代码:rn[code=Java]rn<%rn ArrayList list=new ArrayList();rn rn list=(ArrayList)(session.getAttribute("al"));rn rn rn rn String slID=(String)list.get(0);rn String slName=(String)list.get(1);rn String slIssueDate=(String)list.get(2);rn String slImages=(String)list.get(3);rn String slDescription=(String)list.get(4);rn String slVotes=(String)list.get(5);rn String singerID=(String)list.get(6);rnrn rn rn %>rnrnrnrn[/code]rn我其实不是想用循环取出来,因为这样只有一个变量,我的目的是获取INDEX,然后再用<%=>符号传到一个INPUT里去,不过有好方法也可以告诉我哦!!谢谢各位!@!!
相关热词 c# 去空格去转义符 c#用户登录窗体代码 c# 流 c# linux 可视化 c# mvc 返回图片 c# 像素空间 c# 日期 最后一天 c#字典序排序 c# 截屏取色 c#中的哪些属于托管机制

相似问题

7
jsp访问报错HTTP Status 500
3
项目中引入螺丝帽短信发送接口时报错怎么解决
0
hadoop启动后nodemanager无效,日志记录javax.activation.DataSource是怎么回事?
1
The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path
3
intellij idea导入eclipse创建的maven web项目 jar包导入总是报错
1
Maven工程异常:SpringServletContainerInitializer cannot be cast to ServletContainerInitializer
3
java filter 字符过滤功能:java.lang.NoClassDefFoundError.
3
java.lang.NullPointerException希望各位大佬帮帮忙,找了半天真的不晓得咋弄了
2
使用数据库进行添加数据库信息不行!!!有诶有大神
0
eclipse设计系统,连接了数据库,可是浏览器打开系统却是一堆乱码,求大神帮忙解决
1
生成二维码一直报找不到EncodeHintType类
1
cxf动态调用webservice报错 Caused by: javax.xml.bind.UnmarshalException
1
org.beetl.core.cache.LocalCache cannot be cast to org.beetl.core.cache.Cache
0
JSP2自定义标签报cannot be resolved to a type问题
2
javamail 接收邮件,总是报javax.mail.NoSuchProviderException: invalid provider
1
一个简单的jsp页面链接数据库遇到的服务器内部错误,初学者提问,帮帮忙呀?
2
请问这是什么原因,是关于servlet的包没有导入啥的吗?
5
本地项目能在eclipse里跑,不能在idea里跑
4
使用配置文件连接jdb连接池时出现问题
1
怎么将注解设置成@WebServlet(name= "IndexServlet")