Getting ClassCastException while accessing ServletRequest object.

Hi,
I am using weblogic 8.1 sp4 and I am trying to deploy a JSF portal application. When I try to access ServletRequest object, it throws a ClassCastException.
code snippet -
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
ServletRequest servletRequest = (ServletRequest)externalContext.getRequest(); // Throws error at this point.
It works fine if I use PortletRequest instead of ServletRequest. But I am trying to make it independent of portal API. Is there any way by which I can access servletRequest object?
If I run this application outside portal environment(i.e. only on JSF fraemwork), it works fine.
Here is the error i get in my browser -
javax.portlet.PortletException: Error Invoking Method '#{ValidateServlet.Validate}' : java.lang.ClassCastException at com.sun.faces.portlet.FacesPortlet.processAction(FacesPortlet.java:236) at com.bea.portlet.container.PortletStub.processAction(PortletStub.java:277) at com.bea.portlet.container.AppContainer.invokeProcessAction(AppContainer.java:428) at com.bea.netuix.servlets.controls.content.JavaPortletContent.fireProcessAction(JavaPortletContent.java:202) at com.bea.netuix.servlets.controls.portlet.JavaPortlet.fireProcessAction(JavaPortlet.java:1091) at com.bea.netuix.servlets.controls.portlet.JavaPortlet.raiseChangeEvents(JavaPortlet.java:566) at com.bea.netuix.nf.ControlLifecycle$4.postVisitRoot(ControlLifecycle.java:298) at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:315) at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:127) at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:106) at com.bea.netuix.nf.Lifecycle.runInbound(Lifecycle.java:173) at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:137) at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:321) at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:184) at com.bea.netuix.servlets.manager.PortalServlet.doPost(PortalServlet.java:767) at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:138) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.bea.p13n.servlets.PortalServletFilter.doFilter(PortalServletFilter.java:293) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6724) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178) Caused by: javax.faces.el.EvaluationException: Error Invoking Method '#{ValidateServletJ.Validate}' : java.lang.ClassCastException at com.sun.faces.el.MethodBindingImpl.rethrow(MethodBindingImpl.java:109) at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:101) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72) at javax.faces.component.UICommand.broadcast(UICommand.java:312) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381) at com.sun.faces.portlet.LifecycleImpl$InvokeApplicationPhase.execute(LifecycleImpl.java:524) at com.sun.faces.portlet.LifecycleImpl.phase(LifecycleImpl.java:246) at com.sun.faces.portlet.LifecycleImpl.execute(LifecycleImpl.java:156) at com.sun.faces.portlet.FacesPortlet.processAction(FacesPortlet.java:222) ... 29 more Caused by: java.lang.ClassCastException at work.ValidateServletJ.Validate(ValidateServletJ.java:46) 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:324) at com.sun.faces.el.impl.MethodInvokeVisitor.handleMethod(MethodInvokeVisitor.java:44) at com.sun.faces.el.impl.MethodAbstractVisitor.visit(MethodAbstractVisitor.java:354) at com.sun.faces.el.impl.AstValue.jjtAccept(AstValue.java:16) at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:93) ... 37 more Nested Exception is javax.faces.el.EvaluationException: Error Invoking Method '#{ValidateServletJ.Validate}' : java.lang.ClassCastException at com.sun.faces.el.MethodBindingImpl.rethrow(MethodBindingImpl.java:109) at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:101) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72) at javax.faces.component.UICommand.broadcast(UICommand.java:312) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381) at com.sun.faces.portlet.LifecycleImpl$InvokeApplicationPhase.execute(LifecycleImpl.java:524) at com.sun.faces.portlet.LifecycleImpl.phase(LifecycleImpl.java:246) at com.sun.faces.portlet.LifecycleImpl.execute(LifecycleImpl.java:156) at com.sun.faces.portlet.FacesPortlet.processAction(FacesPortlet.java:222) at com.bea.portlet.container.PortletStub.processAction(PortletStub.java:277) at com.bea.portlet.container.AppContainer.invokeProcessAction(AppContainer.java:428) at com.bea.netuix.servlets.controls.content.JavaPortletContent.fireProcessAction(JavaPortletContent.java:202) at com.bea.netuix.servlets.controls.portlet.JavaPortlet.fireProcessAction(JavaPortlet.java:1091) at com.bea.netuix.servlets.controls.portlet.JavaPortlet.raiseChangeEvents(JavaPortlet.java:566) at com.bea.netuix.nf.ControlLifecycle$4.postVisitRoot(ControlLifecycle.java:298) at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:315) at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:127) at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:106) at com.bea.netuix.nf.Lifecycle.runInbound(Lifecycle.java:173) at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:137) at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:321) at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:184) at com.bea.netuix.servlets.manager.PortalServlet.doPost(PortalServlet.java:767) at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:138) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.bea.p13n.servlets.PortalServletFilter.doFilter(PortalServletFilter.java:293) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6724) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178) Caused by: java.lang.ClassCastException at work.ValidateServletJ.Validate(ValidateServletJ.java:46) 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:324) at com.sun.faces.el.impl.MethodInvokeVisitor.handleMethod(MethodInvokeVisitor.java:44) at com.sun.faces.el.impl.MethodAbstractVisitor.visit(MethodAbstractVisitor.java:354) at com.sun.faces.el.impl.AstValue.jjtAccept(AstValue.java:16) at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:93) ... 37 more
Any pointers will be greatly appreciated.
Thanks
Kunal

