Type cast exception

Hi Guys,
I am pretty new at generics and have started reading all material available online. Shown below is the API that I am using
package api;
public interface CS<C extends MyConfig> extends S {
package api;
public interface MyConfig {
package api;
public interface MySession {     
     public <C extends MyConfig, T extends ResourceContainer<? extends C>>
     T createContainer(CS<C> aPredefinedConfig);
package api;
public interface NC extends ResourceContainer<NCC>  {
package api;
public interface NCC extends MyConfig {
package api;
import java.io.Serializable;
public interface ResourceContainer <T extends MyConfig> extends Serializable {
package api;
public interface S {
     public abstract boolean equals(Object other);
     public abstract int hashCode();
     public abstract String toString();
}And below is my implementation
package impl;
import api.NC;
public class NCImpl implements NC {
package impl;
import api.CS;
import api.MyConfig;
import api.MySession;
import api.ResourceContainer;
public class MySessionImpl implements MySession {
     public <C extends MyConfig, T extends ResourceContainer<? extends C>> T createContainer(
               CS<C> predefinedConfig) {
          NCImpl ncimpl = new NCImpl();
          return ncimpl; //Error Type mismatch: cannot convert from NCImpl to T
}As shown above I get error at line 'return ncimpl' But NCImpl implements the NC which extends ResourceContainer<NCC> so shouldn't it be capable of Type casting to T or I am missing something.
Thanks a lot for your response in advance

continuation of stack trace .................
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
/home/abhayani/workarea/eclipse/workspace/workspace-2.x/GenericsTest/impl/src/main/java/impl/MySessionImpl.java:[16,13] inconvertible types
found : impl.NCImpl
required: T
/home/abhayani/workarea/eclipse/workspace/workspace-2.x/GenericsTest/impl/src/main/java/impl/MySessionImpl.java:[16,13] inconvertible types
found : impl.NCImpl
required: T
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: Compilation failure
/home/abhayani/workarea/eclipse/workspace/workspace-2.x/GenericsTest/impl/src/main/java/impl/MySessionImpl.java:[16,13] inconvertible types
found : impl.NCImpl
required: T
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:579)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
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 org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
/home/abhayani/workarea/eclipse/workspace/workspace-2.x/GenericsTest/impl/src/main/java/impl/MySessionImpl.java:[16,13] inconvertible types
found : impl.NCImpl
required: T
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
... 16 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Thu Feb 12 10:39:43 IST 2009
[INFO] Final Memory: 14M/81M
[INFO] ------------------------------------------------------------------------
[abhayani@localhost GenericsTest]$

Similar Messages

  • Type Casting Exception

    I have an attribute CategoryId in my VO of type oracle.jbo.domain.Number. I am trying to use the expression of Boolean item in JHS as #{row.CategoryId != 4}
    Here is the generated JSF code:
                          <af:column id="s141NewItem3Col" noWrap="true" width="100"
                                     rowHeader="false">
                            <f:facet name="header">
                              <af:outputLabel value="CAtIDDeq4" showRequired="false"
                                              id="ol18"/>
                            </f:facet>
                            <af:inputText id="s141NewItem3"
                                          value="#{row.CategoryId != 4}"
                                          label="CAtIDDeq4" required="false"
                                          readOnly="#{((pageFlowScope.ContractRightCategoriesTable.newRow) and (!(jhsUserRoles['RM, ADMIN, AllButTitl, AllButAdmn']))) or ((!pageFlowScope.ContractRightCategoriesTable.newRow) and (!(jhsUserRoles['RM, ADMIN, AllButTitl, AllButAdmn'])))}"></af:inputText>
                          </af:column>I am getting the run time exception as "Can not convert 4 of type class oracle.jbo.domain.Number to class java.lang.Long"
    I am wondering how the row.CategoryId is treated as Long?. PLease advise. Also, will I be able to use type casting expressions in J Headstart/JSF Expression Language?
    Thanks, Pradeep

    I am trying to set disabled property of an item SubCategory dynamically based on CategoryId value. I guess the transient attribute will not work for newly created records as the transient attribute will be null for newly created records before save is performed. However, the expression #{row.bindings.CategoryId.attributeValue.value== 4 ? false : true} is working fine. row.bindings.CategoryId.attributeValue seem to be returning Long and, row.bindings.CategoryId.attributeValue.value might be returning a Number.

