Must implement specifik interface

Hi,
Im creating a game to force myshelf to code a game-engine, just for fun. In this game I have superclass for a basic unit. This class gets subclassed down to game-units. I have different type of game units, some more advanced than others (my game idea is like a manager game where choose between units similar to warcraft 3 units).
To help the game-engine separate between the different type of units and the methods that can be used on them, I want to use differtent interface for the advanced units. This could be the start of the Wizard-class:
public class Wizards extends BasicUnit implements SpellCaster {
// method and variables that are specific for a wizard and dont excist in BasicUnit
}Question is: How can I force a method in the game-enginge class to look if a used unit implements a certain interface, in this case the SpellCaster-interface?
I know it should be possible, like the Comparable Interface. But how do i do it?
If its a dumb question a link to the specifik documents would do, I read it myshelf. But of course I would be happy if someone have the kindness to write an example. Again, this aint homework, just a fun x-mas project for me.

Ani_Skywalker wrote:
Hi again Jverd,
I google [visitor pattern|http://en.wikipedia.org/wiki/Visitor_pattern] and through that I also find [virtual function|http://en.wikipedia.org/wiki/Virtual_functions] . I can see how its usefull in this issue.
Thought my main concern for the moment is about [composition over inheritance|http://blogs.msdn.com/steverowe/archive/2008/04/28/prefer-composition-over-inheritance.aspxI]. This is not what we learned in school when I took my first and second java courses. But I think the composition over inheritance strategy seems very sensible.
jverd wrote:
I don't really know your whole picture, but one option is to define a type that has those particular operations in common, and pass that type around when that's what you need. The subclasses could inherit from a base class that provides those, or implement an interface, and then add their own methods.But this is exactly what my class BasicUnit does. Maybe my english is bad and I misslead you, or maybe I should pick a better name for that class, like Unit. But what it does is to hold methods that every unit in the game use. Subclasses that need more methods adds that. The way you wrote your example is kind of how I've done it, as it seems to me. Could you tell me were you think I do wrong?It may have just been a misunderstanding on my part, as I don't know you and I don't know your requirements or the details of how you're implementing them.
Or it may be that you're kind of close to doing it correctly, but not quite. The situation I described as a good approach can look a lot like the not-so-good way I thought you were doing it. I'm kind of sleep-deprived right now, so I don't have the energy or brainpower to go into any more detail at the moment.
Good luck though. I expect somebody will continue helping you if you keep working at it.

Similar Messages

  • Stipulate that a parameterised type must implement an interface

    Hi,
    1000 excuses if this has been asked before:
    I want to say "abstract class AbstractHolder<Y>" and also say "oh by the way, Y must implement interface Snodgrass"
    In other words I want to limit the kind of subelements which are held by the AbstractHolder so that an attempt to establish an AbstractHolder subclass which holds subelements which do not implement Snodgrass results in a compiler error.
    Of course you can put in an "instanceof" check in the constructor... but I think generics should enable you to say "abstract class AbstractHolder<Y implements Snodgrass>"... they don't appear to...
    Anything to be done?
    Thanks - MRodent

    <Y extends Whatever>This works if Y is an interface extending interface Whatever.
    It works if Y is a class extending class Whatever.
    It works if Y is a class implementng interface Whatever.
    I believe you can also say <Y extends A, B, C> or <Y extends A & B & C>
    http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html
    http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf

  • Can Enum parameterized type implement an interface?

    I am trying to define a class that is parameterized with an Enum and the parameterized Enum must implement an interface. Here is some code:public interface MatchingEnum<E> {
        String match(); // This interface is not yet complete
    public class EnumField<E extends Enum<E> & MatchingEnum<E>> {
        private E enumeration;
        public EnumField(E enumeration) {
            this.enumeration = enumeration;
        private static class Test {
            EnumField<TestType> c;
        public enum TestType implements MatchingEnum<TestType> { One, Two, Three;
            public String match() {
                return null;
    }The problem is that the compiler complains that "classes cannot directly extend java.lang.Enum". If I delete the interface for the parameterized type(below) it compiles fine. Why can't the compiler handle this? Does specifying an Interface for an Enum bounds (E) force it to directly extend Enum? If so, why does the actual Enum compile?public class EnumField<E extends Enum<E>> {Blah, blah, blah... // This compiles
    public class EnumField<E extends Enum<E> & MatchingEnum<E>> {Blah, blah blah... // This does NOT compile

A: Can Enum parameterized type implement an interface?

Compiled from "EnumField.java"
public class com.dartcontainer.mdc.picaps.textui.screen.widget.EnumField extends java.lang.Object{
public com.dartcontainer.mdc.picaps.textui.screen.widget.EnumField(java.util.List);
  Code:
   0:   aload_0
   1:   invokespecial   #2; //Method java/lang/Object."<init>":()V
   4:   aload_0
   5:   aload_1
   6:   putfield        #1; //Field enumeration:Ljava/util/List;
   9:   return
public static void main(java.lang.String[]);
  Code:
   0:   new     #3; //class com/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$Test
   3:   dup
   4:   aconst_null
   5:   invokespecial   #4; //Method com/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$Test."<init>":(Lcom/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$1;)V
   8:   astore_1
   9:   getstatic       #5; //Field java/lang/System.out:Ljava/io/PrintStream;
   12:  new     #6; //class java/lang/StringBuilder
   15:  dup
   16:  invokespecial   #7; //Method java/lang/StringBuilder."<init>":()V
   19:  ldc     #8; //String t.m =
   21:  invokevirtual   #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
   24:  aload_1
   25:  getfield        #10; //Field com/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$Test.m:Ljava/lang/String;
   28:  invokevirtual   #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
   31:  invokevirtual   #11; //Method java/lang/StringBuilder.toString:()Ljava/lang/String;
   34:  invokevirtual   #12; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
   37:  return
static java.util.List access$100(com.dartcontainer.mdc.picaps.textui.screen.widget.EnumField);
  Code:
   0:   aload_0
   1:   getfield        #1; //Field enumeration:Ljava/util/List;
   4:   areturn
}

Compiled from "EnumField.java"
public class com.dartcontainer.mdc.picaps.textui.screen.widget.EnumField extends java.lang.Object{
public com.dartcontainer.mdc.picaps.textui.screen.widget.EnumField(java.util.List);
  Code:
   0:   aload_0
   1:   invokespecial   #2; //Method java/lang/Object."<init>":()V
   4:   aload_0
   5:   aload_1
   6:   putfield        #1; //Field enumeration:Ljava/util/List;
   9:   return
public static void main(java.lang.String[]);
  Code:
   0:   new     #3; //class com/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$Test
   3:   dup
   4:   aconst_null
   5:   invokespecial   #4; //Method com/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$Test."<init>":(Lcom/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$1;)V
   8:   astore_1
   9:   getstatic       #5; //Field java/lang/System.out:Ljava/io/PrintStream;
   12:  new     #6; //class java/lang/StringBuilder
   15:  dup
   16:  invokespecial   #7; //Method java/lang/StringBuilder."<init>":()V
   19:  ldc     #8; //String t.m =
   21:  invokevirtual   #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
   24:  aload_1
   25:  getfield        #10; //Field com/dartcontainer/mdc/picaps/textui/screen/widget/EnumField$Test.m:Ljava/lang/String;
   28:  invokevirtual   #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
   31:  invokevirtual   #11; //Method java/lang/StringBuilder.toString:()Ljava/lang/String;
   34:  invokevirtual   #12; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
   37:  return
static java.util.List access$100(com.dartcontainer.mdc.picaps.textui.screen.widget.EnumField);
  Code:
   0:   aload_0
   1:   getfield        #1; //Field enumeration:Ljava/util/List;
   4:   areturn
}

  • A Bean must implement the java.io.Serializable interface? What makes the di

    Hi, I have took an example from sun notes on JavaBeans (you can find the example here http://java.sun.com/developer/onlineTraining/Beans/beans02/page2.html). The code is like this.....
    import java.awt.*;
    import java.io.Serializable;
    public class SimpleBean extends Canvas
                     implements Serializable {
      private Color color = Color.green;
      //getter method
      public Color getColor() {
         return color;
      //setter method
      public void setColor(Color newColor) {
         color = newColor;
         repaint();
      //override paint method
      public void paint (Graphics g) {
         g.setColor(color);
         g.fillRect(20,5,20,30);
      //Constructor: sets inherited properties
      public SimpleBean() {
         setSize(60,40);
         setBackground(Color.red);
    }I didn't find any difference in executing the program by implementing the Serializable interface and without implementing. On choosing serialize component in the File Menu, I serialized the component after changing its color (property), and saved as .ser file. And created the .Jar file including .ser file. when I load the jar file and place the bean in the beanbox, it is showing the bean that is updated. This can be done by implemeting Serializable interface and without implementing Serializable interface also. And I have a statement that has been given in the notes provided by SUN. That is ' Bean must implement the Serializable interface. Objects that support this interface can save and restore their state from disk '. I couldnot come up with the summation of this statement.
    Anyone who has an idea... please give an explanation.
    Thank you.

    Maybe you should show us your coding how you saved your beans state.
    Are you serious that you save the special object? Or do you save the values of the object into a file and load those values into a new object?

  • Design Question - Class Must Implement Interface

    I'm not sure how to describe this in summary, really. I'd say that I sort of want multiple inheritance, but I don't want to be shot. :-P So let me describe the situation:
    I have an interface, DataEditingComponent<T>. The idea is that anything implementing the interface is capable of allowing the user to edit an object of type T. For example, a DataEditingComponent<Integer> would allow the user to input an integer. A DataEditingComponent<Map<SomeObj,Integer>> might represent an object capable of editing a table describing the number of instances of SomeObj. You get the idea. DataEditingComponent<T> describes three methods: getEditingData():T, setEditingData(T):void, and getDefaultEditingData():T. I'm assuming you can guess what those do.
    Well, the practical application of this interface is in the use of a Swing application. It provides a very clean and standardized way of adjusting the contents of components which edit data. Obviously, a JTextField would work about as well as a DataEditingComponent<String>, but for more complicated components (DataEditingComponent<GameWorldMap>, for instance), the standardized interface is very helpful.
    Since in practice everything that ever implements DataEditingComponent<T> extends JComponent, it would be nice to declare this as a requirement somehow. However, given that JComponent is extended into a number of various subclasses, I can't just go making DataEditingComponent<T> an abstract subclass.
    So far, the only conclusion I've reached is that I can take each and every JComponent subclass and extend it into an abstract subclass which implements DataEditingComponent<T>... but that's very ugly and quickly leads to other problems. And presently, I'm left casting things from one to the other, with which I am also not happy.
    So... any way out of this? Have I done something wrong design-wise? Or am I just stuck in a language limitation?
    Thanks for reading!

    I'm not sure how to describe this in summary, really.
    I'd say that I sort of want multiple inheritance,
    but I don't want to be shot. :-P So let me
    describe the situation:
    I have an interface, DataEditingComponent<T>. The
    idea is that anything implementing the interface is
    capable of allowing the user to edit an object of
    type T. For example, a DataEditingComponent<Integer>
    would allow the user to input an integer. A
    DataEditingComponent<Map<SomeObj,Integer>> might
    represent an object capable of editing a table
    describing the number of instances of SomeObj. You
    get the idea. DataEditingComponent<T> describes
    three methods: getEditingData():T,
    setEditingData(T):void, and
    getDefaultEditingData():T. I'm assuming you can
    guess what those do.
    Well, the practical application of this interface is
    in the use of a Swing application. It provides a
    very clean and standardized way of adjusting the
    contents of components which edit data. Obviously, a
    JTextField would work about as well as a
    DataEditingComponent<String>, but for more
    complicated components
    (DataEditingComponent<GameWorldMap>, for instance),
    the standardized interface is very helpful.
    Since in practice everything that ever implements
    DataEditingComponent<T> extends JComponent, it would
    be nice to declare this as a requirement somehow.
    However, given that JComponent is extended into a
    number of various subclasses, I can't just go making
    DataEditingComponent<T> an abstract subclass.
    So far, the only conclusion I've reached is that I
    can take each and every JComponent subclass and
    extend it into an abstract subclass which implements
    DataEditingComponent<T>... but that's very ugly and
    quickly leads to other problems. And presently, I'm
    left casting things from one to the other, with which
    I am also not happy.
    So... any way out of this? Have I done something
    wrong design-wise? Or am I just stuck in a language
    limitation?Hmm. The component is part of the view. The data is part of the model. Putting them together seems to go against the whole Model-View-Controller concept. You may want to have a look at how Swing separates the editing from the rendering from the model for complicated widgets such as JTable. The editors hava methods such as getEditorComponent() which returns the Component used to edit the data. Everywhere you are currently adding DataEditingComponent instances to your GUI, you can instead call a getDataEditingComponent() method, which can require that the returned object is a JComponent.

  • "Bean Class Must Implement X" message, but bean class does implement X

    When trying to deploy an .ear file on WebLogic 9.0 that contains an MDB EJB, I get a message like the following:
    In EJB ITS-MDB(Application: ITSNO,
    EJBComponent: ITSMDB.jar), the bean class must implement
    its.common.TelnetMessageListener. '
    The ITS-MDB EJB class (its.mdb.TelnetMessageListenerImpl) referenced in ejb-jar.xml DOES implement its.common.TelnetMessageListener, and both .class files exist in the same .jar file.
    (The TelnetMessageListener interface extends javax.ejb.MessageDrivenBean.)
    This .ear deploys without a problem on Oracle's OC4J and IBM's Websphere, so it appears that there is some Weblogic peculiarity (a bug, a different spec interpretation, etc.) causing the problem.
    This problem is happening on Weblogic 9.0 using Java 1.5.0_03 on Windows XP.
    Any ideas why this might be happening?

    Thanks for the suggestion, Rob.
    I checked to ensure that no out-dated TelnetMessageListenerImpl and TelnetMessageListener were being used. It looks like I am not using older versions.
    I first checked the classpath specified by the log, and did not see anywhere in there that would contain either of these classes.
    To be sure, I then decided to remove each class from the jar file and attempt to deploy it. If it succeeded, that would mean there was some other version of that file on the classpath.
    I first removed TelnetMessageListenerImpl from ITSMDB.jar, and then tried deploying it. As expected, I received the following message:
    Unable to deploy EJB: C:\bea\user_projects\domains\domain_good\.\servers\AdminServer\tmp\_WL_user\ITSNOMinus\fvdi9g\ITSMDB.jar from ITSMDB.jar:
    Unable to load a class specified in your ejb-jar.xml: its.mdb.TelnetMessageListenerImpl
         at weblogic.ejb20.deployer.EJBModule.prepare(EJBModule.java:371)
         at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:90)
    I then replaced TelnetMessageListenerImpl and attempted to remove TelnetMessageLister. I got a slightly different (but essentially the same) error:
    java.lang.NoClassDefFoundError: oracle/wireless/its/common/TelnetMessageListener
         at java.lang.ClassLoader.defineClass1(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
         at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:302)
         at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:255)
         at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:223)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:158)
         at weblogic.ejb20.deployer.EJBModule.setupEJBToImplClassDependencies(EJBModule.java:1396)
    Here is the exception stack I get will the original ITSNO deployment:
    ####<Sep 20, 2005 11:20:57 AM PDT> <Info> <Deployer> <jrozier-pc> <AdminServer> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1127240457892> <BEA-149059> <Module ITSMDB.jar of application ITSNO is transitioning from STATE_NEW to STATE_PREPARED on server AdminServer.>
    ####<Sep 20, 2005 11:20:58 AM PDT> <Info> <EJB> <jrozier-pc> <AdminServer> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1127240458002> <BEA-010008> <EJB Deploying file: ITSMDB.jar>
    ####<Sep 20, 2005 11:20:58 AM PDT> <Info> <Deployer> <jrozier-pc> <AdminServer> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1127240458080> <BEA-149061> <Module ITSMDB.jar of application ITSNO failed to transition from STATE_NEW to STATE_PREPARED on server AdminServer.>
    ####<Sep 20, 2005 11:20:58 AM PDT> <Info> <Deployer> <jrozier-pc> <AdminServer> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1127240458080> <BEA-149059> <Module ITSRA.rar of application ITSNO is transitioning from STATE_PREPARED to STATE_NEW on server AdminServer.>
    ####<Sep 20, 2005 11:20:58 AM PDT> <Info> <Deployer> <jrozier-pc> <AdminServer> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1127240458111> <BEA-149060> <Module ITSRA.rar of application ITSNO successfully transitioned from STATE_PREPARED to STATE_NEW on server AdminServer.>
    ####<Sep 20, 2005 11:20:58 AM PDT> <Error> <Deployer> <jrozier-pc> <AdminServer> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1127240458158> <BEA-149265> <Failure occured in the execution of deployment request with ID '1127240456080' for task '0'. Error is: 'weblogic.application.ModuleException: Exception preparing module: EJBModule(ITSMDB.jar)
    Unable to deploy EJB: C:\bea\user_projects\domains\domain_good\.\servers\AdminServer\tmp\_WL_user\ITSNO\x5gd0k\ITSMDB.jar from ITSMDB.jar:
    In EJB ITS-MDB(Application: ITSNO, EJBComponent: ITSMDB.jar), the bean class must implement its.common.TelnetMessageListener.
    weblogic.application.ModuleException: Exception preparing module: EJBModule(ITSMDB.jar)
    Unable to deploy EJB: C:\bea\user_projects\domains\domain_good\.\servers\AdminServer\tmp\_WL_user\ITSNO\x5gd0k\ITSMDB.jar from ITSMDB.jar:
    In EJB ITS-MDB(Application: ITSNO, EJBComponent: ITSMDB.jar), the bean class must implement its.common.TelnetMessageListener.
         at weblogic.ejb20.deployer.EJBModule.prepare(EJBModule.java:371)
         at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:90)
         at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:318)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:53)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:43)
         at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
         at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:236)
         at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:147)
         at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:191)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:84)
         at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:197)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:724)
         at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1137)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:224)
         at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:109)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:166)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:12)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:54)
         at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
    In EJB ITS-MDB(Application: ITSNO, EJBComponent: ITSMDB.jar), the bean class must implement its.common.TelnetMessageListener.
         at weblogic.ejb20.deployer.MessageDrivenBeanInfoImpl.initializeOnMessageMethodInfo(MessageDrivenBeanInfoImpl.java:593)
         at weblogic.ejb20.deployer.MessageDrivenBeanInfoImpl.<init>(MessageDrivenBeanInfoImpl.java:346)
         at weblogic.ejb20.deployer.BeanInfoImpl.createBeanInfoImpl(BeanInfoImpl.java:551)
         at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.initializeBeanInfos(MBeanDeploymentInfoImpl.java:597)
         at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.<init>(MBeanDeploymentInfoImpl.java:221)
         at weblogic.ejb20.deployer.EJBDeployer.prepare(EJBDeployer.java:1165)
         at weblogic.ejb20.deployer.EJBModule.prepare(EJBModule.java:344)
         at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:90)
         at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:318)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:53)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:43)
         at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
         at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:236)
         at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:147)
         at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:191)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:84)
         at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:197)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:724)
         at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1137)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:224)
         at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:109)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:166)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:12)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:54)
         at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
    >
    ####<Sep 20, 2005 11:20:58 AM PDT> <Warning> <Deployer> <jrozier-pc> <AdminServer> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1127240458252> <BEA-149004> <Failures were detected while initiating distribute task for application 'ITSNO'.>
    ####<Sep 20, 2005 11:20:58 AM PDT> <Warning> <Deployer> <jrozier-pc> <AdminServer> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1127240458252> <BEA-149078> <Stack trace for message 149004
    There are a few other updates since my first post as well:
    (1) I get the same message when I try to deploy just ITSMDB.jar as an application as I do when I try to deploy my ITSNO.ear (which contains both an RA and the MDB).
    (2) This same application now also works on JBoss. (I had to add a jboss.xml to tell the MDB about the RA.)
    (3) I fixed the ejb-jar.xml container-transaction element to refer to ITS-MDB (with a dash) instead of ITS_MDB (with an underscore). (This fix goes to show that some containers are more forgiving than others--OC4J and Websphere did not complain about it, but JBoss gave an error message and would not deploy until this was fixed.)

  • The type must implement the inherited abstract method???

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.ActiveEvent;
    import java.applet.*;
    public class MoveIt extends Applet implements ActionListener
         private Image cup;
         private Panel keyPad;
         public int yaxis = 15;
         public int xaxis = 15;
         private Button keysArray[];
         public void init()
              cup = getImage(getDocumentBase(), "cup.gif");
              Canvas myCanvas = new Canvas();
              setBackground(Color.blue);
              setLayout(new BorderLayout());
              Button up = new Button("Up");
              Button down = new Button("Down");
              Button right = new Button("Right");
              Button left = new Button("Left");
              Button center = new Button("Center");
              add(myCanvas, BorderLayout.NORTH);
              add(keyPad, BorderLayout.SOUTH);
              keyPad.add(up, BorderLayout.NORTH);
              up.addActionListener(this);
              keyPad.add(down, BorderLayout.SOUTH);
              down.addActionListener(this);
              keyPad.add(right, BorderLayout.EAST);
              right.addActionListener(this);
              keyPad.add(left, BorderLayout.WEST);
              left.addActionListener(this);
              keyPad.add(center, BorderLayout.CENTER);
              center.addActionListener(this);
         public void paint( Graphics g )
              g.drawImage( cup, xaxis, yaxis, this );
         public void ActionPerformed(ActionEvent e)
              String action = e.getActionCommand();
              if(action.equals("Up"))
                   yaxis = yaxis - 15;
              if(action.equals("Down"))
                   yaxis = yaxis + 15;
              if(action.equals("Left"))
                   xaxis = xaxis - 15;
              if(action.equals("Right"))
                   xaxis = xaxis + 15;
              if(action.equals("Center"))
                   xaxis = 125;
                   yaxis = 60;
    }How come there is an error:
    The type MoveIt must implement the inherited abstract method
    ActionListener.actionPerformed(ActionEvent)
    What the hell does that mean?

    A class that implements an interface must define the methods of the interface. Your applet (or the one you borrowed) states at the top that it implements the ActionListener interface. If you go to the API, you'll see that this interface declares a method "actionPerformed", and so this class must have a method that matches the one in the interface. I see that your applet will have some Buttons. You'll need an actionPerformed method if you want the buttons to use your class (this) as their action listener.
    Edit: I see that you already have an "ActionPerformed" method, but note that case matters, and this is not the same as "actionPerformed". Change one letter and you're on your way.
    Edited by: Encephalopathic on Jan 15, 2008 8:44 PM

  • Implementing Local Interface or not

    I wish to define a Local SessionBean as simply as possible.
    The following compiles ok:
    @Stateless
    @Local
    public class LocalSessionGreetingBean {
         @Resource
         private SessionContext sessionContext;
         * Default constructor.
        public LocalSessionGreetingBean() {
        }but does not deploy on JBoss 5.
    I am wondering is this because I am specified no interface in the @Local annotation?
    Because it works when I do that.
    I am confused, I thought I could get away with any interfaces as just have the Session as a POJO?
    Thanks?

    beginner2 wrote:
    I am confused, I thought I could get away with any interfaces as just have the Session as a POJO?
    Thanks?As far as I know that is true for JEE6, it certainly is not for JEE5 (and JBoss 5.X is a JEE5 server). You must implement the local interface or it won't work.

  • How an array implements an interface?

    Section 5.5 of JLS (dealing with casting conversions) explains something like this:
    When an interface type S is cast to an array type T,
    "then T must implement S, or a compile-time error occurs. "
    I could not understand how an array can be made to implement an interface.
    I guessed it means that the component type of array implements the interface, and prepared the following test code. It doesn't compile.
    interface S{  }
    class C implements S{ }
    class Test {
    public static void main(String[] args) {
         C[] ac = new C[100];
         S s = new C();
         C[] ac1 = (C[])s; //doesn't compile
         System.out.println(ac1.length);
    Would someone open my eyes? Thank you

    dmbdmb Your correction compiled my code. But I was not looking for that, because the corrected code casts an array type to array type. Anyway, thanks.
    jverdYou are the man. Now I got it. Thank you.
    I think I will have to remember your simplified rule (Then S must be Serializable or Cloneable) rather than the JLS' rule. With your rule, I can write a test code like this, which compiles, and which shows that an interface type can be cast to array type.
    import java.awt.Point;
    import java.io.Serializable;
    class Test {
            public static void main(String[] args) {
               Point[] pa = new Point[100]; //any array of reference type
               Serializable s = new String("test");
               Point[] pa1 = (Point[])s; //compiles, though invalid at runtime
    }

  • Implements an interface

    I make an abstract class to implements an interface, coz I only need some of the methods of the interface. why they give the error message said, it couldnt implements that methods, and "attempting to assign weaker access privileges"

    When you are implementing an interface, you must provide definitions for all interface methods. You can provide empty methods, or you can declare the ones you don't want to implement in the abstract class as abstract, but one way or another, you must provide them.

  • Achiving serialization without implementing the interface serializable.

    how to make a class serializable without implementing the interface the serializable.

    ... although the objects you're converting with XMLEncoder must be JavaBeans, not just any POJO.
    For the latter, you may want to look at XStream, or JSX.

  • Expression must return the interface type in Transformation Step in BPM

    hi,
    We are getting below while activating the IP,
    Expression must return the interface type SI_Send_AA
    Expression must return the interface type SI_Get_AA
    No semantic errors found
    We have a Transformation Step in BPM,
    In OM, Source is SI_Send_AA and Target is SI_Get_AA
    Also Container variable points to  the same Abstract SI's.
    Few Thread's for Same are error are:
    Error in  BPM
    expression must return the interface type
    Transformation step in ccBPM scenario
    Error while compiling Business Process
    Even after checking these i am getting this Exception.
    Please Help!
    Thanks,
    Mayank

    Also Container variable points to the same Abstract SI's
    Are you sure that you are using Abstract Message Interfaces only and that these are referring to relevant container variables.
    Normally it happens that there is some mis-match between the message types/ interfaces that we use in the mapping and that we use in the BPM.
    If still not solved, then delete the Transformation step --> save --> activate......then again Edit the BPM to include the Transformation Step.
    Regards,
    Abhishek.

  • How to implement XI interfaces in online and offline modes?

    Hi Everybody,
    Can you please tell me how to implement XI interfaces in online and offline modes?
    thanks a lot,
    Ramya Shenoy.

    Hi,
    Are you looking for Push and Pull mechanism of PI?
    When the adapters like SOAP, HTTP, IDOC, etc. send the data to PI , it is nothing but a push mechanism, and hence the communication is synchronous by default.
    But adapters like JDBC, File, etc. they fetch the data from Source Applications, so it is a kind of Pull mechanism for PI, and
    by default communication is asynchrnous.
    Pls elaborate exactly what are you looking for?
    Regards,
    Supriya.

  • Actual implementation of interfaces involved in JDBC connection creation

    Pl some body tell me where does the actual implementation of interfaces like connection,Statement,PreparedStatement..we use to to make a JDBC connection from a simple application or J2EE application.
    Thanks

    Hi sharma,
    JDBC API will be implemented by JDBC Driver vendors. For example Microsoft provide "com.microsoft.jdbc.sqlserver.SQLServerDriver" driver for SQL Server 2000. Similarly Oracle privide several JDBC Drivers to be used with Oracle databases.
    Sun has provided a JDBC-ODBC bridge (Driver) along with its JDK or JSDK. This driver is capable for connecting Java applications with any ODBC connection.
    Cuz this driver is included with the JDK/JSDK therefore you can use it to connect with for example MS Access DB or any other ODBC connected DB.
    If you want to connect your Java or J2EE application to some specific database then you should get the Driver for that particular database.
    regards,
    Humayun

  • How to find out in program which all classes have implemented an interface

    Hello,
    I have created an interface and few classes are implementing the interface.
    I want to know in a program which all class have implemented the interface.
    Is it possible to find it out and how?
    Regards,
    Bikash.

    Hi Bikash,
    Read the Database view VSEOIMPLEM with where condition REFCLSNAME = Interface Name and version = 1.
    This would give you all the classes which have implemented the interface and are active...
    If you want to look at the values that the field version can have then see Type Group SEOC ans search for version....
    Hope this help...
    Regards,
    Sitakant

  • Maybe you are looking for