[jboss-user] [EJB 3.0] - Doing BMP with EJB3. JNDI problems?

JGF1 do-not-reply at jboss.com
Fri Mar 7 12:27:14 EST 2008


Hi again.
Stuck on what I think is an ideosyncrasy in the way JBoss implements JNDI lookups. I was wondering if someone could shed some light?
Following along with Beginning Java EE 5 book again...
I have an application with following directory structure:

  | BMP
  |    +beans
  |  1   StockList.java
  |  2   StockListBean.java
  |    +beans_2x
  |  3   Stock.java
  |  4   StockBean.java
  |  5   StockHome.java
  |    +client
  |  6   StockClient.java
  |    +META-INF
  |  7   Application.xml
  |  8   Ejb-jar.xml
  |  9   Jboss.xml
  | 10 StockList2xBmp.jar  (contains 8,9, classes  for 3,4,5)
  | 11 StockListBmpApp.ear (contains 7 & 10)
  | 12 StockListApp.ejb3   (contains 1 & 2)
  | 
  | 11 Gets deployed first, followed by 12.
  | 6 is run with following command:
  | java -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces -Djava.naming.provider.url=localhost client.StockClient
  | 
  | 
  | 

Application.xml:

  | <?xml version="1.0" encoding="UTF-8"?>
  | <application xmlns="http://java.sun.com/xml/ns/javaee" 
  |  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  |  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application5.xsd"
  |  version="5">
  |   <display-name>StockListBmpApp</display-name>
  |   <description>Application description</description>
  |   <module>
  |    <ejb>StockList2xBmp.jar</ejb>
  |   </module>
  | </application>
  | 

ejb-jar.xml:


  | <?xml version="1.0" encoding="UTF-8"?>
  | <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" 
  |  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  |  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
  |  version="3.0">
  |   <display-name>StockListBmpJar</display-name>
  |   <enterprise-beans>
  |     <entity>
  |       <ejb-name>StockEjb</ejb-name>
  |       <home>beans_2x.StockHome</home>
  |       <remote>beans_2x.Stock</remote>
  |       <ejb-class>beans_2x.StockBean</ejb-class>
  |       <persistence-type>Bean</persistence-type>
  |       <prim-key-class>java.lang.String</prim-key-class>
  |       <reentrant>false</reentrant>
  |       <resource-ref>
  |         <res-ref-name>jdbc/StockDB</res-ref-name>
  |         <res-type>javax.sql.DataSource</res-type>
  |         <res-auth>Container</res-auth>
  |         <res-sharing-scope>Shareable</res-sharing-scope>
  |       </resource-ref>
  |       <security-identity>
  |         <use-caller-identity/>
  |       </security-identity>
  |     </entity>
  |   </enterprise-beans>
  |   <assembly-descriptor>
  |     <container-transaction>
  |       <method>
  |         <ejb-name>StockEjb</ejb-name>
  |         <method-intf>Remote</method-intf>
  |         <method-name>setName</method-name>
  |         <method-params>
  |           <method-param>java.lang.String</method-param>
  |         </method-params>
  |       </method>
  |       <trans-attribute>Required</trans-attribute>
  |     </container-transaction>
  |     <container-transaction>
  |       <method>
  |         <ejb-name>StockEjb</ejb-name>
  |         <method-intf>Remote</method-intf>
  |         <method-name>getName</method-name>
  |       </method>
  |       <trans-attribute>Required</trans-attribute>
  |     </container-transaction>
  |     <container-transaction>
  |       <method>
  |         <ejb-name>StockEjb</ejb-name>
  |         <method-intf>Remote</method-intf>
  |         <method-name>remove</method-name>
  |       </method>
  |       <trans-attribute>Required</trans-attribute>
  |     </container-transaction>
  |     <container-transaction>
  |       <method>
  |         <ejb-name>StockEjb</ejb-name>
  |         <method-intf>Remote</method-intf>
  |         <method-name>getTickerSymbol</method-name>
  |       </method>
  |       <trans-attribute>Required</trans-attribute>
  |     </container-transaction>
  |   </assembly-descriptor>
  | </ejb-jar>
  | 