  • Type problem - Class Cast Exception - trying to understand

    hello,
    i get a Class cast exception in the following code.
    interface Foo {}
    class Alpha implements Foo {}
    class Beta extends Alpha {}
    class Delta extends Beta {
    public static void main( String[] args ) {
    Beta x = new Beta();
    Beta b = (Beta)(Alpha)x; //fine
    Foo f = (Delta)x; //CCE
    Object ob = new Object();
    String s = new String();
    ob = s; //fine, no need of case
    s = (String)ob; //needs a castI was just thinking, implicitly Delta and Beta both of them IS-A Foo, and assigning x to a type foo shouldnt be a problem(while making it refer to the Delta class) so, what could cause the CCE ?
    I would appreciate if someone could please help me understand this.
    Rgds

    Hi.
    Assigning your "x" to a variable typed Foo is not a problem. The problem is that you are trying to cast an instance of Beta ("x") into type Delta which is not possible. Every Delta is a Beta, but not every Beta will be a Delta!
    Simple as that.
    Bye.

  • Dynamic [Runtime] type casting in Java

    Hello,
    This is my requirement.
    I have a method that takes class name as a parameter.
    Ex:
    Object myMethod(String classname){
    Object xyz = getObject(); //userdefine method which returns some object
    /*<b>I need to typecast above object with the class name passed as the method parameter</b>*/
    /*<b>How can i type cast this object</b>*/
    Object obj = (classname) xyz;
    return obj;
    In the above example, how can i dynamically typecast the object with class whose name is passed as the method parameter?

    Hello,
    This is my requirement.
    I have a method that takes class name as a parameter.
    Ex:
    Object myMethod(String classname){
    Object xyz = getObject(); //userdefine method which
    returns some object
    /*<b>I need to typecast above object with the class
    name passed as the method parameter</b>*/
    /*<b>How can i type cast this object</b>*/
    Object obj = (classname) xyz;
    return obj;
    In the above example, how can i dynamically typecast
    the object with class whose name is passed as the
    method parameter?Perhaps a little more background on the project (what you are trying to do) will help the experts here answer?
    /*with a class that takes a noarg constructor*/
    public Object getObject(String classname) throws Exception
      //might want to get a bit more specific with which exceptions it will throw
      return Class.forName(classname).newInstance();
    }Do I think this sometimes is indicative (perhaps even more often than not), of a possible design flaw? Yes..
    It gets a little trickier if you have constructors (you have to create a Class object representing the string with the .forName(..) ..and then use some reflection to determine constructors and then a bit of logic to determine which of those to use...)
    ~Dave

  • 'Class Cast Exception' while invoking a EJB from a Servlet

              Hi,
              I am working on J2EE applications.I am using Webgain studio and weblogic server.I
              got a problem while invoking EJB from the servlet.
              While calling an EJB from the servlet, it is giving that "Class Cast Exception".This
              is because, the remote home reference is not able to type casted to the"Home Interface"
              of the EJB, even if I type casted explicitly. It is creating the context and able
              to identify the EJB with the JNDI name.
              Could please help me in solving this problem.I am pasting the code here.
              Thanks in advance,
              Dharma
              public void doGet(HttpServletRequest req, HttpServletResponse resp)
                   throws ServletException, IOException
                        resp.setContentType("text/html");
                        PrintWriter out = new PrintWriter(resp.getOutputStream());
              try
              Context context=getInitialContext();
              Object reference=context.lookup("ArlProjContractorAppletSession");
              ArlProjContractorAppletSessionHome home=(ArlProjContractorAppletSessionHome)PortableRemoteObject.narrow(reference,ArlProjContractorAppletSessionHome.class);
              //Exception is occuring in the above statement. It is unable
              //to cast to the home interface          
                        ArlProjContractorAppletSession the_ejb=null;
              try
              the_ejb=home.create();
              System.out.println("the_ejb = " + the_ejb.toString());
              catch(Exception e)
              e.printStackTrace();
              catch(Exception e)
              e.printStackTrace();
                        // to do: code goes here.
                        out.println("<HTML>");
                        out.println("<HEAD><TITLE>Contractor TimeTracker</TITLE></HEAD>");
                        out.println("<BODY>");
                        // to do: your HTML goes here.
                        out.println("</BODY>");
                        out.println("</HTML>");
                        out.close();
              

              I came across this kind of problem once. My problem went away after I upgraded
              from 5.1 SP6 to 5.1 SP8.
              "Dharma" <[email protected]> wrote:
              >
              >Hi,
              >
              >I am working on J2EE applications.I am using Webgain studio and weblogic
              >server.I
              >got a problem while invoking EJB from the servlet.
              >
              >While calling an EJB from the servlet, it is giving that "Class Cast
              >Exception".This
              >is because, the remote home reference is not able to type casted to the"Home
              >Interface"
              >of the EJB, even if I type casted explicitly. It is creating the context
              >and able
              >to identify the EJB with the JNDI name.
              >
              >Could please help me in solving this problem.I am pasting the code here.
              >
              >Thanks in advance,
              >Dharma
              >
              >
              >public void doGet(HttpServletRequest req, HttpServletResponse resp)
              >     throws ServletException, IOException
              >     {
              >          resp.setContentType("text/html");
              >          PrintWriter out = new PrintWriter(resp.getOutputStream());
              >
              > try
              > {
              >
              > Context context=getInitialContext();
              >
              > Object reference=context.lookup("ArlProjContractorAppletSession");
              >
              > ArlProjContractorAppletSessionHome home=(ArlProjContractorAppletSessionHome)PortableRemoteObject.narrow(reference,ArlProjContractorAppletSessionHome.class);
              >
              >//Exception is occuring in the above statement. It is unable
              >//to cast to the home interface          
              >
              >          ArlProjContractorAppletSession the_ejb=null;
              >
              > try
              > {
              > the_ejb=home.create();
              >
              > System.out.println("the_ejb = " + the_ejb.toString());
              >
              > }
              > catch(Exception e)
              > {
              > e.printStackTrace();
              > }
              > }
              > catch(Exception e)
              > {
              > e.printStackTrace();
              > }
              >          // to do: code goes here.
              >
              >          out.println("<HTML>");
              >          out.println("<HEAD><TITLE>Contractor TimeTracker</TITLE></HEAD>");
              >          out.println("<BODY>");
              >
              >          // to do: your HTML goes here.
              >
              >          out.println("</BODY>");
              >          out.println("</HTML>");
              >          out.close();
              >     }
              >
              >
              >
              >
              >
              

  • Splitting and type casting huge string into arrays

    Hello,
    I'm developing an application which is supposed to read measurement files. Files contain I16 and SGL data which is type casted into string. I16 data is data from analog input and SGL is from CAN-bus data in channel form. CAN and analog data is recorded using same scan rate.
    For example, if we have 6 analog channels and 2 CAN channels string will be (A represents analog and C represents CAN):
    A1 A2 A3 A4 A5 A6 C1 C2 A1 A2 A3 A4 A5 A6 C1 C2 A1 A2 .... and so on
    Anyway, I have problems reading this data fast enough into arrays. Most obvious solution to me was to use shift registers and split string in for loop. I created a for loop with two inner for loops. Number of scans to read from string is wired to N terminal of the outermost loop. Shift register is initialized with string read from file.
    First of the inner loops reads analog input data. Number of analog channels is wired to its N terminal. It's using split string to read 2 bytes at a time and then type casts data to I16. Rest of the string is wired to shift register. When every I16 channel from scan is read, rest of the string is passed to shift register of the second for loop.
    Second loop is for reading CAN channels. It's similar to first loop except data is read 4 bytes at a time and type casted to SGL. When every CAN channel from scan is read, rest of the string is passed to shift register of the outermost loop. Outputs of type cast functions are tunneled out of loops to produce 2D arrays.
    This way reading about 500 KB of data can take for example tens of seconds depending on PC and number of channels. That's way too long as we want to read several megabytes at a time.
    I created also an example with one inner loop and all data is type casted to I16. That is extremely fast when compared to two inner loops!
    Then I also made a test with two inner loops where I replaced shift register and split string with string subset. That's also faster than two inner loops + shift register, but still not fast enough. Any improvement ideas are highly appreciated. Shift register example attached (LV 7.1)
    Thanks in advance,
    Jakke Palonen
    Attachments:
    String to I16 and SGL arrays.vi ‏39 KB

    OK, there is clearly room for improvement. I did some timing and my two above suggestions are already about 100x faster than yours. A few teeaks led to a version that is now over 500x faster than the original code.
    A few timings on my rather slow computer (1GHz PIII Laptop) are shown on the front panel. For example with 10000 scans (~160kB data as 6+2) my new fastest version (Reshape II) takes 14 ms versus the original 7200ms! It can do 100000 scans (1.6MB data) in under 200 ms and 1000000 scans (15MB data) in under 2 seconds.
    I am sure the code could be further improved. I recommend the Reshape II algoritm. It is fastest and can deal with variable channel counts. Modify as needed.
    Attached is a LabVIEW 7.1 version of the benchmarking code, containing all algorithms. I have verified that all algorithms produce the same result (with the limitation that the cluster version only works for 6*I16+2*SGL data, of course). Remember that the reshape function is extremely efficient, because it does not move the data in memory. I have some ideas for further improvements, but this should get you going.
    Message Edited by altenbach on 08-05-2005 03:06 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    StringI16SGLCastingTimer.png ‏48 KB
    StringtoI16andSGLArraysMODTimer.vi ‏120 KB

  • Class Cast Exception

    Hi
    I got class cast exception here
    String value = String.valueOf
    (((IPrivateMaterialApplicationView.IMaterial_InputElement)(wdContext.nodeMaterial_Input().nodeT_Matno_in().getElementAt(i))).getMatnr());
              valueSet.put(value,value);
    Thanks & Regards
    Ravi Shankar B

    Ravi,
    the cause of this issue is that
    wdContext.nodeMaterial_Input().nodeT_Matno_in().getElementAt(i)
    does not return an instance of type
    IPrivateMaterialApplicationView.IMaterial_InputElement
    Check what type is returned by this method (in NWDS place your cursor over the method and the return type is displayed) and cast to that type.
    Regards
    Sebastian

  • (Class cast Exception)Problem while loading data fro database in java class

    Dear all,
    Please help me...to solve this
    I have a database having two columns of String and Date Types.
    In my java code i was trying to load the data to a UI.
    I am successfull in loading the String type value.
    But while loading date field value,is showing Class cast Exception.
    What i am doing is Getting the values from database to a String[] array.
    So my question is how to
    get the Date field as date field itself,Then convert it to a String..Then put it in to String[] array...
    Any body please help...If any one want more clarification in question i will give......

    Hi,
    I am using GWT to display my data in a Grid.
    So it will accept a Single two dimensional String array....Here i have one as String and other as Date.
    So i was trying to get each row in a sindle dimensional array array[] then store it in a list.
    Iteration goes up to 10 rows.After i am setting it in to a list
    ie list.add(array);
    Now while returning this list i am doing this
    "return (String[][])list.toArray(new String[0][]);"
    When i tried to get the date element to String array it is showing class cast exception. When i tried with toString() method it is showing the same problem.

  • Class cast exception when deploying in Solaris

    I have an application which has LdapRealmV2 configured and I'm programmatically checking
    permission for a group. The code when deployed on a windows environment is working
    fine. I now tried to deploy the same in a Solaris clustered environment. I get a
    class cast exception weblogic.security.LdapRealmv2.LDAPGroup when I try executing
    the Security.hasPermission(principal, acl, permission, '.') method.

    Karl,
    Did you build the service using the <jwsc> ant task? If so, the default is to build a JAX-RPC service. Please specify the attribute type="JAXWS" in order to build a JAX-WS service.
    You can verify the type of a web service using the WebLogic console. The type is displayed on the general page for a service and will either be "JAXRPC" or "JAXWS".

  • Class cast exception in Process Control

    Hello,
    I am trying to use a SubProcess through a Process Control from a ParentProcess in another Workshop application.
    They are both deployed in the same domain.
    The SubProcess Control is packaged in a Control Project whose jar is imported in the other ParentProcess Workshop application.
    The data that is passed is in form of XML documents described as schemas. And both applications use the same Schema.jar.
    The call from the ParentProcess looks like it is OK.
    But when the reply comes back it looks like the transform fails. I get a "class cast exception"
    The feeling I get is that the returning xml document variable can't be cast into the local xml document variable. Even though they are of the exact same type...
    All help is very much appreciated!!!
    Unhandled Process Exception:
    java.lang.ClassCastException
    at se.telia.object.kund.control.sokKundPControl.clientRequest(Unknown Source)
    at se.telia.tab.regae.process.Untitled.sokKundPctrlClientRequest(Untitled.jpd:101)
    -------------

    I'm having some problems with a transformation and I'm getting a cast exception so maybe it's the same thing.
    The problem is when the source schema has some element with minOccurs="0". If the element is not present in the xml document that is received, the transformation seems to be trying to cast it anyway.

  • Class Cast exception in ArrayDescriptor.createDescriptor(

    I want to pass an array into a an Oracle procedure called using a callableSatement.
    When I create the array descriptor i get an class cast exception. I believe this error occurs when the sun.jdbc.odbc.JdbcOdbcConnection
    or the weblogic.jdbc.wrapper.PoolConnection_weblogic_jdbc_oci_Connection connection object is being cast to oracle.jdbc.driver.OracleConnection by createDescriptor method how can i overcome this run time error????

    Welcome to the forum!
    >
    am trying to pass ArrayList to Oracle procedure
    but when i am excuting the code i got the following error
    java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcConnection incompatible with oracle.jdbc.OracleConnection
    Can anybody help me to resolve this problem.
    >
    Not if you don't provide the code you are using so we can see what it is doing. Also post your 4 digit Oracle version, Java version, JDBC jar file name/version and the procedure signature that shows the language, parameters and types.
    An ArrayList is a Java object so are you using a Java stored procedure?
    Or are you using WebSphere? If WebSphere see this IBM link which appears to apply to the problem you are describing.
    http://www-01.ibm.com/support/docview.wss?uid=swg21409335

  • Class cast exception in jsp plz help

    i have written a jsp where i displayed a text box with value given by user inside it
    when the user enters some other value in text box and clicks on update button then i forwarded reqeust to servlet which will some data base work
    servlet will forward again to the same jsp with the new value in text box.
    but i am getting CLASS CAST EXCEPTION when servlet is forwarding reqeust to same JSP
    help me what to do ........
    thanking you in advance ..cheers

    display cart.jsp file:
    <%@ page import="java.util.*,org.*" %>
    <html>
    <body>
    <%
    Vector cartupdate = (Vector)session.getAttribute("cartlist");
    for (int i = 0; i < cartupdate.size(); i++) {
    CartListBean clb = (CartListBean)cartupdate.elementAt(i);
    %>
    <form name="itemslist<%=i%>" action="updateCart" method="post">
    <input type="hidden" name="itemcode" value="<%=clb.getItemCode()%>">
         <input type="hidden" name="itemname" value="<%= clb.getItemName()%>">
    <input type="hidden" name="price" value="<%= clb.getPrice()%>">
    <%= clb.getItemName() %>
    <input type="text" name="qty" value="<%=clb.getQuantity()%>">
    <input type="submit" name="<%=clb.getItemCode()%>" value="update">
    </form>
    <br>
    <%
    %>
    <form name="tobuy" action="buysrv" method="post">
    <input type="submit" name="buy" value="BUY">
    </form>
    </body>
    </html>
    updatecart servlet code:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import org.*;
    import java.sql.*;
    import java.util.*;
    public class UpdateCart extends HttpServlet
    public void service(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
    HttpSession session=request.getSession(false);
    Vector cartupdate = (Vector)session.getAttribute("cartlist");
    for (int i = 0; i < cartupdate.size(); i++) {
    org.CartListBean cart = (org.CartListBean)cartupdate.elementAt(i);
    if((cart.getItemCode()).equals(request.getParameter("itemcode")))
    org.CartListBean clb=new org.CartListBean();
    clb.setItemCode(request.getParameter("itemcode"));
         clb.setQuantity(request.getParameter("qty"));
         clb.setItemName(request.getParameter("itemname"));
    clb.setPrice(request.getParameter("price"));
    cartupdate.setElementAt(clb,i);
    session.setAttribute("cartlist",cart);
    ServletContext application=getServletContext();
    System.out.println("got finished");
              RequestDispatcher rd=application.getRequestDispatcher("/displaycart.jsp");
                   rd.forward(request,response);
    Message was edited by:
    143java

  • Class Cast Exception in JSP of the component

    Hi,
      I am trying to call a web service from the JSP of the component.I have written the java code as a scriplets in the JSP. The problem i am facing is Class Cast Exception. The code is as follows
    String strKey = "wsclients/proxies/sap.com/CCMSContentBroker/com.sap.ccmscontentbroker.CCMSContentProxy";
    java.lang.Object obj ;
    obj = context.lookup(strKey);
    str1 = obj.getClass().getName();
    ContentBroker objCB= null; 
    objCB = (ContentBroker)obj; // getting error here
    ContentBroker is an web service interface. The same code is working if i write it in the component but not in the scriplet of the JSP.
    Can't we do the type cast in the JSP ?
    Cant we call the web services in the JSP?
    How to eliminate this Class cast Exception in my code?
    Thanks and Regards,
    Saravanan

    Hi Harini,
             Thanks for your reply. I have checked all the import statements in the JSP.The problem is in the Type casting of object <b>obj</b> to ContentBroker variable <b>objCB</b>.
    Are u saying typr casting is not possible in JSP or organising imports in the JSP.
    These are my imports statements in the JSP
    <%@ page import = "java.util.ResourceBundle" %>
    <%@ page import = "com.sapportals.htmlb.*" %>
    <%@ page import = "com.intel.ccmt.ccmscontentbroker.* "%>
    <%@ page import = "com.intel.ccmt.ccmscontentbroker.types.* "%>
    <%@ page import = "com.sapportals.portal.prt.contentconversion.XSLConverter" %>
    <%@ page import = "com.sapportals.portal.prt.component.IPortalComponentRequest" %>
    <%@ page import="java.io.File" %>
    <%@ page import="javax.naming.Context" %>
    <%@ page import="javax.naming.InitialContext" %>
    <%@ page import="javax.naming.NamingException" %>
    <%@ page import="java.util.StringTokenizer"%>
    Can u help me on rectifying this class cast Exception ?
    Thanks and Regards,
    Saravanan

  • Class Cast Exception in Stateless session bean

    Hi,
    i am getting a class cast exception in this particular line....
    in my EJBClient program i get this error..
    //Getting a reference to the bean's home interface in client program
    SimpleSessionHome home=(SimpleSessionHome)PortableRemoteObject.narrow(ref, SimpleSessionHome.class);Wher SimpleSessionHome is my Home interface.
    I am not able to correct the error. Plz help me.
    Thanks,
    Akshatha

    Hi,
    Make sure you are looking up the correct JNDI name. And, what king of Classloading is being used.
    This could be an issue if there are different classloader in action.
    According to the JBoss 4 Admin Guide.
    Most developers know that the type of a class in Java is a function of the fully qualified name of the class. However the type is also a function of the java.lang.ClassLoader that is used to define that class.
    Feel free to forward your queries / comment.
    Pawan.

  • Weblogic BLOB Cast Exception

    We have an interesting situation where have to support our application on
    both Weblogic 6.1 SP2 using an Oracle Type 2 driver and iPlanet using an
    Oracle Type 4 driver. In our application we are using blob's, and in order
    for our blob's to work with the Type 4 driver we must do a two stage process
    where we insert an Oracle EMPTY_BLOB and then select the newly inserted
    blob, cast it to oracle.sql.BLOB and upload it using streams.
    Unfortunately, when this code runs on WLS the datasource/connection pool
    substitutes some wrapper classes (or something) behind the scenes and we get
    class cast exceptions as the blob is of type
    weblogic.jdbc.rmi.SerialOracleBlob.
    Is there any way to configure WLS connection pools/datasources so that it
    doesn't use any weblogic classes and only uses oracle classes? We currently
    have our 3rd Party Oracle drivers as the first entry in our classpath. We
    can't switch to Oracle Type 2 on iPlanet (too buggy), or this would all be
    moot and we'd simply use the more generic non-vendor specific way of
    uploading blob's. And we can't cast to weblogic classes, because then that
    would break on iPlanet.
    Here's the code snippet that we can't change, because we have to support
    Oracle Type 4 on iPlanet.
    ResultSet blobs = ustmt.executeQuery();
    blobs.next();
    Blob blob = blobs.getBlob(1);
    OutputStream blobOut = ((oracle.sql.BLOB)
    blob).getBinaryOutputStream();
    try {
    blobOut.write(attachment.getFile());
    } catch (IOException e) {
    throw new ServletException(e);
    } finally {
    try {
    blobOut.close();
    } catch (IOException e) {
    throw new ServletException(e);
    blobs.close();
    Thanks,
    Gary

    Hi Gary!
    Blob oracle extensions are implemented internally in weblogic as
    weblogic.jdbc.rmi.SerialOracleBlob. As we wrap objects internally for
    serialization purpose, we can not use oracle objects directly. So, you have to
    use SerialBlob in weblogic.
    Mitesh
    Gary Rudolph wrote:
    We have an interesting situation where have to support our application on
    both Weblogic 6.1 SP2 using an Oracle Type 2 driver and iPlanet using an
    Oracle Type 4 driver. In our application we are using blob's, and in order
    for our blob's to work with the Type 4 driver we must do a two stage process
    where we insert an Oracle EMPTY_BLOB and then select the newly inserted
    blob, cast it to oracle.sql.BLOB and upload it using streams.
    Unfortunately, when this code runs on WLS the datasource/connection pool
    substitutes some wrapper classes (or something) behind the scenes and we get
    class cast exceptions as the blob is of type
    weblogic.jdbc.rmi.SerialOracleBlob.
    Is there any way to configure WLS connection pools/datasources so that it
    doesn't use any weblogic classes and only uses oracle classes? We currently
    have our 3rd Party Oracle drivers as the first entry in our classpath. We
    can't switch to Oracle Type 2 on iPlanet (too buggy), or this would all be
    moot and we'd simply use the more generic non-vendor specific way of
    uploading blob's. And we can't cast to weblogic classes, because then that
    would break on iPlanet.
    Here's the code snippet that we can't change, because we have to support
    Oracle Type 4 on iPlanet.
    ResultSet blobs = ustmt.executeQuery();
    blobs.next();
    Blob blob = blobs.getBlob(1);
    OutputStream blobOut = ((oracle.sql.BLOB)
    blob).getBinaryOutputStream();
    try {
    blobOut.write(attachment.getFile());
    } catch (IOException e) {
    throw new ServletException(e);
    } finally {
    try {
    blobOut.close();
    } catch (IOException e) {
    throw new ServletException(e);
    blobs.close();
    Thanks,
    Gary

Maybe you are looking for

  • Unable to create Web i reports in Win 7 64 bit OS

    Hi,     I have WIN 7 64 bit installed on my Laptop. I am unable to create Web I reports in this machine. Does any one know why? BR, Nanda

  • Standard reports allows monitoring of our purchasing procedures

    Hello SAP Gurus, I am looking for any report that will allow monitoring of our purchasing procedures for example: Reports identifying date of invoice v's date of order / requisition Thanks

  • Misguided BT Loyalist trying to leave

    I have reached the end of the line with BT simply because no package exists any more for people like me. I make very few social calls of more than a few minutes duration and have absolutely no need for free weekend or evening calls whatsoever, I norm

  • I got the new 5S - but where did my new photos go?

    before I restored all my old info from my 4 to the new 5S (photos, apps etc) I used the phone to take photos and text - now that I've restored it all the new photos I took are gone. Where can I find them?

  • Master Password being asked each time I start FireFox

    Hello. I have activated master password but it keeps on asking it every time it starts up. my homepage is about:blank and even with BOTH plugins and add-ons DISABLED, it still asks for the master password. Is this normal behavior?