Class cast exception while casting FTPConnectionFactory object

Hi
I have SOA Suite Advanced installation - 10.1.3.4 MLR#5.
I have developed a BPEL which polls an FTP site using a JCA FTPConnectionFactory registered in JNDI - eis/Ftp/My_Ftp.
If file is present, then BPEL doesnt fetchs it... instead calls a java program through WSIF binding.
In java program i am retrieving the JNDI object - eis/Ftp/My_Ftp.. casting it to oracle.tip.adapter.ftp.FTPConnectionFactory and get the FTP host and credentials.
Now using those details i mannually create an FTP Connection and retieve the file.
This program worked for sure... but recently when i tried the same i got the ClassCastException while casting java.lang.Object got from JNDI to oracle.tip.adapter.ftp.FTPConnectionFactory. I havnt changed any thing on server since... could not understand why this issue has cropped now.
After lot of research the issue seems due to different Classloaders. JNDI object was loaded by ClassLoaderA and in my java program it is being loaded by ClassLoaderB.
And these two classloaders dont share classes with each other.
This is the code:
InitialContext ctx = new InitialContext();
Object jndiFTPObj = ctx.lookup("eis/Ftp/My_Ftp");
System.out.println("Got Object from JNDI is: "+jndiFTPObj+" ClassLoader - "+jndiFTPObj.getClass().getClassLoader());
// it prints -- Got Object from JNDI is: oracle.tip.adapter.ftp.FTPConnectionFactory@1aa3bbc ClassLoader - FtpAdapter:0.0.0
FTPConnectionFactory ftpConF = (oracle.tip.adapter.ftp.FTPConnectionFactory)jndiFTPObj;
// here i get error -- java.lang.ClassCastException: oracle.tip.adapter.ftp.FTPConnectionFactory
Thinking of RMI/IIOP i even tried:
FTPConnectionFactory ftpConF = (FTPConnectionFactory)PortableRemoteObject.narrow(ctx.lookup("eis/Ftp/My_Ftp"), FTPConnectionFactory.class);
it didnt solve the error.
I tried loading the class using the same loader as:
Class.forName("oracle.tip.adapter.ftp.FTPConnectionFactory",true,jndiFTPObj.getClass().getClassLoader());
even that didnt solve the error.
If any body has some idea... pls help
Thanks
Inder

Issue was due to ClassLoaders... tried to use the same classloader... but couldnt.
Eventually solved it by using Java Reflection.
Thx