Jboss.xml:

  | <!DOCTYPE jboss PUBLIC
  |           "-//JBoss//DTD JBOSS 4.0//EN"
  |           "http://www.jboss.org/javaee/dtd/jboss_4_0.dtd">
  | <jboss>
  |   <enterprise-beans>
  |     <entity>
  |       <ejb-name>StockEjb</ejb-name>
  |       <jndi-name>beans_2x.Stock</jndi-name>
  |       <resource-ref>
  |         <res-ref-name>jdbc/StockDB</res-ref-name>
  |         <jndi-name>java:/DefaultDS</jndi-name>
  |       </resource-ref>
  |     </entity>
  |   </enterprise-beans>
  | </jboss>
  | 

StockList.java interface:


  | package beans;
  | 
  | import javax.ejb.CreateException;
  | import javax.ejb.FinderException;
  | import javax.ejb.Remote;
  | 
  | @Remote
  | public interface StockList {
  |   // The public business methods on the StockList bean
  |   public String getStock(String ticker)
  |     throws FinderException;
  |   public void addStock(String ticker, String name)
  |     throws CreateException;
  |   public void updateStock(String ticker, String name)
  |     throws FinderException;
  |   public void deleteStock(String ticker)
  |     throws FinderException;
  | }
  | 

StockListBean:


  | package beans;
  | 
  | import beans_2x.Stock;
  | import beans_2x.StockHome;
  | import javax.ejb.CreateException;
  | import javax.ejb.FinderException;
  | import javax.ejb.SessionBean;
  | import javax.ejb.SessionContext;
  | import javax.ejb.Stateless;
  | import javax.naming.InitialContext;
  | import javax.naming.NamingException;
  | import javax.rmi.PortableRemoteObject;
  | 
  | @Stateless
  | public class StockListBean implements StockList {
  | 
  |   // The public business methods. These must be coded in the
  |   // interface also
  | 
  |   public String getStock(String ticker) 
  |     throws FinderException {
  |     try {
  |       StockHome stockHome = getStockHome();
  |       Stock stock = stockHome.findByPrimaryKey(ticker);
  |       return stock.getName();
  |     } catch (FinderException fe) {
  |       throw fe;
  |     } catch (Exception ex) {
  |       throw new RuntimeException(ex.getMessage());
  |     }
  |   }
  | 
  |   public void addStock(String ticker, String name) 
  |     throws CreateException {
  |     try {
  |       StockHome stockHome = getStockHome();
  |       Stock stock = stockHome.create(ticker, name);
  |     } catch (CreateException ce) {
  |       throw ce;
  |     } catch (Exception ex) {
  |       throw new RuntimeException(ex.getMessage());
  |     }
  |   }
  | 
  |   public void updateStock(String ticker, String name) 
  |     throws FinderException {
  |     try {
  |       StockHome stockHome = getStockHome();
  |       Stock stock = stockHome.findByPrimaryKey(ticker);
  |       stock.setName(name);
  |     } catch (FinderException fe) {
  |       throw fe;
  |     } catch (Exception ex) {
  |       throw new RuntimeException(ex.getMessage());
  |     }
  |   }
  | 
  |   public void deleteStock(String ticker) 
  |     throws FinderException {
  |     try {
  |       StockHome stockHome = getStockHome();
  |       Stock stock = stockHome.findByPrimaryKey(ticker);
  |       stock.remove();
  |     } catch (FinderException fe) {
  |       throw fe;
  |     } catch (Exception ex) {
  |       throw new RuntimeException(ex.getMessage());
  |     }
  |   }
  | 
  |   private StockHome getStockHome() 
  |     throws NamingException {
  |     // Get the initial context
  |     InitialContext initial = new InitialContext();
  | 
  |     // Get the object reference
  |     Object objref = initial.lookup("beans_2x.Stock");
  |     StockHome home = (StockHome)
  |       PortableRemoteObject.narrow(objref, StockHome.class);
  |     return home;
  |   }
  | 
  |   // Standard ejb methods
  |   public void ejbActivate() {}
  |   public void ejbPassivate() {}
  |   public void ejbRemove() {}
  |   public void ejbCreate() {}
  |   public void setSessionContext(SessionContext context) {}
  | }
  |  

