Java interfaces and containers in different classes

Hi in trying to create an interface in Java that will be the basis for other classes to populate areas on in in certain panels.
So for example I have a default size for a screen and some default buttons that should appear on it. These are all setup in a class called ScriptyUI. Within ScriptyUI I want to set up several rows where each row will be populated with the container of a different class. So for instance another class called NetworkAreaUI will create all the buttons and boxes needed for the NetworkUI class along with the actionListeners for each of the buttons. I therefore want to add this into one of the rows of the ScriptyUI class.
Each time I try and call the networkAreaUI class from within the ScriptyUI class I get an error stating that a container is expected and not a window.
Any Ideas?
I have placed everything within the ScriptyUI class and it works, however this class soon becomes so large it is quite unmanageble.
What I am also trying is something similar to these code snippets:
I want to add this.............:
public class NetworkAreaUI extends JFrame implements Runnable, ActionListener
    private JPanel networkPanel;
    private JTextField netPath;
    private JButton remove;
    private JButton add;
    private JLabel netDrives;
    private JComboBox driveList;
    private int driveCount = 0;
    private Thread adds;
    private Thread lists;
    private Thread removes;
    protected NetworkDrive myNetworkDrive;
public NetworkAreaUI()
        Container cp = getContentPane();
        cp.setLayout(new BorderLayout());
        networkPanel = new JPanel();
        networkPanel.setLayout(new GridLayout(3,4));
        netDrives = new JLabel("Type Network Drive Location");
        networkPanel.add(netDrives);
        remove = new JButton("Remove");
        networkPanel.add(remove);
        netPath = new JTextField("\\\\Server\\Share\\Name",20);
        networkPanel.add(netPath);
        add = new JButton("add");
        networkPanel.add(add);
        driveList = new JComboBox();
        networkPanel.add(driveList);
        networkPanel.setVisible(false);
        cp.add(networkPanel);
        //Adds action listeners
        //Adds MenuSelection to the menu's
        remove.addActionListener(this);
        add.addActionListener(this);
        driveList.addActionListener(this);(then there is code for the action listeners )........into this.....
public class ScriptyUI extends JFrame// implements ActionListener, Runnable
    private final int FRAME_WIDTH = 600;
    private final int FRAME_HEIGHT = 540;
    private JPanel rows;
    private JPanel row1;
    private JPanel row2;
    private JPanel row3;
    private JPanel row4;
    private JPanel button;
    private JPanel outputArea;
    private JTextArea message;
    private JPanel selection;
    private JButton vbs;
    private JButton bat;
   /* private JPanel networkPanel;
    private JTextField netPath;
    private JButton remove;
    private JButton add;
    private JLabel netDrives;
    private JComboBox driveList;
    private int driveCount = 0;
    private JMenuBar menu;
    private JMenu fileMenu;
    private JMenu helpMenu;
    private JMenuItem restartMenu;
    private JMenuItem quitMenu;
    private JMenuItem show;
    protected NetworkDrive myNetworkDrive;
    protected NetworkAreaUI myNetGui;
    private JButton back;
    private JButton next;
    private JTextArea output;
    private JScrollPane jsp;
    private JButton save;
    private JFileChooser fc;
    private String fileType;
    // private Thread thread;
/*   private Thread adds;
    private Thread lists;
    private Thread removes;
    private Thread nextOne;
    private Thread saveIt;*/
  //  private Thread;
    public ScriptyUI(String title)
        super(title);
        myNetworkDrive = new NetworkDrive();
        myNetworkDrive.reset();
     //   myNetGui = new NetworkAreaUI();
        setUpGui();
