Interfaces + casting problem

ok, so i have a class Student that goes like
import java.util.*;
interface Copyable extends Cloneable {
     public Object clone();
     public String toString();
public class Student implements Copyable {
     private String iName = "";
     private Student iMentor = null;
     private boolean isClone = false;
     public void setName (String name) {
          iName = name;
     public Student() {}
     public Student(String name, Student mentor) {
          iName = name;
          iMentor = mentor;
        //more code here
}i also have a class Demo that contains the following:
interface CopyListener {
     public void copyAdded(Copyable obj);
public class Demo implements CopyListener {
     public void copyAdded(Copyable obj) {
          System.out.println("Added " + obj.toString());
     public static void main(String[] args) {
          Demo demo1 = new Demo();
          Demo demo2 = new Demo();
          ArrayListWrapper wrapper = new ArrayListWrapper();
          wrapper.addListener(demo1);
          wrapper.addListener(demo2);
          Student mentor = new Student("Mentor", null);
          Student std1 = new Student("Student1", mentor);
          Student std2 = new Student("Student2", mentor);
          Student std3 = new Student("Student3", mentor);
          wrapper.add(std1);
          wrapper.add(std2);
          wrapper.add(std3);
          Student std4 = new Student("Student3", mentor);
          wrapper.add(std4);
          wrapper.show();
}the last class is ArrayListWrapper.
it goes like
import java.util.*;
public class ArrayListWrapper {
     private CopyListener[] iListeners = new CopyListener[20];
     private ArrayList iArrayList = new ArrayList();
     public ArrayListWrapper() {}
     public void addListener (CopyListener listener) {
          boolean added = false;
          for (int i = 0; i < iListeners.length; i++ ) {
               if (iListeners[i] == null) {
                    iListeners[i] = listener;
                    added = true;
                    break;
     public void add(Copyable obj) {
          if(!iArrayList.contains(obj)) {
               Object objClone = obj.clone();
               if(objClone != null){
                    iArrayList.add(objClone);
                    for (int i = 0; i < iListeners.length; i++ ) {
                         iListeners.copyAdded((Copyable)objClone);
     public void show() {
          for (int i = 0; i < iArrayList.size(); i++ ) {
               iArrayList.get(i).toString();
it all compiles, but i get a runtime error:
Exception in thread "main" java.lang.NullPointerException
        at ArrayListWrapper.add(ArrayListWrapper.java:30)
        at Demo.main(Demo.java:23)line 30 in ArrayListWrapper is
iListeners[i].copyAdded((Copyable)objClone);
and line 23 in Demo
wrapper.add(std1);
which i guess are a part of one and same problem/error.
really not sure how to fix it, though

Well, what do you think the problem is? I've substituted j for i, for clarity.
Exception in thread "main" java.lang.NullPointerException
at ArrayListWrapper.add(ArrayListWrapper.java:30)
at Demo.main(Demo.java:23)
line 30 in ArrayListWrapper is
iListeners[j].copyAdded((Copyable)objClone);
What could possibly cause a NullPointerException on this line? Can you think of any ways to figure out what is null here at runtime? And why, oh why, are so many people incapable of the most trivial debugging?
grumble

Similar Messages

  • Shareable object interface cast problem

    Hi,
    I'm a student working on building a shareable object interface between two applets namely "EWallet" and "EPhone".
    I currently use the javacard 2.2.X version and I mean to solve the shareable object interface in this version.
    Thus not with servlets in 3.X.X.
    The current problem I'm facing is the casting from the base type of shareable interface objects (Shareable) to the EWalletInterface which I need to do operations on the SIO of EWallet.
    The code snippet of the EWallet applet (server)
    public void verify(byte[] pincode) {
    if ( pin.check(pincode, (short)0,(byte)(short)pincode.length) == false )
    ISOException.throwIt(SW_VERIFICATION_FAILED);
    public void debit(byte debitAmount) {
    if (!pin.isValidated())
    ISOException.throwIt(SW_PIN_VERIFICATION_REQUIRED);
    // check debit amount
    if ((debitAmount > MAX_TRANSACTION_AMOUNT) || (debitAmount < 0))
    ISOException.throwIt(SW_INVALID_TRANSACTION_AMOUNT);
    // check the new balance
    if ((short)(balance - debitAmount) < (short)0)
    ISOException.throwIt(SW_NEGATIVE_BALANCE);
    balance = (short)(balance - debitAmount);
    public Shareable getShareableInterfaceObject(AID client_aid, byte parameter){
    byte[] ephone_aid_bytes = {(byte)0X15, (byte)0XEF, (byte)0X4D, (byte)0X55, (byte)0X86, (byte)0X60};
    if(client_aid.equals(ephone_aid_bytes,(short)0,(byte)ephone_aid_bytes.length) == false)
    return null;
    if(parameter != (byte)0x01)
    return null;
    return this;
    The code snippet of the EPhone applet (client)
    //Helper method
    private void makeBankcardDebit(short amount){
    AID ewallet_aid = JCSystem.lookupAID(ewallet_aid_bytes,(short)0,(byte)ewallet_aid_bytes.length);
    if(ewallet_aid == null)
    ISOException.throwIt(SW_EWALLET_AID_NOT_EXIST);
    //Error with casting from Shareable to EWalletInterface
    EWalletInterface sio = (EWalletInterface)(JCSystem.getAppletShareableInterfaceObject(ewallet_aid, (byte)0x01));
    if(sio == null)
    ISOException.throwIt(SW_FAILED_TO_OBTAIN_SIO);
    byte[] pin = new byte[4];
    sio.verify(pin);
    sio.debit((byte)amount);
    this.balance = (short)(this.balance + amount);
    The EWalletInterface code snippet
    public interface EWalletInterface extends Shareable {
    public void verify(byte[] pincode);
    public void debit(byte amount);
    The interface is currently both in the EWallet and EPhone packages.
    The problem i'm facing is that in the code snippet of EPhone.
    The "lookupAID"- and "getAppletShareableInterfaceObject"-methods work
    The casting from Shareable to EWalletInterface gives me status word 0x6F00 which presents me with a google explanation of "No precise diagnosis".
    Does anyone have an idea why the cast from Shareable to EWalletInterface doesn't work?
    Thanks in advance,
    Jeroen

    Hi,
    What happens if you get the SOI reference and store in a Shareable and see if it is null? Just to confirm, the two applets are in different packages and the server applet has be installed and is selectable?
    If you get 0x6F00, you should start adding try/catch blocks to find the root cause.
    Cheers,
    Shane
    =================================
    Reposting with &#123;code} tags
    =================================
    Hi,
    I'm a student working on building a shareable object interface between two applets namely "EWallet" and "EPhone".
    I currently use the javacard 2.2.X version and I mean to solve the shareable object interface in this version.
    Thus not with servlets in 3.X.X.
    The current problem I'm facing is the casting from the base type of shareable interface objects (Shareable) to the EWalletInterface which I need to do operations on the SIO of EWallet.
    The code snippet of the EWallet applet (server)
        public void verify(byte[] pincode) {
            if ( pin.check(pincode, (short)0,(byte)(short)pincode.length) == false )
                ISOException.throwIt(SW_VERIFICATION_FAILED);
        public void debit(byte debitAmount) {
            if (!pin.isValidated())
                ISOException.throwIt(SW_PIN_VERIFICATION_REQUIRED);
            // check debit amount
            if ((debitAmount > MAX_TRANSACTION_AMOUNT) || (debitAmount < 0))
               ISOException.throwIt(SW_INVALID_TRANSACTION_AMOUNT);
            // check the new balance
            if ((short)(balance - debitAmount) < (short)0)
                 ISOException.throwIt(SW_NEGATIVE_BALANCE);
            balance = (short)(balance - debitAmount);
        public Shareable getShareableInterfaceObject(AID client_aid, byte parameter){
            byte[] ephone_aid_bytes = {(byte)0X15, (byte)0XEF, (byte)0X4D, (byte)0X55, (byte)0X86, (byte)0X60};
            if(client_aid.equals(ephone_aid_bytes,(short)0,(byte)ephone_aid_bytes.length) == false)
                return null;
            if(parameter != (byte)0x01)
                return null;
            return this;
    The code snippet of the EPhone applet (client)
       //Helper method
        private void makeBankcardDebit(short amount){
            AID ewallet_aid = JCSystem.lookupAID(ewallet_aid_bytes,(short)0,(byte)ewallet_aid_bytes.length);
            if(ewallet_aid == null)
               ISOException.throwIt(SW_EWALLET_AID_NOT_EXIST);
            //Error with casting from Shareable to EWalletInterface
            EWalletInterface sio = (EWalletInterface)(JCSystem.getAppletShareableInterfaceObject(ewallet_aid, (byte)0x01));
            if(sio == null)
              ISOException.throwIt(SW_FAILED_TO_OBTAIN_SIO);
            byte[] pin = new byte[4];
            sio.verify(pin);
            sio.debit((byte)amount);
            this.balance = (short)(this.balance + amount);
    The EWalletInterface code snippet
        public interface EWalletInterface extends Shareable {
            public void verify(byte[] pincode);
            public void debit(byte amount);
        }The interface is currently both in the EWallet and EPhone packages.
    The problem i'm facing is that in the code snippet of EPhone.
    The "lookupAID"- and "getAppletShareableInterfaceObject"-methods work
    The casting from Shareable to EWalletInterface gives me status word 0x6F00 which presents me with a google explanation of "No precise diagnosis".
    Does anyone have an idea why the cast from Shareable to EWalletInterface doesn't work?
    Thanks in advance,
    Jeroen

  • Class vs. interface casting

    This is a long read. But since I wrote test code and think its a ligit question:
    After compiling, if I move a *.class file to a different directory, casting with a class (but not an interface) fails. Please look at my test code to understand what I am trying to say:
    public class Main {
      public static void main(String[] args) {
        try {
          MyClassLoader mcL = new MyClassLoader();
          Class classA = mcL.loadClass("whatever");
          I inst = (I) classA.newInstance(); // <-- good
          // ClassA inst = (ClassA) classA.newInstance(); <-- bad
          inst.foo();
        } catch(Exception e) { e.printStackTrace() ; }
          public static class MyClassLoader extends ClassLoader {
            protected Class<?> findClass(String s) throws ClassNotFoundException, ClassFormatError {
              try {
                InputStream in = new FileInputStream(new File("/etc/ClassA.class"));
                int i = in.available();
                byte[] buf = new byte;
    in.read(buf, 0, buf.length);
    return defineClass(buf, 0, buf.length);
    } catch(Exception e) {e.printStackTrace(); }
    return null;
    public class ClassA implements I {
    public void foo() { println("ClassA::foo-->ok"); }
    public interface I { public void foo(); }
    C:\dev\dir *java
      Main.java
      ClassA.java
      I.java
    C:\dev\javac *java
    C:\dev\move ClassA.class \etc
    C:\dev\java Main
    using interface cast = no problem
    using a class to cast = _fail_
    Exception in thread "main" java.lang.NoClassDefFoundError: ClassA
         at Main.main(Main.java:18)
    Caused by: java.lang.ClassNotFoundException: ClassA
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         ... 1 more
    I will only cast with interfaces, but wondering what is going on with why casting with a class fails.
    _note_: to test that casting with classes works at all I wrote this code snippet:
    Class c = Thread.class;
    Class[] noArg = new Class[0];
    Constructor constr =  c.getConstructor(noArg);
    Thread t = (Thread) constr.newInstance(new Object[0]);
    println("-->" + t.getId());
    I hope this proves casting with classes is possible.So sometimes casting with a class is ok, sometimes not. I wonder why.
    thanks.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    ejp wrote:
    After compiling, if I move a *.class file to a different directoryYou can't do that. The .class file has to be in whatever directory is indicated by its package statement. Two classes with the same name in different packages are different, and a .class file in the wrong directory will cause NoClassDefFoundErrors.can i ask a follow-up?
    To be painfully clear, when I hit this line:
    ClassA inst = (ClassA) classA.newInstance();The type-checking tripped me up. I had a valid "ClassA" object. Object creation had been internalized to my class loader. However, when the jvm did a type-check, it needed to load the ClassA.class file, and it had been removed. So, my casting with a class failed only because of type-checking?

  • Runtime casting problems

    The following code gives me runtime casting problems:
    package edu.columbia.law.markup.test;
    import java.util.*;
    public class A {
       protected static Hashtable hash = null;
       static {
          hash = new Hashtable ();
          hash.put ("one", "value 1");
          hash.put ("two", "value 2");
       public static void main (String args []) {
           A a = new A ();
           String keys [] = a.keys ();
           for (int i = 0; i < keys.length; i++) {
               System.out.println (keys );
    public String [] keys () {
    return (String []) hash.keySet ().toArray ();
    The output on my console is:
    java.lang.ClassCastException: [Ljava.lang.Object;
            at edu.columbia.law.markup.test.A.keys(A.java:37)
            at edu.columbia.law.markup.test.A.main(A.java:29)I can not understand why is it a problem for JVM to cast?
    Any ideas?
    Thanks,
    Alex.

    return (String []) hash.keySet ().toArray ();This form of toArray returns an Object[] reference to an Object[] object. You cannot cast a reference to an Object[] object to a String[] reference for the same reason that you cannot cast a reference to a Object object to a String reference.
    You must use the alternate form of toArray instead:
    return (String []) hash.keySet ().toArray (new String[0]);This will return an Object[] reference to a String[] object, and this reference can be cast to a String[] reference.

  • FPGA Interface Cast question

    I'm playing with a 5644 VST and the VST Streaming template.  On the FPGA VI I added some code, then added an indicator to the FPGA VI front panel and compiled.  Running the FPGA VI in interactive execution mode, the indicator works well.  On the host end, though, I can't seem to access the new indicator with a Read/Write control. 
    Coming out of the Open FPGA VI Reference I can see the indicator on the wire, but in the Dynamic FPGA Interface Cast function it's getting stripped out of the refnum somehow.  If I connect a Read/Write control directly to the output of the Open Reference function I can access the indicator just fine.
    Any idea what I'm doing wrong?
    Thanks.
    Solved!
    Go to Solution.

    Have you re-configured your FPGA VI reference interface with the new bitfile?  The dynamic interface cast defines the output wire as having all the methods and indicators described by the type wire connected.  You can right-click on the type constant and select "Configure FPGA VI Reference...".  In the pop-up that follows, choose "Import from bitfile..." and then select the new bitfile that you've built.
    You'll need to update the fpga reference type in the "Device Session.ctl" type def as well.  This is the type that you'll be able to access throughout the project.

  • Ivette manzur : Interface errors problems on cisco 3560

    Hello,
    I have a problem on one of the interfaces on a cisco 3560 switch. In fact, I set up a monitoring network recently (cacti), and I have a significant number of errors on the interfaces. the problem is that when I do a sh interface I see no errors, and even by making a clear counters it does not solve my problem .. I also changed the wiring with cat 6 cables but nothing has changed ..
    What are the main causes of errors on an interface of a switch? what should I do in this case?
    Thank you for your help in advance
    ivette manzur

    Hello,
    I've a e61i and I experience a similar problem. My phone work very well on WiFi network with no encryption as well as 64-bit wep.
    At home I've 2 wireless routers, both encrypted at 128 bits, one with WEP and the other with WPA. On both of them I can correctly obtain an IP thru DHCP, but the traffic do not go thru.
    By using IfInfo I think I discovered the reason of the problem (unless IfInfo is not working properly...) and it seems a bug related to the netmask, broadcast and gateway settings. The router is 192.168.15.1 and this is what I get:
    1) DHCP case -- I get two IP adresses: the 169.254.x.x and the one assigned to the router. DNS is also set properly, but both gateway, broadcast and netmask are set to 0.0.0.0 for both IPs.
    IP Addr: 169.254.162.106
    Netmask: 0.0.0.0
    Broadcast: 0.0.0.0
    Gateway: 0.0.0.0
    DNS1: 192.168.15.1
    IP Addr: 192.168.15.100
    Netmask: 0.0.0.0
    Broadcast: 0.0.0.0
    Gateway: 0.0.0.0
    DNS1: 192.168.15.1
    2) Static IP 192.168.15.64, netmask set to 255.255.255.0 and gateway and DNS set to 192.168.15.1. The 169.254.x.x disappears and I get only one IP which is set to:
    IP Addr: 192.168.15.64
    Netmask: 0.0.0.0
    Broadcast:192.168.15.255
    Gateway: 192.168.15.1
    DNS1: 192.168.15.1
    So in conclusion, it seems that with 128bit encryption, in the DHCP case gateway, broadcast and netmask are not assigned correctly! While in the Static IP case the netmask is still not assigned correctly!!!
    Hope this can help...
    --AP

  • Casting problems getting a home I/F of an EJB in another app when debuging a servlet

    (Jdeveloper version = 9.0.2.798, OC4J Application Server version = Oracle9iAS (9.0.2.0.0))
    I am trying to debug a multi-tier application using the embedded application server. Servlets and EJBs within that application need to call EJBs contained within a second application (Horus).
    I have set up the embedded application server to run this second application automatically by adding the following entry into its server.xml
    <application auto-start="true" name="Horus" path="M:\Studio\build\production\java\Server\Obfuscate\J2EE_HOME\Horus\Horus.xml"/>
    I then start the embedded application server by debugging my servlet project, 'intermediateServlet'. I know the second application is running correctly in the embedded application server because I can access it from a separate client.
    In the 'intermediateServlet', I want to obtain a reference to a Dispatcher EJB held in the Horus application. This EJB has the following properties
         ejb-name     = com.internal.server.Dispatcher
         home interface     = com.internal.server.DispatcherHome
         bean class     = com.internal.server.DispatcherEJB
         remote interface= com.internal.server.Dispatcher
    The following code is executed during the container's call to my servlet init( context ) method to try and get the appropriate home interface.
    Context context = null;
    Object tempRemoteIF1 = null;
    Object tempRemoteIF2 = null;
    Properties h = null;
    h = new Properties();
    h.put( Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory" );
    h.put( Context.PROVIDER_URL, "ormi://127.0.0.1:23891/Horus");
    h.put( Context.SECURITY_PRINCIPAL, "user0" );
    h.put( Context.SECURITY_CREDENTIALS, "password" );
    context = new InitialContext (h);
    tempRemoteIF1 = context.lookup( "com.internal.server.Dispatcher" );
    tempRemoteIF2 = javax.rmi.PortableRemoteObject.narrow
    tempRemoteIF1,
    Class.forName( "com.internal.server.DispatcherHome" )
    The context.lookup call seems to work fine, returning an object of the class
         DispatcherHome_StatelessSessionHomeWrapper5
    Which I presume is a containter generated class implementing the home interface. To help confirm this,
    the object has a property beanName that has the value "com.internal.server.Dispatcher".
    The problem occurs on the next line, when I check whether I can cast the object to the home interface using ProtableRemoteObject.narrow(). This gives the following exception.
    java.lang.ClassCastException
         java.lang.Object com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
              PortableRemoteObject.java:296
         java.lang.Object javax.rmi.PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
              PortableRemoteObject.java:137
         com.internal.server.Dispatcher com.Studio.servlet.intermediateServlet.getDispatcherRef(java.lang.String, java.lang.String, java.lang.String)
              intermediateServlet.java:601
         void com.Studio.servlet.intermediateServlet.init(javax.servlet.ServletConfig)
              intermediateServlet.java:150
         com.evermind.server.http.ServletInstanceInfo com.evermind.server.http.HttpApplication.loadServlet(com.evermind.util.ByteString)
              HttpApplication.java:1669
         com.evermind.server.http.ServletInstanceInfo com.evermind.server.http.HttpApplication.findServlet(com.evermind.util.ByteString)
              HttpApplication.java:4001
         javax.servlet.RequestDispatcher com.evermind.server.http.HttpApplication.getRequestDispatcher(com.evermind.util.ByteString, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse)
              HttpApplication.java:2200
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
              HttpRequestHandler.java:580
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
              HttpRequestHandler.java:243
         void com.evermind.util.ThreadPoolThread.run()
              ThreadPoolThread.java:62
    Interestingly, if I use practically the same code, to obtain the home interface of an EJB that is defined in the application that I am debugging, the cast works perfectly. The returned object looks identical, apart from the name to the DispatcherHome_StatelessSessionHomeWrapper5 mentioned above.
    Could the error possibly be because I need to declare 'Horus' as a parent application of the application I am debugging? If it is how do I do this?
    Many thanks in advance for any help with this one.
    Mark.

    (Jdeveloper version = 9.0.2.798, OC4J Application Server version = Oracle9iAS (9.0.2.0.0))
    I am trying to debug a multi-tier application using the embedded application server. Servlets and EJBs within that application need to call EJBs contained within a second application (Horus).
    I have set up the embedded application server to run this second application automatically by adding the following entry into its server.xml
    <application auto-start="true" name="Horus" path="M:\Studio\build\production\java\Server\Obfuscate\J2EE_HOME\Horus\Horus.xml"/>
    I then start the embedded application server by debugging my servlet project, 'intermediateServlet'. I know the second application is running correctly in the embedded application server because I can access it from a separate client.
    In the 'intermediateServlet', I want to obtain a reference to a Dispatcher EJB held in the Horus application. This EJB has the following properties
         ejb-name     = com.internal.server.Dispatcher
         home interface     = com.internal.server.DispatcherHome
         bean class     = com.internal.server.DispatcherEJB
         remote interface= com.internal.server.Dispatcher
    The following code is executed during the container's call to my servlet init( context ) method to try and get the appropriate home interface.
    Context context = null;
    Object tempRemoteIF1 = null;
    Object tempRemoteIF2 = null;
    Properties h = null;
    h = new Properties();
    h.put( Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory" );
    h.put( Context.PROVIDER_URL, "ormi://127.0.0.1:23891/Horus");
    h.put( Context.SECURITY_PRINCIPAL, "user0" );
    h.put( Context.SECURITY_CREDENTIALS, "password" );
    context = new InitialContext (h);
    tempRemoteIF1 = context.lookup( "com.internal.server.Dispatcher" );
    tempRemoteIF2 = javax.rmi.PortableRemoteObject.narrow
    tempRemoteIF1,
    Class.forName( "com.internal.server.DispatcherHome" )
    The context.lookup call seems to work fine, returning an object of the class
         DispatcherHome_StatelessSessionHomeWrapper5
    Which I presume is a containter generated class implementing the home interface. To help confirm this,
    the object has a property beanName that has the value "com.internal.server.Dispatcher".
    The problem occurs on the next line, when I check whether I can cast the object to the home interface using ProtableRemoteObject.narrow(). This gives the following exception.
    java.lang.ClassCastException
         java.lang.Object com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
              PortableRemoteObject.java:296
         java.lang.Object javax.rmi.PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
              PortableRemoteObject.java:137
         com.internal.server.Dispatcher com.Studio.servlet.intermediateServlet.getDispatcherRef(java.lang.String, java.lang.String, java.lang.String)
              intermediateServlet.java:601
         void com.Studio.servlet.intermediateServlet.init(javax.servlet.ServletConfig)
              intermediateServlet.java:150
         com.evermind.server.http.ServletInstanceInfo com.evermind.server.http.HttpApplication.loadServlet(com.evermind.util.ByteString)
              HttpApplication.java:1669
         com.evermind.server.http.ServletInstanceInfo com.evermind.server.http.HttpApplication.findServlet(com.evermind.util.ByteString)
              HttpApplication.java:4001
         javax.servlet.RequestDispatcher com.evermind.server.http.HttpApplication.getRequestDispatcher(com.evermind.util.ByteString, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse)
              HttpApplication.java:2200
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
              HttpRequestHandler.java:580
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
              HttpRequestHandler.java:243
         void com.evermind.util.ThreadPoolThread.run()
              ThreadPoolThread.java:62
    Interestingly, if I use practically the same code, to obtain the home interface of an EJB that is defined in the application that I am debugging, the cast works perfectly. The returned object looks identical, apart from the name to the DispatcherHome_StatelessSessionHomeWrapper5 mentioned above.
    Could the error possibly be because I need to declare 'Horus' as a parent application of the application I am debugging? If it is how do I do this?
    Many thanks in advance for any help with this one.
    Mark. Try loading the home interface from the same classloader used to load the the returned home object.
    tempRemoteIF2 = javax.rmi.PortableRemoteObject.narrow
    ( tempRemoteIF1,
    tempRemoteIF1.getClass().getClassLoader().loadClass("com.internal.server.DispatcherHome" )
    Dhiraj

  • Generic Observer - Casting problems..

    I'm trying to make a generic observer pattern, modeled after Wadler's book.
    But I get type errors at the lines marked with ?? below, and although I fixed them, don't understand why the original code is wrong - any help please!
    interface Observer<S extends Observable<S,O,A>,
                           O extends Observer  <S,O,A>,
                           A > {
         public void update ( S subject, A arg);
         // public void update ( Observable<S,O,A> subject, A arg);
    abstract class Observable<S extends Observable<S,O,A>,
                                 O extends Observer  <S,O,A>,
                                 A > {
         List<Observer<S,O,A>> obs = new ArrayList<Observer<S,O,A>>();
         boolean changed = false;
        public void          notifyObservers(A a){
             // for ( O o : obs )            // ??
             //    o.update(this,a);          // ??
             for ( Observer<S,O,A> o : obs )
                  o.update((S)this,a );     // Cast??
    }

    Stephan,
    To illustrate the problem with your version and a client;
    The type TestObsGen must implement the inherited abstract method Observer<Thing,TestObsGen,Integer>.update(Observable<Thing,TestObsGen,Integer>, Integer)
    Any insights welcome!
    public interface Observer<
         S extends Observable<S, O, A>,
         O extends Observer<S, O, A>,
         A> {
        public void update(Observable<S, O, A> subject, A arg);
    abstract class Observable<
                   S extends Observable<S, O, A>,
                   O extends Observer<S, O, A>,
                   A> {
        List<Observer<S, O, A>> obs = new ArrayList<Observer<S, O, A>>();
        boolean changed = false;
        public void notifyObservers(A a) {
            for (Observer<S, O, A> o : obs)
                o.update(this, a);
    public class TestObsGen
         implements Observer< Thing, TestObsGen, Integer >
         Thing thing;
         TestObsGen ( Thing t ) {
              thing = t;
              // t.addObserver(this);
         void update(Thing t, Integer count) {
              System.out.println("Count:" + count);
         public static void main(String[] args) {
              Thing t = new Thing();
              TestObsGen test = new TestObsGen(t);
              t.bump();
              // Event received?!
    class Thing
         extends Observable< Thing, TestObsGen, Integer >
         int count;
         void bump() {
              count++;
              // setChanged();
              // notifyObservers();
    }

  • Class casting problem when using two class loaders

    Hi, I have a problem with class casting using two different ClassLoader...
    I created an instance of Test class, which is a subclass of AbstractTest and stored it for later use to ArrayList<AsbtractTest>. The instance was created with a custom class loader which extends URLClassLoader. Later when I got the stored instance from the ArrayList<AbstractTest> in default ClassLoader context and cast it to Test, it failed saying "java.lang.ClassCastException: com.test.Test cannot be cast to com.test.Test".
    Does anybody have an idea why this happens?

    Yes - a class is identified by it's package, it's name and it's class loader so the same class code loaded with two different class loaders are two different classes.
    An approach to dealing with your problem is to have the class implement an interface that is loaded by the parent class (assuming, of course, that the two class loaders have the same parent) then you can cast to the interface.

  • Firewall Cisco ASA 5505 new interface license problem

    Hi
    I have one ASA 5505 with a Base License
    The problem is when i want to use a new named interface the system says "With current License maximum number of named interfaces allowed is 3. Name cannot be set for this interface"
    And the question is if with this base license the interface cannot be used or only cannot be named?
    here the output of my firewall:
    Cisco Adaptive Security Appliance Software Version 8.2(5)
    Device Manager Version 6.4(5)
    Hardware:   ASA5505, 512 MB RAM, CPU Geode 500 MHz
    Internal ATA Compact Flash, 128MB
    BIOS Flash Firmware Hub @ 0xffe00000, 1024KB
    Encryption hardware device : Cisco ASA-5505 on-board accelerator (revision 0x0)
                                 Boot microcode   : CN1000-MC-BOOT-2.00
                                 SSL/IKE microcode: CNLite-MC-SSLm-PLUS-2.03
                                 IPSec microcode  : CNlite-MC-IPSECm-MAIN-2.05
    0: Int: Internal-Data0/0    : address is e02f.6de6.7843, irq 11
    1: Ext: Ethernet0/0         : address is e02f.6de6.783b, irq 255
    2: Ext: Ethernet0/1         : address is e02f.6de6.783c, irq 255
    3: Ext: Ethernet0/2         : address is e02f.6de6.783d, irq 255
    4: Ext: Ethernet0/3         : address is e02f.6de6.783e, irq 255
    5: Ext: Ethernet0/4         : address is e02f.6de6.783f, irq 255
    6: Ext: Ethernet0/5         : address is e02f.6de6.7840, irq 255
    7: Ext: Ethernet0/6         : address is e02f.6de6.7841, irq 255
    8: Ext: Ethernet0/7         : address is e02f.6de6.7842, irq 255
    9: Int: Internal-Data0/1    : address is 0000.0003.0002, irq 255
    10: Int: Not used            : irq 255
    11: Int: Not used            : irq 255
    Licensed features for this platform:
    Maximum Physical Interfaces    : 8        
    VLANs                          : 3, DMZ Restricted
    Inside Hosts                   : Unlimited
    Failover                       : Disabled
    VPN-DES                        : Enabled  
    VPN-3DES-AES                   : Enabled  
    SSL VPN Peers                  : 2        
    Total VPN Peers                : 10       
    Dual ISPs                      : Disabled 
    VLAN Trunk Ports               : 0        
    Shared License                 : Disabled
    AnyConnect for Mobile          : Disabled 
    AnyConnect for Cisco VPN Phone : Disabled 
    AnyConnect Essentials          : Disabled 
    Advanced Endpoint Assessment   : Disabled 
    UC Phone Proxy Sessions        : 2        
    Total UC Proxy Sessions        : 2        
    Botnet Traffic Filter          : Disabled 

    Hi,
    The ASA5505 has with Base License the limitation of 3 Vlan interface of which 1 is also limited in access (shown by the above output mentioning DMZ Restricted)
    For an interface on the ASA to operate it must have a name with the command "nameif"
    If you already have 3 Vlan interfaces in use then with this license you wont be able to configure 4th Vlan interface without getting a license that supports more interfaces. I guess that would be the Security Plus license.
    I know that this has come as a surprise to several users that have posted here on the forums. I too think that its a needles "feature" in the ASA to limit the use of the device in such a way.
    - Jouni

  • BMW 335i ipod interface connection problem with ipod classic 80GB

    Hi all, i have a 2007 BMW 335i with dealer installed ipod interface, and i been using it since, it's simply i just connect ipod with the cable in the glove compartment and leave it there, and it charges and stanby, when i start up the car the audio jumps right to where i left off on the ipod and it also let me control it with iDrive. after about one and half year of usage, i think there is something wrong with my ipod or i dont know for sure, well here is the problem, when i start the car it will play music from the ipod and i can control it from iDrive and everything but after about 5-10 mins, the music stop, and my iDrive shows weird playlist, and i need to unplug the ipod and replug again to have it connect and then it will stop by itself, after 5-10 mins, any of you guys have a bmw with the ipod interface have this problem?? i dont really know if it's my ipod problem or my bmw ipod interface problem. anyone can help me with this? thank you!

    That is most likely going to be a problem with your iPod, not the interface.
    Have you tried Resetting the iPod? (hold down the menu and center buttons for six seconds).
    If that fails to work, try Restoring the iPod in iTunes.

  • Interface Mapping problem ?

    Hi
    I am trying a simple File-File scenario.I am able to test the Message Mappings(VENDOR_INOUT) successfully as both source and target structures are same. However when I finally create the Interface mapping and map the source and target interfaces using the above Message mapping, the test fails with the below dump..
    Am I missing some configuration in the setting?
    Messages:14:09:13 Start of Test
      - LinkageError at JavaMapping.load(): Could not load class: com/sap/xi/tf/_Vendor_INOUT_
      - java.lang.NoClassDefFoundError: Illegal name: com/sap/xi/tf/_Vendor_INOUT_
         at java.lang.ClassLoader.defineClass(ClassLoader.java:538)
           at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
           at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingLoader.findClass(RepMappingLoader.java:173)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
           at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.load(RepJavaMapping.java:130)
           at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.execute(RepJavaMapping.java:49)
           at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingHandler.run(RepMappingHandler.java:75)
           at com.sap.aii.ibrep.server.mapping.rt.MappingHandlerAdapter.run(MappingHandlerAdapter.java:110)
           at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInterfaceMapping(ServerMapService.java:141)
           at com.sap.aii.ibrep.server.mapping.ServerMapService.transform(ServerMapService.java:120)
           at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.transform(MapServiceBean.java:51)
           at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.transform(MapServiceRemoteObjectImpl0.java:305)
           at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0p4_Skel.dispatch(MapServiceRemoteObjectImpl0p4_Skel.java:266)
           at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:292)
           at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:183)
           at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:118)
           at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
           at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
           at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
           at java.security.AccessController.doPrivileged(Native Method)
           at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
           at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
    14:09:14 End of Test

    Karl
    I have tried your suggestions without much success..What I am surprised to see is that I can see the same problem in prebuilt interface mappings from samples provided by SAP (flightbooking example).      
    I was wondering if there could have been some problem in configuring our Xi installations. Any pointers?
    regards
    Sriram V.

  • Seeburger Interface configuration problem

    I am facing some problems in configuring the interfaces in seeburger.
    As the standards which i want to translate are not configured as default for AS2 adapter so i want to configure it through BIC but as i am new to this don't know the basics as how to load the XSD, provided by client, and how to develope it in XML using BIC.
    Please throw some light on it as i am a new bee in seeburger, i also tried doing it but was not successful.

    >
    Rohit Kaushal wrote:
    > I am facing some problems in configuring the interfaces in seeburger.
    > As the standards which i want to translate are not configured as default for AS2 adapter so i want to configure it through BIC but as i am new to this don't know the basics as how to load the XSD, provided by client, and how to develope it in XML using BIC.
    > Please throw some light on it as i am a new bee in seeburger, i also tried doing it but was not successful.
    Can you provide more details like what you are expecting..
    If my understanding is correct you want to implement a mappings in seeburger bic mapping tool for your sceanrio which can take care of conversions right?
    if yes provide more details about your scenario
    Rajesh

  • Class casting problems in JSP's

    Folks,
              Several people, including myself, have written about the problems they
              ran into when trying to cast a class in JSP's. The following link might
              provide the answer:
              http://www.weblogic.com/docs51/classdocs/API_jsp.html#sessions
              I believe this is a major limitation Weblogic put on web app
              development, and hope BEA would eventually find a way to allow non-user
              defined types being stored in servlet sessions.
              Jeff
              

    Folks,
              Several people, including myself, have written about the problems they
              ran into when trying to cast a class in JSP's. The following link might
              provide the answer:
              http://www.weblogic.com/docs51/classdocs/API_jsp.html#sessions
              I believe this is a major limitation Weblogic put on web app
              development, and hope BEA would eventually find a way to allow non-user
              defined types being stored in servlet sessions.
              Jeff
              

  • 10gr2 TABLE(CAST( problem

    We have an existing report that uses existing function to table cast back data in the from clause. A very simplified example:
    FROM grant g, grantparticipant gt, table(cast(getSchedule(g.grant_pk, gt.grantparticipant_pk) as r_sched)) sched
    where g.grant_pk = gt.grant_fk
    and sched.grantparticipant_pk = gt.grantparticipant_pk
    The grantparticipant_pk is NULL when captured in the function. There are no null values in the table (it's a primary key). When the where clause is changed to reference a specific pk it works fine and the value is filled in.
    The works in our production db where the Oracle version is 10g. It works in development which is also 10g. The problem only appears to be with our 10gr2 DB.
    Any ideas....

    The problem was solved with ANSI JOINs. Would still like to know why that problem occurred?

Maybe you are looking for

  • MacOSX AIR Permissions for non-administrator user folders

    We're making final changes to our installer for PowerPC Macs, which cannot get the fixes in Adobe AIR 2.7. What are the ownership AND permissions expected to be for normal Adobe AIR operation in the following user folders? ~/Library/Application Suppo

  • Imac 24 " RAM"

    I just bought the 24 inch 2.8GHz imac with the original 2Gb RAM. I wanted to upgrade and bought 2 x 2Gb RAM. When I installed them, the computer sounded beeps told me that something was wrong. I took the RAMs back to the shop and they tested it on a

  • Critical Issue

    Hai there, My ABAP colleague enhanced datasource with out code. Issue is fields don’t appear in extractor checker. Give hints to solve this critical issue.

  • DNS Server settings not working as expected ....?

    Greetings I have our load balancer/firewall setup to where if someone enters a hostname like (www.example.com) it points it to a local server at 10.0.1.2 When logged into the network, the DNS Server that pulls up is 10.0.1.1 (IP of firewall), which i

  • Custom Voicemail Greeting

    Hi After recording a custom voicemail greeting, I press stop and the phone reboots. Has anyone else had this problem ?? S