I have a test jar which I downloaded which when placed in the deploy directory echos the following onto the console:
20:21:14,574 INFO [EjbModule] Deploying TesterBean 20:21:15,265 INFO [ProxyFactory] Bound EJB Home 'TesterBean' to jndi 'test/Tester' 20:21:15,495 INFO [EJBDeployer] Deployed: file:/C:/jboss-4.0.4.GA/server/default/deploy/tester.jar Yet when I place my own Bean within the directory there is stuff in the server log but no output on the console. here is my ejb-jar.xml <?xml version="1.0" encoding="UTF-8"?> | | <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'> | | <ejb-jar> | <display-name>AccountJAR</display-name> | <enterprise-beans> | <entity> | <display-name>AccountBean</display-name> | <ejb-name>AccountBean</ejb-name> | <home>cakeinabox.beans.AccountEJB.AccountHome</home> | <remote>cakeinabox.beans.AccountEJB.Account</remote> | <ejb-class>cakeinabox.beans.AccountEJB.AccountBean</ejb-class> | <persistence-type>Bean</persistence-type> | <prim-key-class>java.lang.Integer</prim-key-class> | <reentrant>false</reentrant> | <security-identity> | <use-caller-identity/> | </security-identity> | </entity> | </enterprise-beans> | </ejb-jar> and my jboss.xml | <?xml version="1.0" encoding="UTF-8"?> | <jboss> | <enterprise-beans> | <entity> | <ejb-name>AccountBean</ejb-name> | <jndi-name>ejb/AccountBean</jndi-name> | </entity> | </enterprise-beans> | </jboss> | and then of course my Bean itself. Account.java package cakeinabox.beans.AccountEJB; | | import javax.ejb.EJBObject; | import java.rmi.RemoteException; | | public interface Account extends EJBObject | { | public void setId(int id); | public void setCredit(double credit); | public void setDiscount(double discount); | public void setOpenedDate(java.util.Date openedDate); | public void setClosedDate(java.util.Date closedDate); | | public int getId(); | public double getCredit(); | public double getDiscount(); | public java.util.Date getOpenedDate(); | public java.util.Date getClosedDate(); | } | AccountHome.java | package cakeinabox.beans.AccountEJB; | | import java.util.Collection; | import java.rmi.RemoteException; | import javax.ejb.*; | | public interface AccountHome extends EJBHome | { | public Account create(int id, double credit , double discount, java.util.Date openedDate, java.util.Date closedDate) throws CreateException, RemoteException; | public Collection findAll() throws FinderException, RemoteException; | public Account findByPrimaryKey(int primaryKey) throws FinderException, RemoteException; | } | AccountBean.java | package cakeinabox.beans.AccountEJB; | | import javax.ejb.*; | import java.rmi.RemoteException; | | import java.sql.*; | import javax.sql.*; | import java.util.*; | import javax.naming.*; | | public class AccountBean implements EntityBean | { | private int m_id; | private double m_credit; | private double m_discount; | private java.util.Date m_openedDate; | private java.util.Date m_closedDate; | | private Connection con; | private EntityContext m_context; | | public AccountBean() | { | } | | /////////////////////// | // container methods // | /////////////////////// | | public int ejbCreate(int id, double credit , double discount, java.util.Date openedDate, java.util.Date closedDate) throws CreateException | { | try | { | insertRow(id, credit, discount, openedDate, closedDate); | } | catch (Exception ex) | { | throw new EJBException("ejbRemove: " + ex.getMessage()); | } | | this.m_id = id; | this.m_credit = credit; | this.m_discount = discount; | this.m_openedDate = openedDate; | this.m_openedDate = closedDate; | | return id; | } | | public void ejbPostCreate (int id, float credit , float discount, java.util.Date openedDate, java.util.Date closedDate) throws CreateException | { | } | | public void ejbRemove() | { | try | { | deleteRow(m_id); | } | catch (Exception ex) | { | throw new EJBException("ejbRemove: " + ex.getMessage()); | } | } | | public void setEntityContext(EntityContext context) | { | this.m_context = context; | try | { | makeConnection(); | } | catch (Exception ex) | { | throw new EJBException("Unable to connect to database. " + ex.getMessage()); | } | } | | public void unsetEntityContext() | { | m_context = null; | } | | public void ejbActivate() | { | this.m_id = ((Integer)m_context.getPrimaryKey()).intValue(); | } | | public void ejbPassivate() | { | this.m_id = 0; | this.m_credit = 0; | this.m_discount = 0; | this.m_openedDate = null; | this.m_openedDate = null; | try | { | con.close(); | } | catch (SQLException ex) | { | throw new EJBException("unsetEntityContext: " + ex.getMessage()); | } | } | | public void ejbLoad() | { | // load instance variables from database | try | { | loadRow(); | } | catch (Exception ex) | { | throw new EJBException("ejbLoad: " + ex.getMessage()); | } | } | | public void ejbStore() | { | // save instance variables to database | try | { | storeRow(); | } | catch (Exception ex) | { | throw new EJBException("ejbStore: " + ex.getMessage()); | } | } | | public Collection ejbFindAll() throws FinderException | { | Collection result; | | try | { | result = selectAll(); | } | catch (Exception ex) | { | throw new EJBException("ejbFindByPrimaryKey: " + ex.getMessage()); | } | | if(result.isEmpty()==false) | { | return result; | } | else | { | throw new ObjectNotFoundException("No rows found."); | } | } | | public Integer ejbFindByPrimaryKey(int primaryKey) throws FinderException | { | boolean result; | | try | { | result = selectByPrimaryKey(primaryKey); | } | catch (Exception ex) | { | throw new EJBException("ejbFindByPrimaryKey: " + ex.getMessage()); | } | | if(result==true) | { | return new Integer(primaryKey); | } | else | { | throw new ObjectNotFoundException("Row for id " + primaryKey + " not found."); | } | } | | ////////////////////// | // business methods // | ////////////////////// | | | // set methods | public void setId(int id) | { | m_id = id; | } | | public void setCredit(double credit) | { | m_credit = credit; | } | | public void setDiscount(double discount) | { | m_discount = discount; | } | | public void setOpenedDate(java.util.Date openedDate) | { | m_openedDate = openedDate; | } | | public void setClosedDate(java.util.Date closedDate) | { | m_closedDate = closedDate; | } | | | //get methods | | public int getId() | { | return m_id; | } | | public double getCredit() | { | return m_credit; | } | | public double getDiscount() | { | return m_discount; | } | | public java.util.Date getOpenedDate() | { | return m_openedDate; | } | | public java.util.Date getClosedDate() | { | return m_closedDate; | } | | /////////////////////// | // Database Routines // | /////////////////////// | | private void makeConnection() throws NamingException, SQLException | { | try | { | Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); | } | catch(ClassNotFoundException e) | { | System.err.println("JdbcOdbc Bridge Driver not found!"); | } | con = DriverManager.getConnection("jdbc:odbc:cakeinabox"); | } | | private boolean selectByPrimaryKey(int primaryKey) throws SQLException | { | String selectStatement = "select id from Account where id = ? "; | PreparedStatement prepStmt = con.prepareStatement(selectStatement); | prepStmt.setInt(1, primaryKey); | | ResultSet rs = prepStmt.executeQuery(); | boolean result = rs.next(); | prepStmt.close(); | return result; | } | | private Collection selectAll() throws SQLException | { | String selectStatement = "select id from account"; | PreparedStatement prepStmt = con.prepareStatement(selectStatement); | | ResultSet rs = prepStmt.executeQuery(); | ArrayList a = new ArrayList(); | | while (rs.next()) | { | a.add(new Integer(rs.getInt(1))); | } | | prepStmt.close(); | return a; | } | | private void insertRow (int id, double credit, double discount, java.util.Date openedDate, java.util.Date closedDate) throws SQLException | { | String insertStatement = "insert into Account values ( ? , ? , ? , ? , ?)"; | PreparedStatement prepStmt = | con.prepareStatement(insertStatement); | | prepStmt.setInt(1, id); | prepStmt.setDouble(2, credit); | prepStmt.setDouble(3, discount); | prepStmt.setDate(4, new java.sql.Date(openedDate.getTime())); | prepStmt.setDate(5, new java.sql.Date(closedDate.getTime())); | | prepStmt.executeUpdate(); | prepStmt.close(); | } | | private void deleteRow(int id) throws SQLException | { | String deleteStatement = "delete from Account where id = ? "; | PreparedStatement prepStmt = con.prepareStatement(deleteStatement); | prepStmt.setInt(1, id); | prepStmt.executeUpdate(); | prepStmt.close(); | } | | private void loadRow() throws SQLException | { | String selectStatement = "select * from Account where id = ? "; | PreparedStatement prepStmt = con.prepareStatement(selectStatement); | | prepStmt.setInt(1, this.m_id); | | ResultSet rs = prepStmt.executeQuery(); | | if (rs.next()) | { | this.m_id = rs.getInt(1); | this.m_credit = rs.getDouble(2); | this.m_discount = rs.getDouble(3); | this.m_openedDate = new java.util.Date(rs.getDate(4).getTime()); | this.m_closedDate = new java.util.Date(rs.getDate(5).getTime()); | prepStmt.close(); | } | else | { | prepStmt.close(); | throw new NoSuchEntityException("Row for id " + m_id + " not found in database."); | } | } | | private void storeRow() throws SQLException | { | String updateStatement = | "update Account set " + | "credit = ? ," + | "discount = ? ," + | "openedDate = ? " + | "closedDate = ? " + | "where id = ?"; | PreparedStatement prepStmt = con.prepareStatement(updateStatement); | | prepStmt.setInt(1, m_id); | prepStmt.setDouble(2, m_credit); | prepStmt.setDouble(3, m_discount); | prepStmt.setDate(4, new java.sql.Date(m_openedDate.getTime())); | prepStmt.setDate(5, new java.sql.Date(m_closedDate.getTime())); | | int rowCount = prepStmt.executeUpdate(); | prepStmt.close(); | | if (rowCount == 0) | { | throw new EJBException("Storing row for id " + m_id + " failed."); | } | } | } | Here is what the server log says 2006-06-27 19:52:29,413 DEBUG [org.jboss.deployment.MainDeployer] Undeploying file:/C:/jboss-4.0.4.GA/server/default/deploy/AccountJAR.jar | 2006-06-27 19:52:29,463 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] Unregistering [EMAIL PROTECTED] url=file:/C:/jboss-4.0.4.GA/server/default/tmp/deploy/tmp41839AccountJAR.jar ,addedOrder=45} | 2006-06-27 19:52:29,463 DEBUG [org.jboss.mx.loading.UnifiedLoaderRepository3] UnifiedLoaderRepository removed(true) [EMAIL PROTECTED] url=file:/C:/jboss-4.0.4.GA/server/default/tmp/deploy/tmp41839AccountJAR.jar ,addedOrder=45} | 2006-06-27 19:52:29,513 DEBUG [org.jboss.util.file.Files] Failed to delete dir: C:\jboss-4.0.4.GA\server\default\tmp\deploy\tmp41839AccountJAR.jar | 2006-06-27 19:52:29,513 DEBUG [org.jboss.deployment.DeploymentInfo] Could not delete file:/C:/jboss-4.0.4.GA/server/default/tmp/deploy/tmp41839AccountJAR.jar restart will delete it | 2006-06-27 19:52:29,513 DEBUG [org.jboss.deployment.MainDeployer] Undeployed file:/C:/jboss-4.0.4.GA/server/default/deploy/AccountJAR.jar | 2006-06-27 19:52:39,538 DEBUG [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/C:/jboss-4.0.4.GA/server/default/deploy/AccountJAR.jar | 2006-06-27 19:52:39,558 DEBUG [org.jboss.deployment.MainDeployer] Starting deployment (init step) of package at: file:/C:/jboss-4.0.4.GA/server/default/deploy/AccountJAR.jar | 2006-06-27 19:52:39,568 DEBUG [org.jboss.deployment.MainDeployer] Copying file:/C:/jboss-4.0.4.GA/server/default/deploy/AccountJAR.jar -> C:\jboss-4.0.4.GA\server\default\tmp\deploy\tmp41840AccountJAR.jar | 2006-06-27 19:52:39,678 DEBUG [org.jboss.deployment.JARDeployer] No xml files found | 2006-06-27 19:52:39,678 DEBUG [org.jboss.deployment.MainDeployer] using deployer [EMAIL PROTECTED] | 2006-06-27 19:52:39,678 DEBUG [org.jboss.deployment.JARDeployer] looking for nested deployments in : file:/C:/jboss-4.0.4.GA/server/default/deploy/AccountJAR.jar | 2006-06-27 19:52:39,688 DEBUG [org.jboss.deployment.DeploymentInfo] createLoaderRepository from config: LoaderRepositoryConfig(repositoryName: JMImplementation:service=LoaderRepository,name=Default, repositoryClassName: null, configParserClassName: null, repositoryConfig: null) | 2006-06-27 19:52:39,688 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, [EMAIL PROTECTED], [EMAIL PROTECTED] url=file:/C:/jboss-4.0.4.GA/server/default/tmp/deploy/tmp41840AccountJAR.jar ,addedOrder=0} | 2006-06-27 19:52:39,688 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, [EMAIL PROTECTED], [EMAIL PROTECTED] url=file:/C:/jboss-4.0.4.GA/server/default/tmp/deploy/tmp41840AccountJAR.jar ,addedOrder=0} | 2006-06-27 19:52:39,688 DEBUG [org.jboss.mx.loading.UnifiedLoaderRepository3] Adding [EMAIL PROTECTED] url=file:/C:/jboss-4.0.4.GA/server/default/tmp/deploy/tmp41840AccountJAR.jar ,addedOrder=0} | 2006-06-27 19:52:39,718 DEBUG [org.jboss.deployment.MainDeployer] found 0 subpackages of file:/C:/jboss-4.0.4.GA/server/default/deploy/AccountJAR.jar | 2006-06-27 19:52:39,718 DEBUG [org.jboss.deployment.MainDeployer] Watching new file: file:/C:/jboss-4.0.4.GA/server/default/deploy/AccountJAR.jar | 2006-06-27 19:52:39,718 DEBUG [org.jboss.deployment.MainDeployer] create step for deployment file:/C:/jboss-4.0.4.GA/server/default/deploy/AccountJAR.jar | 2006-06-27 19:52:39,718 DEBUG [org.jboss.deployment.MainDeployer] Done with create step of deploying AccountJAR.jar | 2006-06-27 19:52:39,718 DEBUG [org.jboss.deployment.MainDeployer] Begin deployment start file:/C:/jboss-4.0.4.GA/server/default/deploy/AccountJAR.jar | 2006-06-27 19:52:39,718 DEBUG [org.jboss.deployment.MainDeployer] End deployment start on package: AccountJAR.jar | 2006-06-27 19:52:39,718 DEBUG [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/jboss-4.0.4.GA/server/default/deploy/AccountJAR.jar | 2006-06-27 19:52:39,718 DEBUG [org.jboss.deployment.scanner.URLDeploymentScanner] Watch URL for: file:/C:/jboss-4.0.4.GA/server/default/deploy/AccountJAR.jar -> file:/C:/jboss-4.0.4.GA/server/default/deploy/AccountJAR.jar | View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3953829#3953829 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3953829 Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user