0 Replies Latest reply on Jun 19, 2005 4:10 AM by yves jamoneau

    trying to run the crimeportal application

    yves jamoneau Newbie

      Hello,
      I have been trying to run the crimeportal application given as an example in JBoss.
      I am running Jboss4.0.2
      I transferred the project under Eclipse and deployed it using the Lomboz deployer, but leaving all the classes (Bean, Home, LocalHome, etc) as supplied on the JBoss site, and using the provided .xml files. I only modified the jndi addresses in the .xml files.
      When I start JBoss, all seems OK, the new tables are added to HSQLDB database. Of course, they are empty.
      Then, I created a sister project and created in it a client class. It is a JFrame with an initialisation button, behind which I copied and quickly adapted the code from the provided CrimePortalSetup class, which is supposed to fill the database tables. I do get access to the home interfaces, but when the program tries to create the entities, it breaks down.
      please could somebody give me a hint to the solution of the problem??
      Thanking you in advance.
      Yves Jamoneau (ulyssenantes@free.fr)


      CODE BEHIND THE INITIALIZATION BUTTON:
      private void initialisation() throws Exception
      {
      Hashtable props = new Hashtable();

      props.put(InitialContext.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      props.put(InitialContext.PROVIDER_URL, "jnp://127.0.0.1:1099");

      System.out.println("avant initial context");
      //
      Context jndi = new InitialContext(props);
      System.out.println("après initial context");
      OrganizationHome organizationHome = (OrganizationHome) jndi.lookup("portailducrime/Organization");
      System.out.println("après organization");
      GangsterHome gangsterHome = (GangsterHome) jndi.lookup("portailducrime/Gangster");
      System.out.println("après gangster");
      JobHome jobHome = (JobHome) jndi.lookup("portailducrime/Job");
      System.out.println("après job");
      LocationHome locationHome = (LocationHome) jndi.lookup("portailducrime/Location");
      System.out.println("après location");
      // Create some organizations
      Organization yakuza = organizationHome.create("Yakuza", "Japanese Gangsters");
      //-------------------------THE CODE BREAKS DOWN ON THE PREVIOUS LINE,
      //SEE FURTHER DOWN FOR THE CONSOLE OUTPUT
      System.out.println("après yakuza");
      Organization mafia = organizationHome.create("Mafia", "Italian Bad Guys");
      Organization triads = organizationHome.create("Triads", "Kung Fu Movie Extras");

      // Create some gangsters
      Gangster yojimbo =
      gangsterHome.create(YOJIMBO, "Yojimbo", "Bodyguard", 7, yakuza);
      ContactInfo contactInfo = new ContactInfo();
      contactInfo.setEmail("yojimbo439@yakuza.jp");
      contactInfo.setCell(new PhoneNumber(123, 456, 7890));
      contactInfo.setPager(new PhoneNumber(111, 222, 3333));
      yojimbo.setContactInfo(contactInfo);
      yojimbo.setHangout(locationHome.create("Red Dragon Basement", "1452 Stockton Street", "San Fran", "CA", 94108));

      Gangster takeshi = gangsterHome.create(TAKESHI, "Takeshi", "Master", 10, yakuza);
      takeshi.setHangout(locationHome.create("Flaming Fist Dojo", "598 Jackson Street", "San Fran", "CA", 94133));
      Gangster yuriko = gangsterHome.create(YURIKO, "Yuriko", "Four finger", 4, yakuza);
      yuriko.setHangout(locationHome.create("Sister's House", "1411 Powell Street", "San Fran", "CA", 94133));

      Gangster chow = gangsterHome.create(CHOW, "Chow", "Killer", 9, triads);
      chow.setHangout(locationHome.create("Golden Gate Fortune Cookie Factory", "56 Ross Alley", "San Fran", "CA", 94133));
      Gangster shogi = gangsterHome.create(SHOGI, "Shogi", "Lightning", 8, triads);
      shogi.setHangout(locationHome.create("The Wok Shop", "718 Grant Avenue", "San Fran", "CA", 94133));

      Gangster valentino = gangsterHome.create(VALENTINO, "Valentino", "Pizza-Face", 4, mafia);
      valentino.setHangout(locationHome.create("Luca's", "299 Madison Avenue", "New York", "NY", 10017));
      Gangster toni = gangsterHome.create(TONI, "Toni", "Toohless", 2, mafia);
      toni.setHangout(locationHome.create("Hotel Workers Union Shop", "225 S. Canal Street", "Chicago", "IL", 60661));
      Gangster corleone = gangsterHome.create(CORLEONE, "Corleone", "Godfather", 6, mafia);
      corleone.setHangout(locationHome.create("Black Diamond Casino", "9555 Las Vegas Blvd South", "Las Vegas", "NV", 89109));

      // Assign the bosses
      yakuza.setTheBoss(takeshi);
      triads.setTheBoss(chow);
      mafia.setTheBoss(corleone);

      // Create some jobs
      Job jewler = jobHome.create("10th Street Jeweler Heist");
      jewler.setScore(5000);
      jewler.setSetupCost(50);

      Job train = jobHome.create("The Greate Train Robbery");
      train.setScore(2000000);
      train.setSetupCost(500000);

      Job liquorStore = jobHome.create("Cheap Liquor Snatch and Grab");
      liquorStore.setScore(50);
      liquorStore.setSetupCost(0);

      // assign some gangsters to the jobs
      jewler.getGangsters().add(valentino);
      jewler.getGangsters().add(corleone);

      train.getGangsters().add(yojimbo);
      train.getGangsters().add(chow);

      liquorStore.getGangsters().add(chow);


      }


      ---------------
      PRINTSTACKTRACE CONSOLE OUTPUT UNDERNEATH, WHEN THE INITIALISATION BUTTON IS PRESSED
      ---------------

      avant initial context
      après initial context
      après organization
      après gangster
      après job
      après location
      java.lang.NullPointerException
      plantage=null
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:118)
      at $Proxy0.create(Unknown Source)
      at ihm.FGang.initialisation(FGang.java:218)
      at ihm.FGang.access$0(FGang.java:194)
      at ihm.FGang$1.actionPerformed(FGang.java:156)
      at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
      at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
      at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
      at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
      at java.awt.Component.processMouseEvent(Unknown Source)
      at javax.swing.JComponent.processMouseEvent(Unknown Source)
      at java.awt.Component.processEvent(Unknown Source)
      at java.awt.Container.processEvent(Unknown Source)
      at java.awt.Component.dispatchEventImpl(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
      at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
      at java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.awt.Window.dispatchEventImpl(Unknown Source)
      at java.awt.Component.dispatchEvent(Unknown Source)
      at java.awt.EventQueue.dispatchEvent(Unknown Source)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.awt.EventDispatchThread.run(Unknown Source)