| Author |
How to deploy CMP Entity Bean in Jboss 3
|
Raghuveer Rawat
Ranch Hand
Joined: Apr 03, 2003
Posts: 102
|
|
hi I am deploying CMP Entity Bean in JBoss 3 and want to map this to Postgres 7.3 database. but I am not sure what to do. Even I tried to deploy it by using what ever information I got from internet but I am unable to deploy it. If any one who have done so tell me what will be content of ejb-jar.xml, jboss.xml and jboss-cmp.xml and what are the files that I will have to configure in the Jboss and how like postgres-ds.xml etc.
|
Raghuveer Rawat<br />SCJP2
|
 |
Paulo Aquino
Ranch Hand
Joined: Apr 29, 2002
Posts: 200
|
|
To map your entity beans to Postgre 7.3 db do this: - Install and setup your database - Put the jdbc driver (jar file) for postgre in ${JBoss_Home}/server/default/lib - Copy postgres-ds.xml to ${JBoss_Home}/server/default/deploy directory - Remove or rename the standard database driver, hsqldb-service.xml from ${JBoss_Home}/server/default/deploy directory - Edit either standardjbosscmp-jdbc.xml ( found in ${JBoss_Home}/server/default/conf directory ) or jbosscmp-jdbc.xml in your META-INF and change the dafault typemapping to match the chosen database (Postgre 7.2 ) <datasource>java:/PostgresDS</datasource> <datasource-mapping>PostgreSQL 7.2</datasource-mapping> jbosscmp-jdbc.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd"> <!-- <!DOCTYPE jbosscmp-jdbc SYSTEM "G:\jboss-3.2.1\docs\dtd\jbosscmp-jdbc_3_2.dtd"> --> <!--<datasource>java:/DefaultDS</datasource> <datasource-mapping>Hypersonic SQL</datasource-mapping> --> <jbosscmp-jdbc> <defaults> <datasource>java:/PostgresDS</datasource> <datasource-mapping>PostgreSQL 7.2</datasource-mapping> <create-table>true</create-table> <remove-table>true</remove-table> <read-only>false</read-only> <read-time-out>30000</read-time-out> <row-locking>false</row-locking> <pk-constraint>true</pk-constraint> <fk-constraint>false</fk-constraint> <preferred-relation-mapping>foreign-key</preferred-relation-mapping> <read-ahead> <strategy>on-load</strategy> <page-size>1000</page-size> <eager-load-group>*</eager-load-group> </read-ahead> <list-cache-max>1000</list-cache-max> </defaults> <enterprise-beans> <entity> <ejb-name>TenderConfigEJB</ejb-name> <!--<create-table>true</create-table> <remove-table>true</remove-table> <pk-constraint>true</pk-constraint> --> <table-name>TenderConfig</table-name> <cmp-field> <field-name>tndrCfgDataType</field-name> <jdbc-type>VARCHAR</jdbc-type> <sql-type>VARCHAR(64)</sql-type> </cmp-field> <cmp-field> <field-name>tndrCfgDesc</field-name> <jdbc-type>VARCHAR</jdbc-type> <sql-type>VARCHAR(64)</sql-type> </cmp-field> <cmp-field> <field-name>tndrCfgName</field-name> <not-null/> <jdbc-type>VARCHAR</jdbc-type> <sql-type>VARCHAR(64)</sql-type> </cmp-field> <cmp-field> <field-name>tndrType</field-name> <jdbc-type>INTEGER</jdbc-type> <sql-type>INTEGER</sql-type> </cmp-field> <cmp-field> <field-name>tndrID</field-name> <not-null/> <jdbc-type>INTEGER</jdbc-type> <sql-type>INTEGER</sql-type> </cmp-field> <cmp-field> <field-name>tndrCfgValue</field-name> <jdbc-type>VARCHAR</jdbc-type> <sql-type>VARCHAR(64)</sql-type> </cmp-field> </entity> </enterprise-beans> </jbosscmp-jdbc> jboss.xml <jboss> <enterprise-beans> <session> <ejb-name>TerminalSessionFacadeEJB</ejb-name> <jndi-name>TestJNDI</jndi-name> </session> </enterprise-beans> </jboss> 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>Ejb1</display-name> <enterprise-beans> <entity> <display-name>TenderConfigEJB</display-name> <ejb-name>TenderConfigEJB</ejb-name> <local-home>com.uniserv.comn.controller.ejb.entity.tenderconfig.LocalTenderConfigHome</local-home> <local>com.uniserv.comn.controller.ejb.entity.tenderconfig.LocalTenderConfig</local> <ejb-class>com.uniserv.comn.controller.ejb.entity.tenderconfig.TenderConfigEJB</ejb-class> <persistence-type>Container</persistence-type> <prim-key-class>com.uniserv.comn.controller.ejb.entity.tenderconfig.TenderConfigPK</prim-key-class> <reentrant>False</reentrant> <cmp-version>2.x</cmp-version> <abstract-schema-name>TenderConfig</abstract-schema-name> <cmp-field> <description>no description</description> <field-name>tndrCfgDataType</field-name> </cmp-field> <cmp-field> <description>no description</description> <field-name>tndrCfgDesc</field-name> </cmp-field> <cmp-field> <description>no description</description> <field-name>tndrCfgName</field-name> </cmp-field> <cmp-field> <description>no description</description> <field-name>tndrType</field-name> </cmp-field> <cmp-field> <description>no description</description> <field-name>tndrID</field-name> </cmp-field> <cmp-field> <description>no description</description> <field-name>tndrCfgValue</field-name> </cmp-field> <security-identity> <description/> <use-caller-identity/> </security-identity> <resource-ref> <res-ref-name>jdbc/Postgre</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref> <query> <description/> <query-method> <method-name>findAll</method-name> <method-params/> </query-method> <ejb-ql>SELECT DISTINCT OBJECT (o) FROM TenderConfig o</ejb-ql> </query> </entity> <session> <display-name>TerminalSessionFacadeEJB</display-name> <ejb-name>TerminalSessionFacadeEJB</ejb-name> <home>com.uniserv.comn.controller.ejb.session.terminalfacade.TerminalSessionFacadeHome</home> <remote>com.uniserv.comn.controller.ejb.session.terminalfacade.TerminalSessionFacade</remote> <ejb-class>com.uniserv.comn.controller.ejb.session.terminalfacade.TerminalSessionFacadeEJB</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> <ejb-local-ref> <ejb-ref-name>ejb/TenderConfigEJB</ejb-ref-name> <ejb-ref-type>Entity</ejb-ref-type> <local-home>com.uniserv.comn.controller.ejb.entity.tenderconfig.LocalTenderConfigHome</local-home> <local>com.uniserv.comn.controller.ejb.entity.tenderconfig.LocalTenderConfig</local> <!--<ejb-link>ejb-jar-ic.jar#TenderConfigEJB</ejb-link> --> <ejb-link>TenderConfigEJB</ejb-link> </ejb-local-ref> <security-identity> <description/> <use-caller-identity/> </security-identity> </session> </enterprise-beans> <assembly-descriptor> <method-permission> <unchecked/> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>LocalHome</method-intf> <method-name>findByPrimaryKey</method-name> <method-params> <method-param>com.uniserv.comn.controller.ejb.entity.tenderconfig.TenderConfigPK</method-param> </method-params> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getPrimaryKey</method-name> <method-params/> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getTndrType</method-name> <method-params/> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>LocalHome</method-intf> <method-name>remove</method-name> <method-params> <method-param>java.lang.Object</method-param> </method-params> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getTndrID</method-name> <method-params/> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getTenderConfigVO</method-name> <method-params/> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>LocalHome</method-intf> <method-name>findAll</method-name> <method-params/> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getEJBLocalHome</method-name> <method-params/> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getTndrCfgDesc</method-name> <method-params/> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>setTndrType</method-name> <method-params> <method-param>int</method-param> </method-params> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>LocalHome</method-intf> <method-name>create</method-name> <method-params> <method-param>com.uniserv.comn.model.TenderConfigVO</method-param> </method-params> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>isIdentical</method-name> <method-params> <method-param>javax.ejb.EJBLocalObject</method-param> </method-params> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getTndrCfgName</method-name> <method-params/> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getTndrCfgDataType</method-name> <method-params/> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>setTndrCfgDesc</method-name> <method-params> <method-param>java.lang.String</method-param> </method-params> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>remove</method-name> <method-params/> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>setTndrCfgDataType</method-name> <method-params> <method-param>java.lang.String</method-param> </method-params> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>setTndrCfgValue</method-name> <method-params> <method-param>java.lang.String</method-param> </method-params> </method> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getTndrCfgValue</method-name> <method-params/> </method> </method-permission> <method-permission> <unchecked/> <method> <ejb-name>TerminalSessionFacadeEJB</ejb-name> <method-intf>Home</method-intf> <method-name>remove</method-name> <method-params> <method-param>java.lang.Object</method-param> </method-params> </method> <method> <ejb-name>TerminalSessionFacadeEJB</ejb-name> <method-intf>Remote</method-intf> <method-name>getHandle</method-name> <method-params/> </method> <method> <ejb-name>TerminalSessionFacadeEJB</ejb-name> <method-intf>Remote</method-intf> <method-name>addTenderConfig</method-name> <method-params> <method-param>com.uniserv.comn.model.TenderConfigVO</method-param> </method-params> </method> <method> <ejb-name>TerminalSessionFacadeEJB</ejb-name> <method-intf>Home</method-intf> <method-name>remove</method-name> <method-params> <method-param>javax.ejb.Handle</method-param> </method-params> </method> <method> <ejb-name>TerminalSessionFacadeEJB</ejb-name> <method-intf>Home</method-intf> <method-name>getHomeHandle</method-name> <method-params/> </method> <method> <ejb-name>TerminalSessionFacadeEJB</ejb-name> <method-intf>Remote</method-intf> <method-name>getPrimaryKey</method-name> <method-params/> </method> <method> <ejb-name>TerminalSessionFacadeEJB</ejb-name> <method-intf>Home</method-intf> <method-name>getEJBMetaData</method-name> <method-params/> </method> <method> <ejb-name>TerminalSessionFacadeEJB</ejb-name> <method-intf>Remote</method-intf> <method-name>remove</method-name> <method-params/> </method> <method> <ejb-name>TerminalSessionFacadeEJB</ejb-name> <method-intf>Home</method-intf> <method-name>create</method-name> <method-params/> </method> <method> <ejb-name>TerminalSessionFacadeEJB</ejb-name> <method-intf>Remote</method-intf> <method-name>isIdentical</method-name> <method-params> <method-param>javax.ejb.EJBObject</method-param> </method-params> </method> <method> <ejb-name>TerminalSessionFacadeEJB</ejb-name> <method-intf>Remote</method-intf> <method-name>getEJBHome</method-name> <method-params/> </method> </method-permission> <container-transaction> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getTenderConfigVO</method-name> <method-params/> </method> <trans-attribute>Required</trans-attribute> </container-transaction> <container-transaction> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getTndrID</method-name> <method-params/> </method> <trans-attribute>Required</trans-attribute> </container-transaction> <container-transaction> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getTndrCfgName</method-name> <method-params/> </method> <trans-attribute>Required</trans-attribute> </container-transaction> <container-transaction> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getTndrType</method-name> <method-params/> </method> <trans-attribute>Required</trans-attribute> </container-transaction> <container-transaction> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>setTndrType</method-name> <method-params> <method-param>int</method-param> </method-params> </method> <trans-attribute>Required</trans-attribute> </container-transaction> <container-transaction> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>setTndrCfgDataType</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>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getTndrCfgDataType</method-name> <method-params/> </method> <trans-attribute>Required</trans-attribute> </container-transaction> <container-transaction> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>setTndrCfgValue</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>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getTndrCfgDesc</method-name> <method-params/> </method> <trans-attribute>Required</trans-attribute> </container-transaction> <container-transaction> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>remove</method-name> <method-params/> </method> <trans-attribute>Required</trans-attribute> </container-transaction> <container-transaction> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>getTndrCfgValue</method-name> <method-params/> </method> <trans-attribute>Required</trans-attribute> </container-transaction> <container-transaction> <method> <ejb-name>TenderConfigEJB</ejb-name> <method-intf>Local</method-intf> <method-name>setTndrCfgDesc</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>TerminalSessionFacadeEJB</ejb-name> <method-intf>Remote</method-intf> <method-name>addTenderConfig</method-name> <method-params> <method-param>com.uniserv.comn.model.TenderConfigVO</method-param> </method-params> </method> <trans-attribute>Required</trans-attribute> </container-transaction> </assembly-descriptor> </ejb-jar> I've been tinkering with JBoss and Postgre for the last two weeks. I hope my findings are sufficient enough to help you with your deployment. I know how it feels when you post something, when you need help very badly and yet nobody cares to give you a piece of their mind...
|
Be Afraid...Be very Afraid...
|
 |
