2 Replies Latest reply on May 31, 2005 10:09 PM by Michael Engel

    Entity Tutorial error

    Bill Burke Master

      This may be the problem:

      I missed a step in the installation instructions. Copy jboss-aop-jdk50.deployer to deploy, but also remove jboss-aop.deployer/ directory. Does that fix the problem?

        • 1. Re: Entity Tutorial error
          Patrik Meisinger Newbie

           

          "brazilian" wrote:
          I have this error in jboss IDE 1.5:

          Exception in thread "main" javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: org.jboss.aspects.remoting.PojiProxy (no security manager: RMI class loader disabled)]

          i got the same problem ...

          "bill.burke@jboss.com" wrote:
          This may be the problem:

          I missed a step in the installation instructions. Copy jboss-aop-jdk50.deployer to deploy, but also remove jboss-aop.deployer/ directory. Does that fix the problem?


          and that didn't fix my problem, i already used the latest installation instructions.

          • 2. Re: Entity Tutorial error
            Michael Engel Newbie

            I recieved a similar error doing a test on my entity bean. I am using Jboss 4.0.2, ejb3 preview 5, and Jboss IDE 1.5. On the client I added the following line and this fixed my problem.

            SecurityManager security = System.getSecurityManager();

            I hope this is your solution as well. Sorry about the long post but I felt I need to show the code as well.

            Mike


            Client.java

            package test.emas.patient.client;

            import javax.naming.InitialContext;
            import javax.naming.NamingException;

            import emas.patient.PersonManager;

            public class Client {

            InitialContext ctx;
            PersonManager personMgr;
            SecurityManager security = System.getSecurityManager();

            public static void main(String[] args) throws NamingException {
            new Client().go();
            }

            private void go() throws NamingException{
            System.out.println("getting ctx");
            this.ctx = new InitialContext();
            System.out.println("got ctx");

            System.out.println("getting personmgr");
            this.personMgr = (PersonManager)ctx.lookup(PersonManager.class.getName());
            System.out.println("got personmgr");

            System.out.println("creating person");
            this.personMgr.createPerson(123456789,"grouch","","testy","19700505", "MALE");
            System.out.println("person created");


            }

            }

            PersonManager.java

            package emas.patient;

            import javax.ejb.Remote;


            @Remote
            public interface PersonManager {

            public abstract void createPerson(
            int ssn,
            String nameLast,
            String nameFirst,
            String nameMiddle,
            String dob,
            String gender
            );

            }

            PersonManagerBean

            package emas.patient;

            import javax.ejb.Inject;
            import javax.ejb.Stateless;
            import javax.persistence.EntityManager;

            @Stateless
            public class PersonManagerBean implements PersonManager {

            @Inject
            private EntityManager manager;
            private Person person;

            public void createPerson(
            int ssn,
            String nameLast,
            String nameFirst,
            String nameMiddle,
            String dob,
            String gender
            ){

            this.person = new Person();

            this.person.setSsn(ssn);
            this.person.setNameLast(nameLast);
            this.person.setNameFirst(nameFirst);
            this.person.setNameMiddle(nameMiddle);
            this.person.setDob(dob);
            this.person.setGender(gender);

            this.manager.persist(this.person);

            }
            }



            Person.Java

            /**
            *
            */
            package emas.patient;

            import java.io.Serializable;

            import javax.persistence.Entity;
            import javax.persistence.GeneratorType;
            import javax.persistence.Id;

            @Entity
            public class Person implements Serializable {

            private static final long serialVersionUID = 1L;
            private int id;
            private int ssn; //Social Security Number

            private String nameLast;
            private String nameFirst;
            private String nameMiddle;
            private transient String initials;

            private String namePrefix;
            private String nameSuffix;

            private String dob; //Date of Birth
            private transient int age;
            private String gender;

            // Getter and setter methods

            }