public void setUpGui()
        setSize(FRAME_WIDTH,FRAME_HEIGHT);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container cp = getContentPane();
        cp.setLayout(new BorderLayout());
        //Setup Menu Bar
        menu = new JMenuBar();
        setJMenuBar(menu);
        fileMenu = new JMenu("File");
        helpMenu = new JMenu("Help");
        restartMenu = new JMenuItem("Start Over");
        quitMenu = new JMenuItem("Quit game");
        show = new JMenuItem("Show Drives");
        //Construct Menu Bar
        menu.add(fileMenu);
        menu.add(helpMenu);
        fileMenu.add(restartMenu);
        fileMenu.add(quitMenu);
        fileMenu.add(show);
        rows = new JPanel();
        rows.setLayout(new GridLayout(6,1));
        //Create Message area and populate with Text.
        row1 = new JPanel();
        message = new JTextArea("Select which format you " +
                "would like the Script to be in. Visual Basic" +
                "Script or Batch Script", 3, 30);
        row1.add(message);
        rows.add(row1);
        //setup the selection screen
        row2 = new JPanel();
        selection = new JPanel();
        selection.setLayout(new BorderLayout());
        //sets the buttons on the selection screen
        vbs = new JButton("Visual Basic Scripts");
        selection.add(vbs, BorderLayout.NORTH);
        bat = new JButton("Batch Scripts");
        selection.add(bat, BorderLayout.SOUTH);
        row2.add(selection, BorderLayout.CENTER);
        rows.add(row2);
        row3 = new JPanel();
        myNetGui = new NetworkAreaUI();
        row3.add(myNetGui);
        rows.add(row3);
cp.add(rows, BorderLayout.CENTER);Any help or guidance will be greatly appreciated,

Encephalopathic wrote:
good
Thanks :)
Are you sure that you want to use a Container and not a JPanel or JComponent? This is Swing after all.Hi i set up the method as below which seemed to work:
public Container setup()
        networkPanel = new JPanel();
        networkPanel.setLayout(new GridLayout(5,2));
        netDrives = new JLabel("Type Network Drive Location:");
        networkPanel.add(netDrives);
        typeName = new JLabel("Type Drive Letter:");
        networkPanel.add(typeName);
        netPath = new JTextField("\\\\Server\\Share\\Name",20);
        networkPanel.add(netPath);
        nameDrive = new JTextField("X",1);
        networkPanel.add(nameDrive);
        add = new JButton("add");
        networkPanel.add(add);
        remove = new JButton("Remove");
        networkPanel.add(remove);
        driveList = new JComboBox();
        networkPanel.add(driveList);
        driveNames = new JComboBox();
        networkPanel.add(driveNames);
        //Adds action listeners
        //Adds MenuSelection to the menu's
        remove.addActionListener(this);
        add.addActionListener(this);
        driveList.addActionListener(this);
        //return the content panel
        return networkPanel;
}it is set up in the header to return container
public Container setup()
.but i actually return networkPanel which is setup as a JPanel.
So have now changed it to read:
public JPanel setup()
.I think that should be a little better? is it?
Thanks for the heads up.
Ian

