felipeguerra
Dúvidas:
1 - Qual versão do JBoss?
2 - EJB 2.x ou 3.x?
paribe
felipeguerra
oracle-ds.xml
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== -->
<!-- $Id: oracle-ds.xml 63175 2007-05-21 16:26:06Z rrajesh $ -->
<!-- ==================================================================== -->
<!-- Datasource config for Oracle originally from Steven Coy -->
<!-- ==================================================================== -->
<datasources>
<local-tx-datasource>
<jndi-name>OracleDS</jndi-name>
<connection-url>jdbc:oracle:thin:@youroraclehost:1521:yoursid</connection-url>
<!--
Here are a couple of the possible OCI configurations.
For more information, see http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm
<connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url>
or
<connection-url>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))</connection-url>
Clearly, its better to have TNS set up properly.
-->
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>x</user-name>
<password>y</password>
<!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
<!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
<!-- Checks the Oracle error codes and messages for fatal errors -->
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->
<!-- sql to call on an existing pooled connection when it is obtained from pool - the OracleValidConnectionChecker is prefered
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-->
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
Sobre os arquivos:
ejb-jar.xml
jboss.xml
Ficam na pasta META-INF, dentro do .jar do seu projeto EJB.
jbosscmp-jdbc.xml , para que vc usa isso?
paribe
Estou fazendo um exemplo sobre EntityBean e nele usa …
Estou seguindo esse exemplo sou novato …
E se não for pedir muito estou tento erro no startup do Jboss …
Pois tento configurar no arquivo xml:
standardjbosscmp-jdbc.xml
o database Oracle juto com DefaultDS …ond estou errando ::::
2008-09-10 15:42:14,109 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.detectDuplicateNesting=true
2008-09-10 15:42:14,109 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.metadata.MetaDataLibrary] Starting failed jboss.jdbc:service=metadata
org.jboss.deployment.DeploymentException: Invalid XML: file=file:/C:/jboss-4.2.2.GA/server/default/conf/standardjbosscmp-jdbc.xml@2:24; - nested throwable: (org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.)
at org.jboss.metadata.XmlFileLoader.getDocument(XmlFileLoader.java:342)
at org.jboss.metadata.XmlFileLoader.getDocument(XmlFileLoader.java:272)
at org.jboss.metadata.XmlFileLoader.getDocumentFromURL(XmlFileLoader.java:244)
at org.jboss.metadata.XmlFileLoader.getDocument(XmlFileLoader.java:228)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.MetaDataLibrary.startService(MetaDataLibrary.java:79)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
<!-- $Id: standardjbosscmp-jdbc.xml 63355 2007-06-05 17:25:20Z rrajesh $ -->
<!-- Inicio Novo -->
<jbosscmp-jdbc>
<defaults>
<datasource>java:/OracleDS</datasource>
<!--datasource-mapping>Oracle10g</datasource-mapping-->
</defaults>
</jbosscmp-jdbc>
<!-- Fim Novo -->
<jbosscmp-jdbc>
<defaults>
<datasource>java:/DefaultDS</datasource>
<!-- optional since 4.0 <datasource-mapping>Hypersonic SQL</datasource-mapping> -->
<create-table>true</create-table>
<remove-table>false</remove-table>
<read-only>false</read-only>
<read-time-out>300000</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>
<clean-read-ahead-on-load>false</clean-read-ahead-on-load>
<unknown-pk>
<key-generator-factory>UUIDKeyGeneratorFactory</key-generator-factory>
<unknown-pk-class>java.lang.String</unknown-pk-class>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(32)</sql-type>
</unknown-pk>
<entity-command name="default"/>
<ql-compiler>org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLCompiler</ql-compiler>
<throw-runtime-exceptions>false</throw-runtime-exceptions>
</defaults>
</jbosscmp-jdbc>
felipeguerra
paribe:
Estou fazendo um exemplo sobre EntityBean e nele usa …
Estou seguindo esse exemplo sou novato …
E se não for pedir muito estou tento erro no startup do Jboss …
Pois tento configurar no arquivo xml:
standardjbosscmp-jdbc.xml
o database Oracle juto com DefaultDS …ond estou errando ::::
Sem querer ser chato, mas EntityBean no EJB 2.x?
Cara, esquece isso…estuda o 3!! Ou vc vai precisar aprender pra dar manutenção em algo?
paribe
isso dar manutenção no 2.1 …
bem isso …não tem jeito …