Stock interface:

  | package beans_2x;
  | 
  | import java.rmi.RemoteException;
  | import javax.ejb.EJBObject;
  | 
  | public interface Stock extends EJBObject {
  |   // The public business methods on the Stock bean
  |   // These include the accessor methods from the bean
  | 
  |   // Get the ticker. Do not allow ticker to be set through the
  |   // interface because it is the primary key.
  |   public String getTickerSymbol() throws RemoteException;
  | 
  |   // Get and set the name
  |   public String getName() throws RemoteException;
  |   public void setName(String name) throws RemoteException;
  | }
  | 

StockBean:


  | package beans_2x;
  | 
  | import java.sql.Connection;
  | import java.sql.PreparedStatement;
  | import java.sql.ResultSet;
  | import java.sql.SQLException;
  | import javax.ejb.CreateException;
  | import javax.ejb.EJBException;
  | import javax.ejb.EntityBean;
  | import javax.ejb.EntityContext;
  | import javax.ejb.FinderException;
  | import javax.ejb.NoSuchEntityException;
  | import javax.ejb.ObjectNotFoundException;
  | import javax.naming.InitialContext;
  | import javax.naming.NamingException;
  | import javax.sql.DataSource;
  | 
  | public class StockBean implements EntityBean {
  | 
  |   // The persistent fields
  |   private String tickerSymbol;
  |   private String name;
  | 
  |   // Keeps the reference to the context;
  |   private EntityContext context;
  | 
  |   // Keeps the reference to the db connection
  |   private Connection connection;
  | 
  |   // The access methods for persistent fields
  |   public String getTickerSymbol() {
  |     return tickerSymbol;
  |   }
  | 
  |   public String getName() {
  |      return name;
  |   }
  | 
  |   public void setName(String name) {
  |     this.name = name;
  |   }
  | 
  |   // Standard entity bean methods
  | 
  |   public String ejbFindByPrimaryKey(String primaryKey)
  |     throws FinderException {
  | 
  |     boolean result;
  | 
  |     try {
  |       String stmt =
  |         "select tickerSymbol " +
  |         "from stock where tickerSymbol= ? ";
  |       PreparedStatement pstmt =
  |         connection.prepareStatement(stmt);
  |       pstmt.setString(1, primaryKey);
  |       ResultSet rs = pstmt.executeQuery();
  |       result = rs.next();
  |       pstmt.close();
  |     } catch (SQLException ex) {
  |       throw new EJBException("ejbFindByPrimaryKey: " + ex.getMessage());
  |     }
  | 
  |     if (result) {
  |       return primaryKey;
  |     } else {
  |       throw new ObjectNotFoundException ("Ticker " + primaryKey + " not found.");
  |     }
  |   }
  | 
  |   public String ejbCreate(String tickerSymbol, String name)
  |     throws CreateException {
  | 
  |     try {
  |       String findstmt =
  |         "select tickerSymbol " +
  |         "from stock where tickerSymbol= ? ";
  |       PreparedStatement pfindstmt =
  |         connection.prepareStatement(findstmt);
  |       pfindstmt.setString(1, tickerSymbol);
  |       ResultSet rs = pfindstmt.executeQuery();
  |       boolean findResult = rs.next();
  |       if (findResult) {
  |         throw new CreateException("Ticker " + tickerSymbol + "already exists!");
  |       }
  |       String stmt =
  |         "insert into stock values ( ? , ? )";
  |       PreparedStatement pstmt =
  |         connection.prepareStatement(stmt);
  |       pstmt.setString(1, tickerSymbol);
  |       pstmt.setString(2, name);
  | 
  |       pstmt.executeUpdate();
  |       pstmt.close();
  |     } catch (SQLException ex) {
  |       throw new EJBException("ejbCreate: " + ex.getMessage());
  |     }
  | 
  |     this.tickerSymbol = tickerSymbol;
  |     this.name = name;
  | 
  |     return tickerSymbol;
  |   }
  | 
  |   public void ejbPostCreate(String tickerSymbol, String name)
  |     throws CreateException {}
  | 
  |   public void ejbRemove() {
  |     try {
  |       String stmt =
  |         "delete from stock where tickerSymbol = ? ";
  |       PreparedStatement pstmt =
  |         connection.prepareStatement(stmt);
  | 
  |       pstmt.setString(1, tickerSymbol);
  |       pstmt.executeUpdate();
  |       pstmt.close();
  | 
  |     } catch (SQLException ex) {
  |       throw new EJBException("ejbRemove: " + ex.getMessage());
  |     }
  |   }
  | 
  |   public void ejbLoad() {
  |     try {
  |       String stmt =
  |         "select name from where tickerSymbol = ? ";
  |       PreparedStatement pstmt =
  |         connection.prepareStatement(stmt);
  |       pstmt.setString(1, tickerSymbol);
  | 
  |       ResultSet rs = pstmt.executeQuery();
  | 
  |       if (rs.next()) {
  |         this.name = rs.getString(1);
  |         pstmt.close();
  |       } else {
  |         pstmt.close();
  |         throw new NoSuchEntityException("Ticker: " + tickerSymbol + " not in database.");
  |       }
  |     } catch (SQLException ex) {
  |       throw new EJBException("ejbCreate: " + ex.getMessage());
  |     }
  |   }
  |   
  |   public void ejbStore() {
  |     try {
  |       String stmt =
  |         "update stock set name = ? " +
  |         "where tickerSymbol =?";
  |       PreparedStatement pstmt =
  |         connection.prepareStatement(stmt);
  | 
  | 
  |       pstmt.setString(1, name);
  |       pstmt.setString(2, tickerSymbol);
  |       int rowCount = pstmt.executeUpdate();
  |       pstmt.close();
  | 
  |       if (rowCount == 0) {
  |         throw new EJBException("Store for " + 
  |           tickerSymbol + " failed.");
  |       }
  |     } catch (SQLException ex) {
  |       throw new EJBException("ejbStore: " + ex.getMessage());
  |     }
  |   }
  | 
  |   public void ejbPassivate() {}
  | 
  |   public void ejbActivate() {}
  | 
  |   public void  setEntityContext(EntityContext ctx) {
  |     context = ctx;
  | 
  |     try {
  |       getDatabaseConnection();
  |     } catch (Exception ex) {
  |       throw new EJBException("Unable to connect to database. " + ex.getMessage());
  |     }
  |   }
  | 
  |   public void unsetEntityContext() {
  |     context = null;
  |     try {
  |       connection.close();
  |     } catch (SQLException ex) {
  |       throw new EJBException("UnsetEntityContext: " + ex.getMessage());
  |     }
  |   }
  | 
  |   private void getDatabaseConnection()
  |     throws NamingException, SQLException {
  | 
  |     InitialContext ctx = new InitialContext();
  |     DataSource ds = 
  |       (DataSource) ctx.lookup("java:comp/env/jdbc/StockDB");
  |     connection = ds.getConnection();
  |   }
  | }
  | 

