2 Replies Latest reply on Nov 3, 2018 1:35 PM by verytired

    Wildfly 13.0.0Final EJB problem.

    verytired

      Hello.

      Im a jnior java developer and i got thrown into my first assignment begining of this year and now I'm working on a migration project. I'm moving code from JBOSS 5.1.0 to a Wildfly 13.0.0Final server.

       

      The Project is a "simple" Enterprise Project with web part, client part and EJB part. IVe managed to get most of it to work now. but im having issues with the persistence? of some data. Ive managed to make a simpler Project that gets the same problem im gettign in the migrated Project.

       

      The Project is basicaly this layout:

      WebClientEJB
      HelloCoffee.jspCommand.javaCoffeeLoverUnitedBean.java
      GiveMeCoffeNow.javamainCommand.java
      StartClass.javaTargetableCommand.java
      CoffeeLoverUnitedRemote.java

       

      JNDILookupClass.java

      Pardon my bad naming standard and inconsistency.

       

      So starting from the Web. Hello coffee calls on StartClass wich then has an object of GiveMeCoffee.

      GiveMeCoffee extends TargetableCommand, wich in its self extends Command wich extends serializable.

       

      GiveMeCoffee has two string members wich I'm setting to null and "". It also has a method thats named performExecute()

      TargetableCommand is an abstract class with performExecute() as abstract and execute() as a defined method.

      this in it self calls on mainCommands static method executeCommand(TargetableCommand cmd)

      inside mainCommand.executeCommand() we make our lookup to the EJB CoffeeLoverUnitedBean wich then performs the GiveMeCoffeeNow.performExecute().

       

      I know its a bit messy. but in it all it all works. the methods gets called. and the GiveMeCoffeeNow.performExecute() Changes the member strings to diffrent values. but after its executed. when we try to do a System.out.prinln on the members, they havnt changed.

       

      I've attached the Project folderers here:

      Im using Eclipse Oxygen 4.7.3

      JDK 1.8.0_172

      Wildfly 13.0.0Final.

       

      Would appreciate all the help I could get. also pardon my narcisistic package names >.<

        • 1. Re: Wildfly 13.0.0Final EJB problem.
          stonesoft

          I don't think it causes the problem but just as a note you don't need to do a String x = new String("xxx") you can just do the assignment String x = "xxx".

          Have you already solved your problem?  If not I will spend some time tomorrow really looking into it. (no guarantee because I don't have a bunch of experience either)

          • 2. Re: Wildfly 13.0.0Final EJB problem.
            verytired

            Sorry for the late reply

            I did infact solve the issue but its not a neat solution but still think its an idea if someone is tuck with the same issue. Unless you are allowed to rewrite the solution.

             

            changes i made:

             

            • in the bean I changed  that the method returned a TargetableCommand.
            • in TargetableCommand i added a new method  that returned a TargetableCommand and took a parmaeter of a TargetableCommand so in short:
              public TargetableCommand execute(TargetableCommand cmd)
              {
                    cmd = CommandTarget.executeCommand(cmd);
                    return cmd;
              }
            • In CommandTarget we changed the method executeCommand, from a void to return a TargetableCommand, and then return the bean after we performed its execute.
            • in GetCoffeNow we added a new method called wf13Layer() it looks similar to the performExecute but instead of the logic we call upon execute like this:
              GetCoffeNow  tmp;
              try{
              tmp = (GetCoffeNow ) execute(this);

            I know its a horrible way to do it but due to time constraints and such, this was the "easiest" way. I honestly hope this helps someone.

             

            Thank you all for reading this.