Kunal,
A PortletRequest/RenderRequest is not a ServletRequest - the two are not the same and don't share a common superclass or interface other than java.lang.Object. So simple casting like you're doing won't work.
Are you trying to call a method that is only found on ServletRequest and not on PortletRequest/RenderRequest. If so, you're out of luck. You don't have a ServletRequest object inside the portal, so you can't call methods that aren't on the RenderResponse object.
If the method(s) you're calling are common to both classes then you can use reflection to access the desired methods and avoid a CCE. A good pattern for this type of situation is "Duck Typing" - a description of Duck Typing in Java can be found here:
http://www.coconut-palm-software.com/the_visual_editor/?p=25
Hope that's helpful.
Regards,
Peter

Similar Messages

  • JSF portal - Getting ClassCastException while accessing ServletRequest obj.

    Hi,
    I am using weblogic 8.1 sp4 and I am trying to deploy a JSF portal application. When I try to access ServletRequest object, it throws a ClassCastException.
    code snippet -
    ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
    ServletRequest servletRequest = (ServletRequest)externalContext.getRequest(); // Throws error at this point.
    It works fine if I use PortletRequest instead of ServletRequest. But I am trying to make it independent of portal API. Is there any way by which I can access servletRequest object?
    If I run this application outside portal environment(i.e. only on JSF fraemwork), it works fine.
    Here is the error i get in my browser -
    javax.portlet.PortletException: Error Invoking Method '#{ValidateServletJ.Validate}' : java.lang.ClassCastException at com.sun.faces.portlet.FacesPortlet.processAction(FacesPortlet.java:236) at com.bea.portlet.container.PortletStub.processAction(PortletStub.java:277) at com.bea.portlet.container.AppContainer.invokeProcessAction(AppContainer.java:428) at com.bea.netuix.servlets.controls.content.JavaPortletContent.fireProcessAction(JavaPortletContent.java:202) at com.bea.netuix.servlets.controls.portlet.JavaPortlet.fireProcessAction(JavaPortlet.java:1091) at com.bea.netuix.servlets.controls.portlet.JavaPortlet.raiseChangeEvents(JavaPortlet.java:566) at com.bea.netuix.nf.ControlLifecycle$4.postVisitRoot(ControlLifecycle.java:298) at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:315) at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:127) at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:106) at com.bea.netuix.nf.Lifecycle.runInbound(Lifecycle.java:173) at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:137) at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:321) at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:184) at com.bea.netuix.servlets.manager.PortalServlet.doPost(PortalServlet.java:767) at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:138) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.bea.p13n.servlets.PortalServletFilter.doFilter(PortalServletFilter.java:293) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6724) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178) Caused by: javax.faces.el.EvaluationException: Error Invoking Method '#{ValidateServletJ.Validate}' : java.lang.ClassCastException at com.sun.faces.el.MethodBindingImpl.rethrow(MethodBindingImpl.java:109) at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:101) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72) at javax.faces.component.UICommand.broadcast(UICommand.java:312) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381) at com.sun.faces.portlet.LifecycleImpl$InvokeApplicationPhase.execute(LifecycleImpl.java:524) at com.sun.faces.portlet.LifecycleImpl.phase(LifecycleImpl.java:246) at com.sun.faces.portlet.LifecycleImpl.execute(LifecycleImpl.java:156) at com.sun.faces.portlet.FacesPortlet.processAction(FacesPortlet.java:222) ... 29 more Caused by: java.lang.ClassCastException at work.ValidateServletJ.Validate(ValidateServletJ.java:46) 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:324) at com.sun.faces.el.impl.MethodInvokeVisitor.handleMethod(MethodInvokeVisitor.java:44) at com.sun.faces.el.impl.MethodAbstractVisitor.visit(MethodAbstractVisitor.java:354) at com.sun.faces.el.impl.AstValue.jjtAccept(AstValue.java:16) at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:93) ... 37 more Nested Exception is javax.faces.el.EvaluationException: Error Invoking Method '#{ValidateServletJ.Validate}' : java.lang.ClassCastException at com.sun.faces.el.MethodBindingImpl.rethrow(MethodBindingImpl.java:109) at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:101) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72) at javax.faces.component.UICommand.broadcast(UICommand.java:312) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381) at com.sun.faces.portlet.LifecycleImpl$InvokeApplicationPhase.execute(LifecycleImpl.java:524) at com.sun.faces.portlet.LifecycleImpl.phase(LifecycleImpl.java:246) at com.sun.faces.portlet.LifecycleImpl.execute(LifecycleImpl.java:156) at com.sun.faces.portlet.FacesPortlet.processAction(FacesPortlet.java:222) at com.bea.portlet.container.PortletStub.processAction(PortletStub.java:277) at com.bea.portlet.container.AppContainer.invokeProcessAction(AppContainer.java:428) at com.bea.netuix.servlets.controls.content.JavaPortletContent.fireProcessAction(JavaPortletContent.java:202) at com.bea.netuix.servlets.controls.portlet.JavaPortlet.fireProcessAction(JavaPortlet.java:1091) at com.bea.netuix.servlets.controls.portlet.JavaPortlet.raiseChangeEvents(JavaPortlet.java:566) at com.bea.netuix.nf.ControlLifecycle$4.postVisitRoot(ControlLifecycle.java:298) at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:315) at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:127) at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:106) at com.bea.netuix.nf.Lifecycle.runInbound(Lifecycle.java:173) at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:137) at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:321) at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:184) at com.bea.netuix.servlets.manager.PortalServlet.doPost(PortalServlet.java:767) at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:138) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.bea.p13n.servlets.PortalServletFilter.doFilter(PortalServletFilter.java:293) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6724) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178) Caused by: java.lang.ClassCastException at work.ValidateServletJ.Validate(ValidateServletJ.java:46) 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:324) at com.sun.faces.el.impl.MethodInvokeVisitor.handleMethod(MethodInvokeVisitor.java:44) at com.sun.faces.el.impl.MethodAbstractVisitor.visit(MethodAbstractVisitor.java:354) at com.sun.faces.el.impl.AstValue.jjtAccept(AstValue.java:16) at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:93) ... 37 more
    Any help?
    Thanks
    Kunal

    Kunal,
    A PortletRequest/RenderRequest is not a ServletRequest - the two are not the same and don't share a common superclass or interface other than java.lang.Object. So simple casting like you're doing won't work.
    Are you trying to call a method that is only found on ServletRequest and not on PortletRequest/RenderRequest. If so, you're out of luck. You don't have a ServletRequest object inside the portal, so you can't call methods that aren't on the RenderResponse object.
    If the method(s) you're calling are common to both classes then you can use reflection to access the desired methods and avoid a CCE. A good pattern for this type of situation is "Duck Typing" - a description of Duck Typing in Java can be found here:
    http://www.coconut-palm-software.com/the_visual_editor/?p=25
    Hope that's helpful.
    Regards,
    Peter

  • Getting ClassCastException when accessing Blob object

    I am using weblogic 5.1 with service pack 10.
    I need to query pdf data stored in a blob field in Oracle
    8.1.6 server. The native code c:\weblogic\bin\oci816_8
    is part of the path. When I query the database with
    Oracle 8 client, I can get data.
    driver: weblogic.jdbc20.oci.Driver
    url: jdbc20:weblogic:oracle:mydb
    What I have done is to get the blob object with:
    Blob blob = rs.getBlob(5);
    long len = blob.length();
    But when I call the blob.length();
    I got the a ClassCastException. I really appreicate
    your comment.
    The exception message is:
    ====================================================
    java.lang.ClassCastException: java.lang.String
    at weblogic.jdbc20.oci.Blob.length(Blob.java:75)
    at com.agf.profile.ProfileServlet.doProcess(ProfileServlet.java:126)
    at com.agf.profile.ProfileServlet.doGet(ProfileServlet.java:37)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletSt
    pl.java:120)
    at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Servle
    textImpl.java:922)
    at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Servle
    textImpl.java:886)
    at weblogic.servlet.internal.ServletContextManager.invokeServlet(Ser
    ContextManager.java:269)
    at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP
    a:380)
    at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
    ====================================================
    Thanks,
    Jian

    hi jian,
    it seems you are trying to access a column as a blob type when the data in
    that column is not blob.
    Make sure that your column number 5 is defined as Blob in the database.
    I tried the following code and it worked fine for me.
    Blob b=rs.getBlob("data");
    long l=b.length();
    byte bt[]=b.getBytes(1,(int)b.length());
    File f=new
    File("d:\\bea\\wlserver6.1\\config\\jdbcdomain\\applications\\defaultwebapp\
    \blob_new.pdf");
    FileOutputStream fos=new FileOutputStream(f);
    fos.write(bt);
    fos.close();
    It was able to create the file blob_new.pdf
    But when I tried the following code it gave me the same exception as you are
    getting
    Blob bb=rs.getBlob("id");
    long ll=bb.length();
    Where id is a column in the database of varchar type
    I am using the following settings
    driver: weblogic.jdbc.oci.Driver
    url: jdbc:weblogic:oracle
    i am using wl 6.1 and oracle 8
    Hope this helps you.
    johnny
    "jian zhang" <[email protected]> wrote in message
    news:[email protected]...
    >
    I am using weblogic 5.1 with service pack 10.
    I need to query pdf data stored in a blob field in Oracle
    8.1.6 server. The native code c:\weblogic\bin\oci816_8
    is part of the path. When I query the database with
    Oracle 8 client, I can get data.
    driver: weblogic.jdbc20.oci.Driver
    url: jdbc20:weblogic:oracle:mydb
    What I have done is to get the blob object with:
    Blob blob = rs.getBlob(5);
    long len = blob.length();
    But when I call the blob.length();
    I got the a ClassCastException. I really appreicate
    your comment.
    The exception message is:
    ====================================================
    java.lang.ClassCastException: java.lang.String
    at weblogic.jdbc20.oci.Blob.length(Blob.java:75)
    atcom.agf.profile.ProfileServlet.doProcess(ProfileServlet.java:126)
    at com.agf.profile.ProfileServlet.doGet(ProfileServlet.java:37)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletSt
    pl.java:120)
    atweblogic.servlet.internal.ServletContextImpl.invokeServlet(Servle
    textImpl.java:922)
    atweblogic.servlet.internal.ServletContextImpl.invokeServlet(Servle
    textImpl.java:886)
    atweblogic.servlet.internal.ServletContextManager.invokeServlet(Ser
    ContextManager.java:269)
    atweblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP
    a:380)
    atweblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:
    >
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
    ====================================================
    Thanks,
    Jian

  • Getting Error while accessing the data using odata service

    Hi All,
    Iam new to SAP FIORI. 
    Iam getting the below error while accessing the data using odata service.
    "Failed to load resource: the server responded with a status of 404 (Not found)"
    "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin "
    i have tried all the solutions like changing the url pattern "proxy/htttp".
    and disabled - security in chrome (Chrome is Updated version).
    i tried with IE still got the same problem.
    And installed all the required software in eclipse
    While installing GWPA plugin i got the following error.
    let me know if any one have idea.
    Thanks in advance.

    > Do you want to add and/or update the data in the already existing tables or do you want to replace the content completely?
    >
    > so in that way :
    > bot the options are fine what ever take less time.
    Sorry mate, but YOU have to know what you want here.
    I gave you an easy to follow set of steps.
    As you don't seam to mind the outcome, just might just use them...
    > I wanted to know weathe i can use the  loadercli for thie export import or not? if yes then is there any new steps to do before i do the export import?
    We had this discussion before...
    >
    > For that the easiest option would be just to drop the tables of SAPR3 and run the import again.
    >
    > For ease of use you could also just do:
    > - logon as superdba
    > - drop user SAPR3
    > - create user SAPR3 password SOMEPW not exclusive dba
    >
    > After these steps you can easily pump the data into the database again.
    >
    > So here in th above given steps , i am creating a new SAPR3 user and why it is not exclusive dba ?
    >  i already have that user SAPR3 can i use the same.
    Yes, you do have the SAPR3 user.
    But you don't seem to like to read documentation or learn about how the tools work or anything like that.
    Therefore I gave you s simple way to reach your goal.
    Of course it's possible to reuse the user.
    But then you would have to deal with already existing tables, already existing data etc.
    You don't seem to be able to do that. So, the easy steps might be better suited for your needs.
    regards,
    Lars

  • Getting Error While accessing Accounts from oim

    Hi All,
    I am getting an exception while accessing user accounts from oim through the jdeveloper(I m giving UserId as input)
    Exception:
    avax.ejb.EJBAccessException: [EJB:010160]Security Violation: User: '<anonymous>' has insufficient permission to access EJB: type=<ejb>, application=oim#11.1.2.0.0, module=iam-ejb.jar, ejb=ProvisioningService, method=getAccountsProvisionedToUserx, methodInterface=Remote, signature={java.lang.String,java.lang.String}.
         at weblogic.ejb.container.internal.MethodDescriptor.checkMethodPermissionsBusiness(MethodDescriptor.java:581)
         at weblogic.ejb.container.internal.BaseRemoteObject.checkMethodPermissions(BaseRemoteObject.java:111)
         at weblogic.ejb.container.internal.BaseRemoteObject.preInvoke(BaseRemoteObject.java:274)
         at weblogic.ejb.container.internal.StatelessRemoteObject.__WL_preInvoke(StatelessRemoteObject.java:41)
         at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:24)
         at oracle.iam.provisioning.api.ProvisioningService_p7m7x_ProvisioningServiceRemoteImpl.getAccountsProvisionedToUserx(Unknown Source)
         at oracle.iam.provisioning.api.ProvisioningService_p7m7x_ProvisioningServiceRemoteImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:667)
         at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:522)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:518)
         at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    Process exited with exit code 0.

    Which user are you using for creating connection with OIM ?
    Which method are you using to create connection with OIM ?
    Re: OIMClient login throwing AuthenticationException execption (FOR R2)

  • Getting ClassCastException while calling a method in webservice

    I wrote small webservice using axis. It is returning array of object(of xyz type) where an object is a Value object.
    I created stubs and place at client side as a jar file. xyz.class is also there in stubs list.
    While calling that webservice im getting the following exception.can u please help me on this?
    The code is:
    xyz[] so     =     lmsDel.getNumber();
    AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: java.lang.ClassCastException: [Ljava.lang.Object;
    faultActor:
    faultNode:
    faultDetail:
    {http://xml.apache.org/axis/}hostname:evoke12
    java.lang.ClassCastException: [Ljava.lang.Object;
    at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder
    .java:222)
    at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.
    java:129)
    at org.apache.axis.encoding.DeserializationContext.endElement(Deserializ
    ationContext.java:1087)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endEleme
    nt(AbstractSAXParser.java:633)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scan
    EndElement(XMLNSDocumentScannerImpl.java:719)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
    l$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
    l.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
    ML11Configuration.java:834)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
    ML11Configuration.java:764)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.
    java:148)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Ab
    stractSAXParser.java:1242)
    at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:133)
    at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:153)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
    at org.apache.axis.encoding.DeserializationContext.parse(Deserialization
    Context.java:227)
    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
    at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
    at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnders
    tandChecker.java:62)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    at org.apache.axis.client.Call.invoke(Call.java:2767)
    at org.apache.axis.client.Call.invoke(Call.java:2443)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at com.cscinfo.webservice.client.LmsServiceSoapBindingStub.getSOPCountBy
    NatureOfCase(Unknown Source)
    at com.cscinfo.cscglobal.web.action.EnterCSCGlobalAction.execute(EnterCS
    CGlobalAction.java:68)
    at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
    tProcessor.java:421)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
    va:226)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:116
    4)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
    (StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
    tyHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
    a:283)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
    va:42)
    at com.cj.trim.trimFilter.doFilter(Unknown Source)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
    va:42)
    at weblogicx.servlet.gzip.filter.GZIPFilter.doFilter(GZIPFilter.java:70)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
    va:42)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:3229)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
    dSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
    121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
    ervletContext.java:2002)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
    ontext.java:1908)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
    ava:1362)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
    Edited by: avn_venki on Jan 30, 2008 1:17 AM

    Delegate definition:
    public xyz[] getCount(String accessType,long orgId,Date fromDate,Date toDate)
              return lmsServiceImpl.getCount(accessType,orgId,fromDate,toDate);
    Calling code in client:
    xyz[] so     =     lmsDel.getCount("group",l,calendar,calendar);
    Do i need to add anything to the wsdd file for the xyz bean type??

  • Getting Error while creating Document object  after  parsing XML String

    Hi All,
    I have been trying to parse an XML string using the StringReader and InputSource interface but when I am trying to create Document Object using Parse() method getting error like
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    Please find the code below which i have been experimenting with:
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.StringReader;
    import java.util.List;
    import java.util.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import java.io.*;
    public class TestMain {
         public static void main(String[] args) {
              String file = "";
              file = loadFileContent("C:\\Test.xml");
              System.out.println("contents >> "+file);
              parseQuickLinksFileContent(file);
    public static void parseQuickLinksFileContent(String fileContents) {
    PWMQuickLinksModelVO objPWMQuickLinksModelVO = new PWMQuickLinksModelVO();
         try {
    DocumentBuilderFactory factory =           DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         StringReader objRd = new StringReader(fileContents);
         InputSource objIs = new InputSource(objRd);
         Document document = builder.parse(objIs); // HERE I am getting Error.
         System.out.println(document.toString());
    What is happening while I am using builder.parse() method ???
    Thanks,
    Rajendra.

    Getting following error
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.

  • Getting error while accessing view

    Getting following error message while trying to access a view (Database Version 9.2.0.4) through JDeveloper preview version 10.1.3. Accessing the same view through different client tool (DBDevPartner) is occurring without error.
    The error its throwing are:
    ORA-01874: time zone hours must be between -12 and 13
    ORA-02063: preceding line from CDFTS_SYSADM_DBL
    Any insight?

    Hi,
    According to the documentation for error ORA-01874,it says:
    Cause: The time zone hour specified was not in the valid range.
    Action: Specify a time zone hour between -12 and 13.
    How was this View initially created?
    Can you access this View using SQL*Plus?
    Can you post the SQL for the View?
    Regards,
    Lisa Sherriff
    JDev QA

  • Getting error while accessing the OAF forms in ADF page.

    Hi ,
    I am trying to get/access the Oracle forms on ADF page.
    I am following http://static.commit-consulting.com/oraformsfaces developers guide for guidlines.
    while runnign my page getting the error in popup look like java script error.
    the pop up contente is :
    Failed to execute java script
    Check for JavaScript errors, if the Forms server is running and if your browser can download a javaScript from http://bdc6oracle001.gdnindia.com:8005/forms/frmservlet?config=OraFormsFaces
    http://bdc6oracle001.gdnindia.com:8005/forms/frmservlet?config=OraFormsFaces is my server EBS server where oracle forms exist.
    Please help me on this.
    Thanks,
    MadhavaReddy

    You're probably better off asking the OraFormsFaces people for help

  • Getting Error while accessing End to end Monitoring.

    Hi,
    We are running XI 3.0 on MS SQL Server. While we hit END to END Monitoring Button we getting some error.
    Here the Error.
    Service cannot be reached
    What has happened?
    URL http://lax05sesd02:50000/sap/bc/bsp/sap/spi_monitor/monitor.do call was terminated because the corresponding service is not available.
    Note
    The termination occurred in system XID with error code 403 and for the reason Forbidden.
    The selected virtual host was 0 .
    What can I do?
    Please select a valid URL.
    If you do not yet have a user ID, contact your system administrator.
    ErrorCode:ICF-NF-http-c:000-u:SAPSYS-l:E-i:LAX05SESD02_XID_00-v:0-s:403-r:Forbidden
    HTTP 403 - Forbidden
    Your SAP Internet Communication Framework Team
    Please help us to solve this issue.

    Hi,
    We are running XI 3.0 on MS SQL Server. While we hit END to END Monitoring Button we getting some error.
    Here the Error.
    Service cannot be reached
    What has happened?
    URL http://lax05sesd02:50000/sap/bc/bsp/sap/spi_monitor/monitor.do call was terminated because the corresponding service is not available.
    Note
    The termination occurred in system XID with error code 403 and for the reason Forbidden.
    The selected virtual host was 0 .
    What can I do?
    Please select a valid URL.
    If you do not yet have a user ID, contact your system administrator.
    ErrorCode:ICF-NF-http-c:000-u:SAPSYS-l:E-i:LAX05SESD02_XID_00-v:0-s:403-r:Forbidden
    HTTP 403 - Forbidden
    Your SAP Internet Communication Framework Team
    Please help us to solve this issue.

  • Getting error while accessing a webpage by using link local address of ipv6

    Hello,
    I want to access my login.jsp by using ipv6 address.
    when i am accessing my web page by using loop back or localhost6(like the following) it is working.
    http://[::1]:8080/test/login.jsp //for loopback
    http://localhost6:8080/test/login.jsp
    But when i am accessing my webpage by using link local address as following i am not getting my web page.
    http://[fe80::201:6cff:fe0f:d7ae%eth0]:8080/test
    or
    http://[fe80::201:6cff:fe0f:d7ae]:8080/test
    For the above case is there any solutions????

    Whatever i have mentioned these are correct. My ipv6 address is also correct.From browser only i am accessing.>
    Not a Java issue, then. Your problem I'm afraid.
    But how do you know they're correct? Given that one of them isn't working, I'd triple check it if I were you.

  • Getting exception while accessing External WebServices from Portal Componen

    Hi,
    We are using one external Temperature WebService and calling it from the proxy which is called by a Portal Component. My proxy name is TempService and portal component name is TempComponent.While calling the web service from portal component we are getting the exception. When I checked with log file, I got that invokeMethod() is failing and following exception is occuring :
    Caused by: com.sap.engine.services.webservices.jaxm.soap.accessor.NestedSOAPException: IOError while working with the message. Check the nested Exception.
         at com.sapportals.portal.prt.service.soap.SOAPService.call(SOAPService.java:197)
         at com.sapportals.portal.prt.service.soap.PRTSOAPCall.invokeMethod(PRTSOAPCall.java:209)
         at com.sap.portal.tutorial.translation.TempService.getTemp(TempService.java:158)
         at com.sap.portal.tutorial.TempComponent.TempComponent.doContent(TempComponent.java:18)
    Can some one help us to resolve it.
    Thanks in advance,
    ajay

    As far as I know, webservices are working pretty well from SP2 Patch4. On patch3 hf2 I've had problems creating the proxy classes (especially for consuming .net webservices) and also gotten some runtime exception (cannot remember what they were).
    Suggest you open an OSS against SAP with your specific problem.

  • Getting Error While Extending View Object

    While I am Doing The VO Extention i am getting the fallowing error .......
    "each row inthe query result columns must be mapped to a unique query Attribute in the Mapped Entity Columns."
    Can Any body know what is this issue and can any body help me in this issue.

    Your Attribute Mappings look incorrect. Kindly try to recreate the VO again. After checking that the query is correct, navigate to the Attribute mapping in the VO wizard and confirm everything is okay.

  • Getting error while creating callable object

    Hi,
    I've created and deployed a DC using webdynpro.
    Now I want to create a callable object from portal
    I'm choosing the following options Guided Procedurers-->DesignTime>Create callable object-->userinterface>webdynprocomponent(GP interface)
    On entering the required data on the displayed page, when I'm clicking 'next' option it is giving <b>"500 internal server error"</b>.
    Can somebody help how to resolve this.
    Thanks
    Piyush

    your callable object component is missing. try to take preview of the iview and check.

  • Getting error while creating SPSite object in console application

    Hi,
    I am getting error "The Web application at
    http://myWebApp/sites/siteCol could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application." whenever
    I try to execute the below code in my console application.
    SPSite oSite = new SPSite("sitecolUrl");
    I tried to change the platform target to AnyCpu,
    I tried to wrap it with SP.RunWithElevatedPrivileges
    but all above didn't solve the error.
    Any suggestions?

    Hello,
    instead of targetting "any cpu" target x64 and be sure to target .net 3.5 (I made a post about it it could help you
    http://christopherclementen.wordpress.com/2012/03/02/windows-application-spsite-filenotfound/
    Best regards, Christopher.
    Blog |
    Mail
    Please remember to click "Mark As Answer" if a post solves your problem or
    "Vote As Helpful" if it was useful.
    Why mark as answer?

Maybe you are looking for