Similar Messages

  • How to use javasetters and getters in different classes

    how to use setters and getters in different class so that the setvalue in one class is effect in second class for getting

    If i got your question right,
    make sure your classes are in the same package
    make sure your getters are public/protected
    make sure your code calls the setter before calling the getter
    Kind regards

  • First use of jsp and java bean and "Unable to compile class for JSP" error

    Hi,
    I am trying to create my first jsp + java bean and I get a basic error (but I have no clue what it depends on exactly). Tomcat seems to cannot find my class file in the path. Maybe it is because I did not create a web.xml file. Did I forgot to put a line in my jsp file to import my bean?
    Thank you very much for your help.
    Here is my error:
    An error occurred at line: 2 in the jsp file: /login.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    /usr/local/tomcat/jakarta-tomcat-5/build/work/Catalina/localhost/test/org/apache/jsp/login_jsp.java:43: cannot resolve symbol
    symbol : class CMBConnect
    location: class org.apache.jsp.login_jsp
    CMBConnect test = null;
    I only have this in my directory:
    test/login.jsp
    test/WEB-INF/classes/CMBConnect.java
    test/WEB-INF/classes/CMBConnect.class
    Do I need to declare another directory in classes to put my class file in it and package my bean differently?
    Here is my login.jsp:
    <%@ page errorPage="error.jsp" %>
    <jsp:useBean id="test" type="CMBConnect" scope="session" />
    <html>
    <head>
    <title>my test</title>
    </head>
    <body>
    <h3>Login information</h3>
    <b><%=session.getValue("customerinfo.message")%></b>
    <form> ....... </form>
    </body>
    </html>
    and here is my CMBConnect.java:
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class CMBConnect
    public CMBConnect () { }
    public String openConnection(String id, String password) {
    String returnText = "";
    try {
    Connection con = null;
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    con = DriverManager.getConnection("jdbc:oracle:thin:@myserver.abc.com:1521:TEST", id, password);
    if(con.isClosed())
    returnText = "Cannot connect to Oracle server using TCP/IP...";
    else
    returnText = "Connection successful";
    } catch (Exception e) { returnText = returnText + e; }
    return returnText;
    Thanks again!

    Thanks for you help
    I created the package and I get this error this time:
    javax.servlet.ServletException: bean test not found within scope
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:822)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:755)
         org.apache.jsp.login_jsp._jspService(login_jsp.java:68)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:268)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:277)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:223)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

  • Help with menus and variables in different classes.

    1) how do I change variables in different classes? My situation..
    I have a few tabbed panels/planes, that ask for different user inputs. I want the last tabbed panel/plane to have the inputs on 1 plane. Is that confusing?
    Code:
            JTabbedPane tp = new JTabbedPane();
            tp.addTab ("Kitchen", new KitchenPanel());
            tp.addTab ("Living Room", new LivingRoomPanel());
            tp.addTab ("Master Bedroom", new MasterBedPanel());
            tp.addTab ("Bedroom 1", new Bedroom1Panel());
            tp.addTab ("Bedroom 2", new Bedroom2Panel());
            tp.addTab ("Misc Use", new MiscPanel());
            tp.addTab ("Totals", new TotalsPanel());not the full thing obviously, but just so u see what im working with.
    2) How do popup menus work? I have a menu (File -> About | File -> How to Contact)
    I want The File->About menu item, to prompt a dialog
    The File -> How to to prompt a dialog
    Contact Menu(Not Item) to load a webpage
    thanks again for the help, and i hope its not to confusing
    Edited by: 2point2ek on May 25, 2009 9:51 PM

    It's better to think in terms of transferring data between object, rather than between classes.
    What you need is for the tab pane objects to have a reference to some common object to which the data is to be sent. This common object might be the total pane. It's generally better design to keep the data in separate objects from the presentation (in this case the totals pane), but at this stage that's probably just going to confuse you.
    The simplest way to get this reference in is to the pane objects is as a constructor argument, which the constructor of your pane objects saves in a field. As you create each pane you pass it a reference and it stores that reference for when it needs to save data.
    Then, when you click detect the action by which the user tells the program to store the data he's entered the pane class should call a method on the central data object, passing all the data from that pane. If there's a lot of it, wrap it up in an object (typically called a "data transfer object").
    The central data object would be responsible for dealing with this data, amending totals etc.. It might delegate responsibility for updating the display to a separate total pane object.

  • Interfaces and methods of Object class

    JSL 2.0 states the following
    If an interface has no direct superinterfaces, then the interface implicitly
    declares a public abstract member method m with signature s, return type r,
    and throws clause t corresponding to each public instance method m with
    signature s, return type r, and throws clause t declared in Object, unless a
    method with the same signature, same return type, and a compatible throws
    clause is explicitly declared by the interface.
    But the following codes produces empty output
    package test;
    import java.lang.reflect.Method;
    public class TestIterface {
        public static void main(String [] args){
            Method [] methods=Y.class.getMethods();
            for(int i=0, n=methods.length;i<n;i++)
                System.out.println(methods);
    interface Y{
    What are the reasons of such behaviour?

    then the interface implicitly declares a public abstract member method
    "Implicit" means that it's implied that the interface declares those methods; unlike java.lang.Object, there is no interface from which all other interfaces descend. All interfaces at the "top" of the inheritance hierarchy are implied to expose at least the same methods as Object.
    Hope this helps...

  • Interface and functions are different

    hello
    I have Ipod nano 6th generation. I looked manual and i found that it has some functions like: to make icons more big or to choose option of Running in my fitness trainer. But i don´t have those functions in my Ipod
    Could you help me?

    Are you sure you have a 6G Nano?
    Most of these options can be found in the Settings app. If you do see the Settings app, swipe your finger to the left or right from your iPod's Home Screen to bring up additional menu items/apps.
    B-rock

  • Contract-first : WSDL vs Java interface

    Hello,
    I am starting to work with web Service.
    Many blogs and articles suggest to write WebServices contract from a WSDL.
    I am a java Programmer. I totally agree with the contract-first and the data-driven communication concept.
    Here is my question: why use WSDL when you can convert any Java Interface and Bean into a WebServices?
    If a tool gives you the possibility to move from xml to java (and vice-versa), why not stay with a java interface?
    What are the pitfalls of using this technique (other than being too easy to change the contract)?

    The main reason why you would want to write WSDL first is to be able to create a more verbose XML schema. For instance, if you take a raw Java interface or class and convert from Java to WSDL/XSD everything ends up being optional because the converters have no idea what is supposed to be required versus what isn't as well as field length restrictions etc. Some of the newer tools may allow you to do this with annotations but I haven't really looked into this.
    Writing the XML schema first allows you to offload more work on the XML parser at run time because it can do the schema validation for you instead of you having to manually perform this. This also allows someone writing their own client to consume the WSDL and be able to generate a client that will do more work than one based off of Java classes (e.g. someone creating a .NET client can let the XML parser do some heavy lifting during the marshalling process before ever sending the request to your web service).

  • Different classes problems

    I posted a topic asking for feedback on a Vigenere Cipher program I made. It was said that I shouldn't have the entire program in one class, and should have different class... or methods?
    I've been reading the tutorial for different classes, but I just can't seem to pick it up. I anticipate I'm gonna get a few replies with people saying 'you should read this smelly student' but I've tried, so I figure this may be a way to break me in :).
    So, here's my code:
    public class VigenereCipherComplete
         public static void main(String[] args)
         String key, message;
         String encrMessage = "";
         String[] options = new String[] {"Encrypter", "Decrypter", "Cancel"};
         int progChoice, keyLength, length, encrCharValue;
         int index;
         int keyIndex = 0;
         char keyChar;
         char messageChar;
         char encrChar;
         boolean shouldEncrypt = true;
         // Choice of whether to use the encrypter of decrypter
            progChoice = JOptionPane.showOptionDialog(null, "Which would you like to run?", "Program choice",
                 JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
            if(progChoice == 0)
                 shouldEncrypt = true;
            else if(progChoice == 1)
                shouldEncrypt = false;
        else
           System.exit(0);
         // Input of key and converting it to upper case
         key = JOptionPane.showInputDialog(null, "Please input the key you wish to use:",
              "Key input", JOptionPane.QUESTION_MESSAGE);
         key = key.toUpperCase();
         // Input of message and converting it to upper case
         message = JOptionPane.showInputDialog(null, "Please input the plaintext you wish to use:",
              "Plaintext input", JOptionPane.QUESTION_MESSAGE);
         message = message.toUpperCase();     
         keyLength = key.length();
         length = message.length();
         // Encryption/decryption
         for(index = 0; index < length; index++)
              keyChar = key.charAt(keyIndex);
              messageChar = message.charAt(index);
              if(messageChar >= 'A' && messageChar <= 'Z')
                   // Encryption
                   if(shouldEncrypt)     
                        encrCharValue = (keyChar - 'A') + messageChar;
                   // Decryption
                   else
                        if(messageChar >= keyChar)
                             encrCharValue = (messageChar + 'A') - keyChar;
                        else
                             encrCharValue = ((('Z' - keyChar) + messageChar) + 1);
                   // Loops ascii char value larger than 90 so it stays within the 65-90 ascii char range
                   if(encrCharValue > 'Z')
                        encrCharValue = (encrCharValue - 'Z') + 'A' - 1;
                   // Converts the char value to a char and adds it to the converted string
                   encrChar = (char)encrCharValue;
                   encrMessage = encrMessage + encrChar;
                   keyIndex++;     
              // If the char is not a letter, it leaves it as it is and adds it to the converted string     
              else
                   encrCharValue = messageChar;
                   encrChar = (char)encrCharValue;
                   encrMessage = encrMessage + encrChar;
              // Resets key so it will loop for the full string wanting to be converted
              if (keyIndex >= keyLength)
                   keyIndex = 0;
         // Output for encryption
         if(shouldEncrypt)
              System.out.println("Plaintext:\t" + message + "\nKey:\t\t" + key + "\nCiphertext:\t" + encrMessage);
         // Outfor for decryption
         else
              System.out.println("Ciphertext:\t" + message + "\nKey:\t\t" + key + "\nPlaintext:\t" + encrMessage);
    }I just can't grasp how I'd do this... Sorry for the ambigious question.

    I'm not going to read all your code. However, it's reasonable to put the code for one encryption algorithm into one class. If you were writing an entire encryption library, you might find that several of your algorithms (each in their own class) are all using the same code, and you're copying it from one class to another. In this case, you might extract that common code out to a utility class that various algorithms make use of.
    Now, if we assume that your question is, "How can I break this code into smaller pieces?" here are a few suggestions, based on a cursory skimming of your code. Note that these are only guidelines, to give you an idea of the kinds of things that make sense to break out as pieces.
    1. Keep the GUI separate from the encryption. You should have a VigenereEncryption or somesuch class that actually does the work of encrypting and decrypting, and this class should not know or care if there even is a GUI.
    2. In the VE class, I would imagine you'd want an encrypt() method and a decrypt() method.
    3. Anywhere you see multiple levels of nesting, one or more of those levels might be a candidate to pull out into its own method.
    4. Anywhere you have repeated code that's more than a couple lines, put it in its own method.
    5. Anywhere you have a comment like // perform such and such step above a block of code, that block is a good candidate to get pulled out into its own method, named similar to whatever that step is in your comments.
    6. Similarly, when you learn what the high-level algorithm is that you're to be implementing, the steps of that algorithm are candidates to be their own methods.
    Again, note that this is not carved in stone and is not meant to be taken literally as "do exactly all of these things." Rather, it is to give you ideas about the kinds of things that make for separation of classes and methods.

  • What is the diffrence between My Runnable Interface and Java Runnable

    Hi folks
    all we know that interfaces in java just a decleration for methods and variables.
    so my Question is why when i create an interface its name is "Runnable" and i declared a method called "run" inside it.then when i implements this interface with any class don't do the thread operation but when i implement the java.lang.Runnable the thread is going fine.
    so what is the diffrence between My Runnable Interface and Java Runnable?
    thnx

    Hi folks
    all we know that interfaces in java just a decleration
    for methods and variables.
    so my Question is why when i create an interface its
    name is "Runnable" and i declared a method called
    "run" inside it.then when i implements this interface
    with any class don't do the thread operation but when
    i implement the java.lang.Runnable the thread is going
    fine.
    so what is the diffrence between My Runnable Interface
    and Java Runnable?
    thnxClasses and interfaces are not identified by just their "name", like Runnable. The actual "name" the compiler uses is java.lang.Runnable. So even if you duplicate the Runnable interface in your own package, it's not the same as far as the compiler is concerned, because it's in a different package.
    Try importing both java.util.* and java.awt.* (which both have a class or interface named List), and then try to compile List myList = new ArrayList();

  • Java Applets and multiple classes not working.

    I have tested my JApplet class alone to view its layout and to make sure it actually works. But once I add in my other classes, compile, jar, and test I get the error:
    java.lang.NoClassDefFoundError: AlakApp (wrong name: alak/codeFiles/AlakApp)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    4)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
            at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:155)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:127)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
            at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:618)
            at sun.applet.AppletPanel.createApplet(AppletPanel.java:779)
            at sun.applet.AppletPanel.runLoader(AppletPanel.java:708)
            at sun.applet.AppletPanel.run(AppletPanel.java:362)
            at java.lang.Thread.run(Thread.java:619)My Directory contains these and only these:
    F:\alak\codeFiles:
      AlakApp.java
      Game.java
      Board.java
      Space.java
      index.html
      AlakGame.jarAll my classes are in the package alak.codeFiles.
    My .html file contains this:
    <HTML>
    <HEAD>
      <TITLE>ALAK</TITLE>
    </HEAD>
    <BODY>
      <applet code="AlakApp.class" archive="AlakGame.jar" width=400 height=200>
      Please use a Java compatible browser to see this.
      </applet>
      <br>
    </BODY>
    </HTML>These are they commands I am issuing:
    F:\alak\codeFiles>javac *.java
    F:\alak\codeFiles>jar -cvf AlakGame.jar *.class
    F:\alak\codeFiles>appletviewer index.htmlI've been trying many different things to narrow down what is going on. If you need to see my code let me know, but I've tested everything with a text-based user interface and they work.
    So does anyone know the cause of this error?

    Ok i rared the test and uploaded to rapidshare.. here is the link:
    http://rapidshare.com/files/76860865/test.rar.html
    But here is the code. They are in the directory /test/files/
    ADigit.java
    package test.files;
    public class ADigit
      private int value;
      public ADigit( int val )
       this.value = val;
      public String toString()
       return "" + this.value;
    }ADigitApp.java
    package test.files;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ADigitApp extends JApplet implements ActionListener
      private ADigit numeroUno;
      private int currentNum;
      private Container container;
      private javax.swing.JLabel jLabel;
      private javax.swing.JTextArea jTextArea;
      private javax.swing.JButton jButton;
      public void init()
        currentNum = 1;
        numeroUno = new ADigit( currentNum );
         container = getContentPane();
        container.setLayout( new BorderLayout() );
         jLabel = new javax.swing.JLabel();
         jTextArea = new javax.swing.JTextArea();
         jLabel.setText( "The Number is: " );
         jTextArea.setText( numeroUno.toString() );
         jButton = new javax.swing.JButton();
         jButton.setText( "New Number" );
        jButton.addActionListener( this );
         container.add( jLabel, BorderLayout.WEST );
         container.add( jTextArea, BorderLayout.CENTER );
         container.add( jButton, BorderLayout.EAST );
        setSize( 200, 200 );
      public void actionPerformed( ActionEvent e )
        this.currentNum++;
         numeroUno = new ADigit( this.currentNum );
         jTextArea.setText( numeroUno.toString() );
    }index.html
    <HTML>
    <HEAD>
      <TITLE>NUMBERSSSS</TITLE>
    </HEAD>
    <BODY>
      <applet code="ADigitApp.class" archive="NumberFun.jar" width=200 height=200>
      Please use a Java compatible browser to see this.
      </applet>
      <br>
    </BODY>
    </HTML>Commands:
    /test/files>javac *.java
    /test/files>jar -cvf NumberFun.jar *.class
    /test/files>appletviewer index.htmlThis example produces the same style of error.

  • Whats the difference between an INTERFACE and a CLASS?

    Whats the difference between an INTERFACE and a CLASS?
    Please help.
    Thanx.

    http://search.java.sun.com/search/java/index.jsp?col=javaforums&qp=%2Bforum%3A31&qt=Difference+between+interface+and+class

  • WDP calling EJB and passing objects of classes from Java project

    Hi.
    We have <b>Java</b> project which contains some classes common for all projects (like xxx.Version).
    We have <b>EJB</b> project which defines EJB interface using these common classes (like getVersion(String,int): xxx.Version and getCurrency(String,xxx.Version,int):xxx.Currency ).
    We have <b>Web Dynpro</b> project which calls EJB:
    1. Lookup is successful
    2. call to getVersion is successful
    3. call to getCurrency fails with <b>NoSuchMethodException</b>:
    xxx.XXXObjectImpl0.getCurrency(java.lang.String, xxx.Version, int)
         at java.lang.Class.getMethod(Class.java:986)
         at com.sap.engine.services.rmi_p4.reflect.LocalInvocationHandler.invokeInternal(LocalInvocationHandler.java:51)
         at com.sap.engine.services.rmi_p4.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:53)
         at $Proxy346.getCurrency(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187)
         at $Proxy347.getCurrency(Unknown Source)
         at xxx.XXX.getCurrencyWrapper(XXXXX.java:24)
    How can I set dependencies to get this running?
    Thanks to all
           Volker

    Hi,
    Is it available in the interface you are using..
    If the answer is yes.. you might have probably forgotten to deploy the EJBs ear file after making the changes..
    Rebuild it.. and deploy the EJB s ear file again..
    It will solve the problem.. If that also does not work,it might be a problem with the cache.. restart the server..
    It should work now !
    Regards
    Bharathwaj

  • [svn:bz-trunk] 14341: BLZ-476 : Getting different error message in server' s servlet log and console log when class is not of expected type.

    Revision: 14341
    Revision: 14341
    Author:   [email protected]
    Date:     2010-02-22 13:19:46 -0800 (Mon, 22 Feb 2010)
    Log Message:
    BLZ-476 : Getting different error message in server's servlet log and console log when class is not of expected type.
    Ticket Links:
        http://bugs.adobe.com/jira/browse/BLZ-476
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/MessageBrokerServlet.java
        blazeds/trunk/modules/core/src/flex/messaging/util/ClassUtil.java

    Hi, wbracken ,
    As known, there are 2 different questions I raised.
    Regarding the reply for the second one (Nothing to do with Chinese), I noticed there are several similar issues found in this forum, and it seems no response could solve my that problem. The related methods and classes were also well check, as well as the parameters put.
    Any way, your reponse was appreciated.
    Thank you for the help.

  • Separate interfaces and classes in separate packages?

    I am writing an application in the package 'models.geometry'. I am beginning to get a growing number of interfaces with corresponding implementation classes. I therefore consider adding another packages an move all the interfaces to this package and keep the implementation in the original package:
    'models.igeometry' // for the interfaces
    'models.geometry' // for the implementation
    But is this interface/class - package separation good practice?

    First of: Usage of the prefix "I" to identify interfaces is rather rare in the Java world (it's not unheard of, but definitely not the norm). And I've never seen "i<package>" to identify a package containing interfaces, so I wouldn't suggest it.
    The question is: What does the code which uses your packages access? Does it only need the interfaces and a factory? In this case, I'd separate the packages into "models.geometry" and "models.geometry.impl".
    If the classes are first-level API, just as the interfaces (think Link/ArrayList, Map/HashMap), then I'd keep them in the same package or separate them on some other property.

  • About interface and class[Please read this]

    I writing what I found out:
    myinterface.java
    interface myinterface
    class A
    A()
    {System.out.println("A()
    of interface");}
    A.java
    class A implements
    myinterface
    A(){System.out.println("A()
    of A.java");}
    public static void main
    (String args[])
    A a=new A();
    //this calls A() of interface
    //myinterface.java
    //how come the output of
    // this code is like this

    how come this is possible?Well, it had to pick one or the other, since they
    have the same symbol name. Why are you choosing to
    make up goofy names that collide in the first place?
    If you want to explicitly use one or the other, you
    need to also choose a package name, and fully-qualify
    the class name that you are trying to instantiate.For example:
    package test;
    interface MyInterface // renamed to follow standard naming convention
      class A
        A() { System.out.println("A() of interface"); }
    class A implements MyInterface
      A() {System.out.println("A() of A.java"); }
      public static void main(String args[])
        test.A a = new test.A(); // prints A() of A.java
        MyInterface.A a1 = new MyInterface.A(); // prints the other one
    }

Maybe you are looking for

  • Problem with Change Doc BANF for BUS2009

    Hi,   The scenario of mine is to trigger the REJECTION_STOP event of BUS2009  when a PR rejection is cancelled for that I am using Change documents. I have created an entry in SWEC for change doc object BANFand BO BUS2009- REJECTION_STOP. The problem

  • Adobe Bridge/Camera RAW Question

    Hello. Can anyone tell me what the little gray circle icon with the two arrows in it is? This icon appears on RAW image thumbnails after opening a RAW file in Camera RAW via Adobe Bridge. When you mouseover it says nothing, when you click on it it do

  • CA reporting wrong DOFD---UPDATE

    I have been trying to figure out why this debt wasn't due to fall off my report until next year when I stopped paying the OC in May 2008, and today I called EX and they told me the DOFD was 6/2009 which is WRONG. She initiated a dispute for me statin

  • Epson Printer Driver Update 2.3.1

    Software Update just informed me that this update is available; for now I've chosen to ignore it because a) my AIO printer functions flawlessly and b) I thought I'd read that the new update tends to result in problems. Has anyone installed it and exp

  • Device type for printer LOCL

    Hi everyone, Do you know a device type for LOCL that will be suitable for all the formats? Our users are using printer LOCL. We Had an issue before that the font of the printout is larger than the usual so we changed the device type. Recently, anothe