Paulo Aquino
Ranch Hand
Joined: Apr 29, 2002
Posts: 200
|
|
By the way i forgot to attach postgres-ds.xml <?xml version="1.0" encoding="UTF-8"?> <!-- ===================================================================== --> <!-- --> <!-- JBoss Server Configuration --> <!-- --> <!-- ===================================================================== --> <!-- $Id: postgres-ds.xml,v 1.1 2002/07/22 22:57:24 d_jencks Exp $ --> <!-- ==================================================================== --> <!-- Datasource config for Postgres --> <!-- ==================================================================== --> <datasources> <local-tx-datasource> <jndi-name>PostgresDS</jndi-name> <!--<jndi-name>DefaultDS</jndi-name> --> <!--<connection-url>jdbc ostgresql://[servername]:[port]/[database name]</connection-url> --> <connection-url>jdbc ostgresql://localhost:5432/testdb</connection-url> <driver-class>org.postgresql.Driver</driver-class> <user-name>pau</user-name> <password>pau</password> </local-tx-datasource> </datasources>
|
 |
Paulo Aquino
Ranch Hand
Joined: Apr 29, 2002
Posts: 200
|
|
haahhahah...javaranch is parsing (colon+p) to ( ) just make the appropriate adjustments...
|
 |
 |
|
|
subject: How to deploy CMP Entity Bean in Jboss 3
|
|
|