StockHome:


  | package beans_2x;
  | 
  | import java.rmi.RemoteException;
  | import javax.ejb.CreateException;
  | import javax.ejb.EJBHome;
  | import javax.ejb.FinderException;
  | 
  | public interface StockHome extends EJBHome {
  | 
  |   // The create method for the Stock bean
  |   public Stock create(String ticker, String name)
  |     throws CreateException, RemoteException;
  | 
  |   // The find by primary key method for the Stock bean
  |   public Stock findByPrimaryKey(String ticker)
  |     throws FinderException, RemoteException;
  | 
  | }
  | 

StockClient:


  | package client;
  | 
  | import beans.StockList;
  | import javax.ejb.CreateException;
  | import javax.ejb.FinderException;
  | import javax.naming.InitialContext;
  | 
  | // General imports
  | import java.awt.*;
  | import java.awt.event.*;
  | import javax.swing.*;
  | 
  | public class StockClient extends JFrame
  | implements ActionListener {
  |   private StockList _stockList;
  |   private JTextField _ticker = new JTextField();
  |   private JTextField _name = new JTextField();
  |   private JButton _get  = new JButton("Get");
  |   private JButton _add  = new JButton("Add");
  |   private JButton _update = new JButton("Update");
  |   private JButton _delete = new JButton("Delete");
  | 
  |   public StockClient() {
  |     // Get the stock lister
  |     _stockList = getStockList();
  | 
  |     // Add the title
  |     JLabel title = new JLabel("Stock List");
  |     title.setHorizontalAlignment(JLabel.CENTER);
  |     getContentPane().add(title, BorderLayout.NORTH);
  | 
  |     // Add the stock label panel
  |     JPanel stockLabelPanel = new JPanel(new GridLayout(2, 1));
  |     stockLabelPanel.add(new JLabel("Symbol"));
  |     stockLabelPanel.add(new JLabel("Name"));
  |     getContentPane().add(stockLabelPanel, BorderLayout.WEST);
  | 
  |     // Add the stock field panel
  |     JPanel stockFieldPanel = new JPanel(new GridLayout(2, 1));
  |     stockFieldPanel.add(_ticker);
  |     stockFieldPanel.add(_name);
  |     getContentPane().add(stockFieldPanel, BorderLayout.CENTER);
  | 
  |     // Add the buttons
  |     JPanel buttonPanel = new JPanel(new GridLayout(1, 4));
  |     _get.addActionListener(this);
  |     buttonPanel.add(_get);
  |     _add.addActionListener(this);
  |     buttonPanel.add(_add);
  |     _update.addActionListener(this);
  |     buttonPanel.add(_update);
  |     _delete.addActionListener(this);
  |     buttonPanel.add(_delete);
  |     getContentPane().add(buttonPanel, BorderLayout.SOUTH);
  |     addWindowListener(new WindowAdapter() {
  |       public void windowClosing(WindowEvent e) {
  |         System.exit(0);
  |       }
  |     });
  | 
  |     setSize(330, 130);
  |     setVisible(true);
  |   }
  | 
  |   private StockList getStockList() {
  |     StockList stockList = null;
  |     try {
  |     // Get a naming context
  |     InitialContext ctx = new InitialContext();
  | 
  |     // Get a StockList object
  |     stockList 
  |      = (StockList) ctx.lookup("StockListBean/remote");
  |     //  = (StockList) ctx.lookup(StockList.class.getName());
  |     } catch(Exception e) {
  |      e.printStackTrace();
  |     }
  |     return stockList;
  |   }
  | 
  |   public void actionPerformed(ActionEvent ae) {
  |     // If get was clicked, get the stock
  |     if (ae.getSource() == _get) {
  |       getStock();
  |     }
  | 
  |     // If add was clicked, add the stock
  |     if (ae.getSource() == _add) {
  |       addStock();
  |     }
  | 
  |     // If update was clicked, update the stock
  |     if (ae.getSource() == _update) {
  |       updateStock();
  |     }
  | 
  |     // If delete was clicked, delete the stock
  |     if (ae.getSource() == _delete) {
  |       deleteStock();
  |     }
  |   }
  | 
  |   private void getStock() {
  |     // Get the ticker
  |     String ticker = _ticker.getText();
  |     if (ticker == null || ticker.trim().length() == 0) {
  |       JOptionPane.showMessageDialog(this, "Ticker is required");
  |       return;
  |     }
  | 
  |     // Get the stock
  |     try {
  |       String name = _stockList.getStock(ticker.trim());
  |       _name.setText(name);
  |     } catch (FinderException fe) {
  |       JOptionPane.showMessageDialog(this, "Not found!");
  |     } catch(Exception e) {
  |       e.printStackTrace();
  |     }
  |   }
  | 
  |   private void addStock() {
  |     // Get the ticker
  |     String ticker = _ticker.getText();
  |     if (ticker == null || ticker.trim().length() == 0) {
  |       JOptionPane.showMessageDialog(this, "Ticker is required");
  |       return;
  |     }
  | 
  |     // Get the name
  |     String name = _name.getText();
  |     if (name == null || name.trim().length() == 0) {
  |       JOptionPane.showMessageDialog(this, "Name is required");
  |       return;
  |     }
  | 
  |     // Add the stock
  |     try {
  |       _stockList.addStock(ticker.trim(), name.trim());
  |       JOptionPane.showMessageDialog(this, "Stock added!");
  |     } catch (CreateException ce) {
  |       JOptionPane.showMessageDialog(this, "Already exists!");
  |     } catch(Exception e) {
  |       e.printStackTrace();
  |     }
  |   }
  | 
  |   private void updateStock() {
  |     // Get the ticker
  |     String ticker = _ticker.getText();
  |     if (ticker == null || ticker.trim().length() == 0) {
  |       JOptionPane.showMessageDialog(this, "Ticker is required");
  |       return;
  |     }
  | 
  |     // Get the name
  |     String name = _name.getText();
  |     if (name == null || name.trim().length() == 0) {
  |       JOptionPane.showMessageDialog(this, "Name is required");
  |       return;
  |     }
  | 
  |     // Update the stock
  |     try {
  |       _stockList.updateStock(ticker.trim(), name.trim());
  |       JOptionPane.showMessageDialog(this, "Stock updated!");
  |     } catch (FinderException fe) {
  |       JOptionPane.showMessageDialog(this, "Not found!");
  |     } catch(Exception e) {
  |       e.printStackTrace();
  |     }
  |   }
  | 
  |   private void deleteStock() {
  |     // Get the ticker
  |     String ticker = _ticker.getText();
  |     if (ticker == null || ticker.trim().length() == 0) {
  |       JOptionPane.showMessageDialog(this, "Ticker is required");
  |       return;
  |     }
  | 
  |     // Delete the stock
  |     try {
  |       _stockList.deleteStock(ticker.trim());
  |       JOptionPane.showMessageDialog(this, "Stock deleted!");
  |     } catch (FinderException fe) {
  |       JOptionPane.showMessageDialog(this, "Not found!");
  |     } catch(Exception e) {
  |       e.printStackTrace();
  |     }
  |   }
  | 
  |   public static void main(String[] args) {
  |     StockClient stockClient = new StockClient();
  |   }
  | }
  | 