Similar Messages

  • NPE Exception while getting mutable object

    I have an application (Model + ViewController). The ViewController is deployed as a jar file. The other application depends on the first project jar. The second application is a simple web application that responds to REST query. The first call is working fine. The second call throws an exception (NPE), and all following calls are working fine. I don't really understand the exception, what should I look for?
    SEVERE: Exception while getting mutable object
    java.lang.NullPointerException
            at oracle.mds.internal.persistence.NamespaceRulesImpl.<init>(NamespaceRulesImpl.java:123)
            at oracle.mds.internal.persistence.NamespaceRules.getNamespaceRulesObj(NamespaceRules.java:72)
            at oracle.mds.internal.util.ChangeUtil.convertToMOEvents(ChangeUtil.java:134)
            at oracle.mds.internal.notifications.EventNotificationManager.handleChanges(EventNotificationManager.java:354)
            at oracle.mds.internal.notifications.EventNotificationManager.handlePChanges(EventNotificationManager.java:251)
            at oracle.mds.core.MOState.signalStale(MOState.java:1185)
            at oracle.mds.core.MOState.signalStale(MOState.java:644)
            at oracle.mds.core.MOState.checkStalenessDocFromBuilder(MOState.java:739)
            at oracle.mds.core.MOState.getIsStaleLastModified(MOState.java:559)
            at oracle.mds.core.MOContent.getIsStaleLastModified(MOContent.java:277)
            at oracle.mds.core.ChainedMOContent.getIsStaleLastModified(ChainedMOContent.java:142)
            at oracle.mds.core.MetadataObject.isStale(MetadataObject.java:818)
            at oracle.adf.share.jndi.MDSBackingStore.obtainMetadataObject(MDSBackingStore.java:517)
            at oracle.adf.share.jndi.MDSBackingStore.getMOBean(MDSBackingStore.java:572)
            at oracle.bc4j.mbean.RuntimeMXBeanImpl.init(RuntimeMXBeanImpl.java:128)
            at oracle.bc4j.mbean.RuntimeMXBeanImpl.<init>(RuntimeMXBeanImpl.java:118)
            at oracle.bc4j.mbean.RuntimeMXBeanImpl.<init>(RuntimeMXBeanImpl.java:109)
            at oracle.bc4j.mbean.BC4JConfigLifeCycleCallBack.contextInitialized(BC4JConfigLifeCycleCallBack.java:160)
            at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
            at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
            at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
            at weblogic.servlet.internal.WebAppServletContext.reloadServletClassLoader(WebAppServletContext.java:3106)
            at weblogic.servlet.internal.FilterWrapper.reloadFilter(FilterWrapper.java:63)
            at weblogic.servlet.internal.FilterWrapper.checkForReload(FilterWrapper.java:104)
            at weblogic.servlet.internal.FilterWrapper.getFilter(FilterWrapper.java:41)
            at weblogic.servlet.internal.FilterChainImpl.add(FilterChainImpl.java:35)
            at weblogic.servlet.internal.FilterManager.getFilterChain(FilterManager.java:232)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3727)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
            at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
            at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
            at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
            at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
            at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
            at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
    Nov 25, 2013 1:44:58 PM oracle.bc4j.mbean.BC4JConfigLifeCycleCallBack contextInitialized
    WARNING: com/example/model/module/common/bc4j.xcfg: java.lang.NullPointerException

    The applications already existed when I started working on them, but I don't think the model projects were renamed or moved. I changed the original warning message "com/example/model/module/common/bc4j.xcfg". The warning message points to the correct bc4j.xml files.

  • '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();
              >     }
              >
              >
              >
              >
              >
              

  • Class Cast Exception in Portable Remote Object

    Hai guys,
    I am new to jsp.I have made a simple j2ee application in which i am getting class cast exception in PortableRemoteObject.narrow function.
    The exception is:
    org.apache.jasper.JasperException
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:297)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:247)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:585)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    The root cause is :
    java.lang.ClassCastException
         com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
    javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
    org.apache.jsp.registration_jsp._jspService(registration_jsp.java:59)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:297)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:247)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:585)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    The code of the file is :
    <%@ page language="java" import="java.sql.*,pkg.*,javax.ejb.*,javax.naming.*,javax.rmi.PortableRemoteObject,java.rmi.RemoteException" %>
    <html>
    <head>
    <title></title>
    </head>
    <body bgcolor="CCCCFF">
    <h1><center>Welcome to MyBank</center></h1>
    <%
    InitialContext initial = new InitialContext();
    Object objref = initial.lookup("bankDSN");
    pkg.mybankHome vi = (pkg.mybankHome)PortableRemoteObject.narrow(objref,pkg.mybankHome.class);
    %>
    </body>
    </html>
    I have many threads but i was not able to solve this problem.
    It has been 2 to 3 weeks that i am struck in this error.
    Plz help me with this.
    Thanks in advance.
    Edited by: vishal29 on Jul 13, 2008 10:04 PM

    Hai DigitalDreamer,
    Thanks for giving your valuable time to my question.
    I have tried the code you gave me.
    The answer for :
    out.println(objref.getClass().getName());
    that i got is :
    javax.naming.Reference
    And the answer for :
    out.println(objref.getClass().getInterfaces());
    that i got is :
    [Ljava.lang.Class;@213b6e
    Could you please tell me how this can help.
    Actually i am new to jsp.
    Thanks in advance                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Exception while casting int[] to Object[],why?

    if(params.getClass().isArray()) this.params = (Object[])params;
    else this.params = new Object[]{params};
    Now I transfer int[] as "params",and ClassCastException is thrown while casting params to Object[].Since I'm using JDK5.0,why does this happen(the array has been initialized)?

    But how to retrieve every element of this
    Object(Array)? Which type should you cast it to?int[] obviously. Or forget about casting and simply create an Integer[] yourself. a for loop isn't that difficult to write.
    Are you aware that arrays are objects? That's why java doesn't autobox an int[].
    By the way, you should look at these lines of code again:
    if(params.getClass().isArray())
    this.params = (Object[])params;
    else this.params = new Object[]{params};

  • Getting Bad Applet class name exception while opening applet.

    Hi,
      While opening an applet in my mac os x v10.6.8 machine i am getting "Bad Applet class name exception" which is working fine in mac os x v10.7.5.Java version in my mac is 1.6.0_43.Can anyone please help me to resolve this.

    Apple barred Java from running on Macs in order to safeguard users by blocking Java 7 Update 11 and adding it to the banned list in XProtect.
    This was the second time in two weeks that Apple had blocked Oracle's code from running on Macs. The threat was so serious that the U.S. Department of Homeland Security had recommended that all Java 7 users disable or uninstall the software until a patch was issued. This time Java is blocked through Apple's XProtect anti-malware feature.
    Java has come under fire as the means by which hackers have been able to gain control of computers. In April 2012 more than 600,000 Macs were reported to have been infected with a Flashback Trojan horse that was being installed on people's computers with the help of Java exploits. Then in August Macs were again at risk due to a flaw in Java, this time around, there was good news for Mac users: Thanks to changes Apple has made, most of us were safe from the threat.
    Unwilling to leave its customers open to potential threats Apple decided it's safer to block Java entirely.
    In order to block older versions of Flash, Apple has updated its "Xprotect.plist" file so that any versions that come before the current one (version 11.6.602.171) cannot be used on a Mac. Users who have older versions of Flash installed will be greeted with an alert that says "Blocked plug-in," and Safari will prompt the user to update to a newer version.
    Macs running OS X Snow Leopard and beyond are affected.
    UPDATE for those running Lion or Mountain Lion:
    Oracle on Friday February 1 released a new version reportedly addressing vulnerabilities seen with the last build.
    Apple disabled Java 7 through the OS X XProtect anti-malware system, requiring users to have at least version "1.7.0_10-b19" installed on their Macs. The release dated February 1 carries the designation "1.7.0_13-b20," meeting Apple's requirements.
    Oracle "strongly recommends" applying the CPU fixes as soon as possible, saying that the latest Critical Patch Update contains 50 new security fixes across all Jave SE products.
    Update for Snow Leopard users:
    Apple issued update 12 for Java for OS 10.6:
    http://support.apple.com/kb/DL1573
    Note:  On systems that have not already installed Java for Mac OS X 10.6 update 9 or later, this update will configure web browsers to not automatically run Java applets. Java applets may be re-enabled by clicking the region labeled "Inactive plug-in" on a web page. If no applets have been run for an extended period of time, the Java web plug-in will deactivate.
    If, after installing Java for OS X 2013-002 and the latest version of Java 7 from Oracle, you want to disable Java 7 and re-enable the Apple-provided Java SE 6 web plug-in and Web Start functionality, follow these steps:
    http://support.apple.com/kb/HT5559?viewlocale=en_US
    Further update:
    Apple issued this Java related security update No. 13 on February 19:
    http://support.apple.com/kb/HT5666
    and Update No. 14 on March 4:  http://support.apple.com/kb/DL1573
    http://support.apple.com/kb/HT5677
    You should also read this:
    https://support.apple.com/kb/HT5672
    The standard recommendation is for users to turn off Java except when they have to use it on known and trusted websites (like their bank). Javascript, which is unrelated despite the name, can be left on.
    Further useful comment in this article:
    http://www.macworld.co.uk/macsoftware/news/?newsid=3435007&olo=email

  • Class loading exceptions while importing Spring, EHCache in BPMStudio 10g

    Hi,
    We are facing Class loading / Class NOt Found exceptions while importing Spring.jar and EHCache.jar in BPMStudio 10g Catalog and BPM Enterprise Server 10g. Java classes are bundled in an external JAR file. This JAR is referencing Spring and EHCache library. This Java component is invoked from an automatic activity in BPM process. Task execution is failing in BPM workspace in Studio and Enterprise server.
    We tried copying the JARS in the following folders. But nothing is working.
    D:\OraBPMStudioHome\lib
    D:\OraBPMStudioHome\ext
    D:\OraBPMStudioHome\webapps\workspace\WEB-INF\lib
    D:\OraBPMStudioHome\webapps\workspace\WEB-INF\classes
    <Enterprise_Server_WL_Home>/server/<Domain_Lib>

    Ariel,
    You are right. I have already added the JARS as external resource. I am getting the errors while cataloging Java component in BPM Studio in a Catalog Module. I am able to add Log4J Jar as an external resource and catalog the resource as java component. In case one JAR has a dependency on another JAR it is failing to catalog. In Eclipse or Weblogic Workshop 10g, we can add multiple JARS in the Project classpath and it works fine. In case of BPM Studio, we are getting Class Loading or ClassNotFound errors while cataloging multiple JAR files
    Thanks
    Subhabrata

  • ClassCast Exception while casting to type String

    Dear Java users
    While coding a parse routine in a session EJB , I created a vector and added some elements to it.
    Naturally these elements are of type object.
    Now, while extracting elements out of the vector I tried to cast them to the actual type that the elements are.
    Most of the elements are of type String and some of type Long and Double.Note that these are all Object wrappers not primitives.
    The code compiles fine, however at run time I get the following error:
    java.lang.ClassCastException : java.lang.String
    I tried to do the casting two ways: (String) object and object.toString(). In both cases I got the same error.
    Here is a snippet of my code where I get the error:
    RETAIL_TRANX retail_db = retail_home.create(columns.elementAt(0).toString(),
    columns.elementAt(1).toString(),................
    Any ideas on why this is happening and how best should I cast to String.
    Thank you for any help you can provide
    Best
    Naveen

    RETAIL_TRANX retail_db = retail_home.create(columns.elementAt(0).toString(),
    columns.elementAt(1).toString(),................
    I'd say that the code above calls the toString() implemented in the Object class because that's what elementAt() returns. If you want String objects as arguments to the create method, you want the toString() implemented in the subclasses String, Long, and Double. To achieve this, try the following:
    RETAIL_TRANX retail_db = retail_home.create(((String)columns.elementAt(0)).toString()...
    This code casts the Object class object returned by elementAt to a String first and then it calls the toString() method on the String object resulting from the cast. The toString() that executes should be the one in the String rather than Object class.
    This is going to fail if elementAt() doesn't return an object that can be cast to a String. In this case, what you might want to do first is test the type of object returned with the instanceof operator. Then cast to the appropriate type, in each case calling toString() after the cast has been made.
    Regards,
    Steve

  • JPA Toplink, class cast exception when casting class A to class A

    I get a really strange exception from Toplink JPA. I used netbeans to create a persistence.xml and I generated a class (entity) from the table in a DB. Everything works fine, when I create a select query, I get the list of objects and the list is correctly typed. I can the objects in the list in debug mode with every field correctly set. But then I need to start working with the list, so I iterate through the list. And then I get ClassCastException from class A to class A (when A is the canonical name of the entity class).
    I was working with JPA for some time but never seen that. I am using glassfish v2, mysql, netbeans 6.1. I could post the classes and persistence xml, but persistence.xml is really simple (no class definitions) and the class is annotated by netbeans. Every field is annotated like this:
    @Column(name = "name", nullable = false)
    And Date columns have
    @Temporal(TemporalType.TIMESTAMP)
    The whole class is annotated with @Table.
    Does anyone has any idea, what can be wrong?

    DrClap wrote:
    Make sure your URLClassLoader cannot load the IAdapter class.
    That is not exactly correct. He needs to make sure his URLClassloader has access to the IAdapter class. Sure, it should not load it on its own, but if requested the URLClassloader should be able to ask a parent to load IAdapter. Which in the end looks the same. But is not the same.
    So set the parent classloader of your URLClassloader to a classloader capable of loading IAdapter.

  • Nullpointer exception while custom cloning objects

    We are seeing the following exception, any ideas?
    java.lang.NullPointerException
    at
    oracle.toplink.internal.queryframework.MapContainerPolicy.addInto(MapContainerPolicy.java:98)
    at
    oracle.toplink.internal.queryframework.ContainerPolicy.addInto(ContainerPolicy.java:72)
    at
    com.integral.persistence.CloneBuilderC.setAttributeValue(CloneBuilderC.java:318)
    at
    com.integral.persistence.CloneBuilderC.iterate(CloneBuilderC.java:153)
    at
    oracle.toplink.internal.descriptors.DescriptorIterator.internalIterateReferenceObject(DescriptorIterator.java:155)
    at
    com.integral.persistence.CloneBuilderC.iterateReferenceObjectForMapping(CloneBuilderC.java:266)
    at
    oracle.toplink.mappings.CollectionMapping.iterateOnElement(CollectionMapping.java:742)
    at
    oracle.toplink.mappings.CollectionMapping.iterateOnRealAttributeValue(CollectionMapping.java:756)
    at
    oracle.toplink.internal.descriptors.DescriptorIterator.iterateValueHolderForMapping(DescriptorIterator.java:299)
    at
    oracle.toplink.internal.indirection.BasicIndirectionPolicy.iterateOnAttributeValue(BasicIndirectionPolicy.java:223)
    at
    oracle.toplink.mappings.ForeignReferenceMapping.iterate(ForeignReferenceMapping.java:828)
    at
    oracle.toplink.internal.descriptors.ObjectBuilder.iterate(ObjectBuilder.java:2310)
    at
    oracle.toplink.internal.descriptors.DescriptorIterator.iterateReferenceObjects(DescriptorIterator.java:282)
    at
    com.integral.persistence.CloneBuilderC.iterateReferenceObjectForMapping(CloneBuilderC.java:273)
    at
    oracle.toplink.mappings.CollectionMapping.iterateOnElement(CollectionMapping.java:742)
    at
    oracle.toplink.mappings.CollectionMapping.iterateOnRealAttributeValue(CollectionMapping.java:756)
    at
    oracle.toplink.internal.descriptors.DescriptorIterator.iterateValueHolderForMapping(DescriptorIterator.java:299)
    at
    oracle.toplink.internal.indirection.BasicIndirectionPolicy.iterateOnAttributeValue(BasicIndirectionPolicy.java:223)
    at
    oracle.toplink.mappings.ForeignReferenceMapping.iterate(ForeignReferenceMapping.java:828)
    at
    oracle.toplink.internal.descriptors.ObjectBuilder.iterate(ObjectBuilder.java:2310)
    at
    oracle.toplink.internal.descriptors.DescriptorIterator.iterateReferenceObjects(DescriptorIterator.java:282)
    at
    oracle.toplink.internal.descriptors.DescriptorIterator.startIterationOn(DescriptorIterator.java:458)
    at
    com.xxxx.persistence.CloneBuilderC.buildClone(CloneBuilderC.java:73)

    I have given the method descirption below:
    public void iterateReferenceObjectForMapping( Object referenceObject, DatabaseMapping mapping )
    if ( !( shouldCascadeAllParts() || ( shouldCascadePrivateParts() ) ) )
    return;
    // When using wrapper policy in EJB the iteration can stop in certain cases,
    // this is because EJB forces beans to be registered anyway and clone identity can be violated
    // and the violated clones references to session objects should not be traversed.
    if ( ( !shouldIterateOverWrappedObjects() )
    && ( mapping.getReferenceDescriptor() != null )
    && ( mapping.getReferenceDescriptor().hasWrapperPolicy() ) )
    return;
    if ( referenceObject == null )
    return;
    setCurrentMapping( mapping );
    setCurrentDescriptor( getDescriptorFor( referenceObject ) );
    if ( shouldCascadePrivateParts() && !shouldCascadeAllParts() && !mapping.isPrivateOwned() )
    iterateNonPrivatePart( referenceObject );
    return;
    // Check if already processed.
    if ( getVisitedObjects().containsKey( referenceObject ) )
    iteratePreviouslyVisitedObject( referenceObject );
    return;
    getVisitedObjects().put( referenceObject, referenceObject );
    internalIterateReferenceObject( referenceObject );
    if ( shouldBreak() )
    setShouldBreak( false );
    return;
    iterateReferenceObjects( referenceObject );
    This used to work OK in toplink 10g we are seeing this problem only with toplink 11x

  • Graphical Mapping Error: Unexpected Exception-While saving Mapping Object

    Hello Experts,
    I am unable to save Message Mapping in PI7.11 with following version details:
    Version
    Service Pack:03
    Release:NW711_03_REL
    We already had this issue before but after applying Service Path it got resolved.. but now again its giving the same issue.. can any one came accross such issue?? any solution? we are in the critical development stage and wondering for solution.
    Thanks
    Rajeev

    Hello,
    Try to check locked objects in NetWeaver administrator <pi_host>:<pi_port>/nwa on Intagration Repository Tab. If your MM object locked just unlock them and try to save again.
    BR,
    Dzmitry

  • (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 using Finder method

    Hello. I'm new to J2EE. I have set up one entity bean but am having trouble
    with my current one.
    Basically, I have two finder methods:
    public ShareHistory findByPrimaryKey(Integer historyId)
            throws FinderException, RemoteException;
        public Collection findByShare(String shareId)
             throws FinderException, RemoteException; findByPrimaryKey works fine, but findByShare causes a class cast exception in java.lang.String.
    The stack trace in the server logs shows that it is my ejbActivate method in my entity bean causing the problem:
    public void ejbActivate() {
          //String numberString = (String) context.getPrimaryKey();
          //historyId = new Integer(numberString);
        historyId = (Integer) context.getPrimaryKey();
        }The stack trace from my client shows that the class cast exception occurs
    in the client at the System.out.println("shareid" + ": " + sh.getShareId());
    line:
    Collection c = sharesHistoryHome.findByShare("DCAN");
                     Iterator i = c.iterator();
                          while (i.hasNext()) {
                         ShareHistory sh = (ShareHistory) i.next();
                    System.out.println("shareid" + ": " + sh.getShareId());
                    System.out.println("value" + ": " + sh.getValue());
                     System.out.println("time" + ": " + sh.getTime());
                     System.out.println("date" + ": " + sh.getDate());
                     }//whileAs you can see I tried casting to a string in ejbactivate, but that simply causes an Integer class cast exception during findByprimaryKey instead. How do I allow both Integer and String objects to be used?
    Also I am a bit confused as to why the String passed to findByShare(String) is being used in context.getPrimaryKey() in the first place (if that is actually what's happening).

    Oops my FindByShare method was returning a collection of shareId's (strings) instead of a collection of Integer primary keys, which would explain the class cast exception.

  • Class cast exception in Ejb Look up

    Hi friends,
    Deploying one ejb with JBoss_4_2_2_GA and deploying well.
    But while trying to look up it getting some exception like
    java.lang.ClassCastException: $Proxy78 cannot be cast to stateless.CalculatorRemote
    please help to identify
    here is code
    Remote
    package stateless;
    import java.math.*;
    import javax.ejb.Remote;
    import java.lang.annotation.*;
    @Remote
    public interface CalculatorRemote {
    public float add(float x, float y);
    public float subtract(float x, float y);
    public float multiply(float x, float y);
    public float division(float x, float y);
    and stateless bean
    package stateless;
    import java.math.*;
    import javax.ejb.Stateless;
    import javax.ejb.Remote; 
    @Stateless(name="CalculatorBean")
    @Remote(CalculatorRemote.class) 
    public class CalculatorBean implements CalculatorRemote{
         public float add(float x, float y){     
              return x + y;
       public float subtract(float x, float y){
          return x - y;
        public float multiply(float x, float y){
          return x * y;
       public float division(float x, float y){
            return x / y;
    and lookup code
    public void jspInit() {
            try {
                InitialContext ic = new InitialContext();
                   calculator = (CalculatorRemote) ic.lookup("example/CalculatorBean/remote");
                   System.out.println("Loaded Calculator Bean");
            } catch (Exception ex) {
               e.printStackTrace ();
        }

    hi i have gone through JNDI and
    while calling look up from standard alone application, it will work fine
              InitialContext ctx = null;
              Hashtable<String, String> props = new Hashtable<String, String>();
              props.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
              props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
              props.put("java.naming.provider.url", "jnp://localhost:1099");
              try {
                   ctx = new InitialContext(props);
                   CalculatorRemote calc = (CalculatorRemote) ctx.lookup("CalculatorBean/remote");
                   System.out.println( "addition   ==   " + calc .add( 10, 20  ));
              } catch (NamingException e) {
                   e.printStackTrace();
         when i am try to look up it from servlet following way but getting save error.
    i have used following way
    1. InitialContext ic = new InitialContext();
    Object obj = ic.lookup( "CalculatorBean/remote" );
    CalculatorRemote calc= ( CalculatorRemote )PortableRemoteObject.narrow ( obj, CalculatorRemote .class );
    it getting following error
    java.lang.ClassCastException
    at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
    Caused by: java.lang.ClassCastException: $Proxy73 cannot be cast to org.omg.CORBA.Object
    at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212)
    2. calculator = (CalculatorRemote) ic.lookup("CalculatorBean/remote");
    java.lang.ClassCastException: $Proxy73 cannot be cast to forums.business.ForumManager
    at forums.web.ForumServlet.init(ForumServlet.java:36)

  • 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.

Maybe you are looking for

  • How to re-map ModKey+K to Ctrl+V ?

    Hello, I'm a Dvorak key-layout user and I want to copy/paste like a normal human being, i.e. with the left hand. How do I re-map ModKey(a.k.a. the Windows key)+K to Ctrl+V in X? I'm using AwesomeWM with no DE. Xmodmap can't handle ModKey+AnyKey combi

  • CUA - SUIM in client system with background processing of IDOCS

    Hi We have setup CUA in our Solution Manager system 4.0 sr2 SP11 and activated background processing of idocs.  When we run SUIM in the child system the user creation/change information is now showing the name of the background user rather than the a

  • How can i generate S/No in smartform

    hi all, i have made a smartform in which i have a field S/NO.i want to calculate this field by this.If first record is display than S/NO must shows 1 and if second record is display than S/NO shows 2 and so on so forth, but i want it trough programmi

  • How do I reset my computer password?  I have it written down and it will not work.  This is different than my apple ID

    How do I reset my computer password so I can download software to my computer?  This is different than my apple ID,  I wrote it down but it is not working.  Need help

  • Time machine could not complete backup

    I am getting the following message "the backup disk image "volume/.....macbookpro.sparsebundle." culd not be accessed (error -1)" I am backing up to a NAS drobo FS have a partitioned time machine drive was able to make a complete backup just an hour