Error log:

  | javax.ejb.EJBException: java.lang.RuntimeException: beans_2x.Stock not bound
  | 	at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
  | 	at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
  | 	at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
  | 	at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
  | 	at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
  | 	at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
  | 	at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
  | 	at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
  | 	at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
  | Caused by: java.lang.RuntimeException: beans_2x.Stock not bound
  | 	at beans.StockListBean.addStock(StockListBean.java:41)
  | 	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:597)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
  | 	at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
  | 	at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
  | 	at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
  | 	at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
  | 	at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
  | 	at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
  | 	at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
  | 	at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
  | 	at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
  | 	at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
  | 	at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
  | 	at org.jboss.remoting.Client.invoke(Client.java:1634)
  | 	at org.jboss.remoting.Client.invoke(Client.java:548)
  | 	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
  | 	at $Proxy0.addStock(Unknown Source)
  | 	at client.StockClient.addStock(StockClient.java:139)
  | 	at client.StockClient.actionPerformed(StockClient.java:89)
  | 	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
  | 	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
  | 	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
  | 	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
  | 	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
  | 	at java.awt.Component.processMouseEvent(Component.java:6041)
  | 	at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
  | 	at java.awt.Component.processEvent(Component.java:5806)
  | 	at java.awt.Container.processEvent(Container.java:2058)
  | 	at java.awt.Component.dispatchEventImpl(Component.java:4413)
  | 	at java.awt.Container.dispatchEventImpl(Container.java:2116)
  | 	at java.awt.Component.dispatchEvent(Component.java:4243)
  | 	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
  | 	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
  | 	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
  | 	at java.awt.Container.dispatchEventImpl(Container.java:2102)
  | 	at java.awt.Window.dispatchEventImpl(Window.java:2440)
  | 	at java.awt.Component.dispatchEvent(Component.java:4243)
  | 	at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
  | 	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
  | 	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
  | 	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
  | 	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
  | 	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
  | 	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
  | 	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
  | 	at $Proxy0.addStock(Unknown Source)
  | 	at client.StockClient.addStock(StockClient.java:139)
  | 	at client.StockClient.actionPerformed(StockClient.java:89)
  | 	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
  | 	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
  | 	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
  | 	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
  | 	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
  | 	at java.awt.Component.processMouseEvent(Component.java:6041)
  | 	at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
  | 	at java.awt.Component.processEvent(Component.java:5806)
  | 	at java.awt.Container.processEvent(Container.java:2058)
  | 	at java.awt.Component.dispatchEventImpl(Component.java:4413)
  | 	at java.awt.Container.dispatchEventImpl(Container.java:2116)
  | 	at java.awt.Component.dispatchEvent(Component.java:4243)
  | 	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
  | 	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
  | 	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
  | 	at java.awt.Container.dispatchEventImpl(Container.java:2102)
  | 	at java.awt.Window.dispatchEventImpl(Window.java:2440)
  | 	at java.awt.Component.dispatchEvent(Component.java:4243)
  | 	at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
  | 	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
  | 	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
  | 	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
  | 	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
  | 	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
  | 	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134917#4134917

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134917



More information about the jboss-user mailing list