[jboss-user] [EJB 3.0] - Re: Can a Stateless bean make a call to an entity bean to pe
Is it possible that Toplink requires resource references as per EJB spec? Regards Felix View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4059374#4059374 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4059374 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [EJB 3.0] - Re: Can a Stateless bean make a call to an entity bean to pe
Hello again! If your datasource is correctly deployed, then I don't know. It might be a TopLink issue. This is the way to deploy a EJB3 jar file and connect it to a datasource. When using EJB3 and JPA you are not using Hibernate directly. You are using JPA, which JBoss in turn maps to Hibernate. You don't have to care about the implementation of JPA. JBoss choose Hibernate, Glassfish choose TopLink, but they are all doing the same thing. The whole idéa is that you don't have to care about the underlying mechanism/implementation. So, if you are using pure JPA, then you should go for the standard behaviour of the apllication server's implementation. On the other hand, if you are using special features of for example TopLink, or if you aren't satisfied with the standard implementation (in this case Hibernate), then of course you should go for TopLink if you find TopLink solve your problems. Kind regards Oskar View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058576#4058576 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058576 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [EJB 3.0] - Re: Can a Stateless bean make a call to an entity bean to pe
Hi again! Good news! Take a look at this post on another forum http://forums.oracle.com/forums/thread.jspa?threadID=244914 //Oskar View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058577#4058577 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058577 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [EJB 3.0] - Re: Can a Stateless bean make a call to an entity bean to pe
Hi , thanks for the response but I had already been to this page with this exception and if you take a look at the code that is given there then you will notice that they have used a variable by the name mySession which they have provided no reference for as how did they implemented or referenced it. I mean they didn't instantiate it and have made a direct use of it in the code . This again hangs me back . Regards View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058721#4058721 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058721 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [EJB 3.0] - Re: Can a Stateless bean make a call to an entity bean to pe
Hi! It seems like JBoss can't find your datasource. It also looks like you are using toplink, are you? The example bellow is for the normal JBoss EJB3 (on top of Hibernate). Anyway, the configuration shall still be the same (please correct me if I'm wrong) except some of the properties in persistence.xml. So, you shall have a persistence.xml file packed with your ejb-jar-file. The file looks something like (the example is using MySQL-dialect. You shall probably use the Oracle dialect): | persistence xmlns=http://java.sun.com/xml/ns/persistence; | xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; | xsi:schemaLocation=http://java.sun.com/xml/ns/persistence | http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd; | version=1.0 | persistence-unit name=my-ejbs | jta-data-source | !-- | THIS NAME SHALL MAP AGAINST THE JNDI-NAME OF YOUR DATA SOURCE FILE | -- | java:/service-fundorder-DS | /jta-data-source | properties | property name=show_sql value=true / | property name=dialect | value=org.hibernate.dialect.MySQLDialect / | /properties | /persistence-unit | /persistence | Then you must deploy a data-source-file that defines the connection to the database. The filename must end with -ds.xml, e.g. my-service.ds.xml This file looks something like (also MySQL). THere are plenty of such example files in the JBoss distro under docs/examples/jta: | ?xml version=1.0 encoding=UTF-8? | datasources | local-tx-datasource | | !-- | JNDI NAME OF DATA SOURCE - THIS NAME IS MAPPED IN PERSISTENCE.XML IN YOUR EAR FILE | -- | jndi-namemy-service-DS/jndi-name | | !-- | Connect parameters | -- | connection-url | jdbc:${jdbc.vendor}://${db.host}:${db.port}/${db.name} | /connection-url | user-name${db.username}/user-name | password${db.password}/password | driver-class${jdbc.driverclass}/driver-class | | !-- | Minimum and maximum poolsize | -- | min-pool-size0/min-pool-size | max-pool-size5/max-pool-size | | !-- | No of minutes in idle state until connection is destroyed | -- | idle-timeout-minutes1/idle-timeout-minutes | | !-- | Class used to detect if connection is valid or not. Using MySQL, this | class shall only be used on drivers after 3.22.1 with ping support | -- | valid-connection-checker-class-name | org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker | /valid-connection-checker-class-name | | !-- | Class used when sorting exceptions | -- | exception-sorter-class-name | org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter | /exception-sorter-class-name | | | !-- | corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) | -- | metadata | type-mappingmySQL/type-mapping | /metadata | /local-tx-datasource | /datasources | Kind regards //Oskar View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058012#4058012 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058012 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [EJB 3.0] - Re: Can a Stateless bean make a call to an entity bean to pe
Sorry, now thing got messed up here. We take the examples once again. Look at the JNDI-names. These got messed in the previous post. //Oskar persistence.xml | persistence xmlns=http://java.sun.com/xml/ns/persistence; | xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; | xsi:schemaLocation=http://java.sun.com/xml/ns/persistence | http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd; | version=1.0 | persistence-unit name=my-ejbs | jta-data-source | !-- | THIS NAME SHALL MAP AGAINST THE JNDI-NAME OF | YOUR DATA SOURCE FILE | -- | java:/my-service-DS | /jta-data-source | properties | property name=show_sql value=true / | property name=dialect | value=org.hibernate.dialect.MySQLDialect / | /properties | /persistence-unit | /persistence | my-service-ds.xml | ?xml version=1.0 encoding=UTF-8? | datasources | local-tx-datasource | | !-- | JNDI NAME OF DATA SOURCE - | THIS NAME IS MAPPED IN PERSISTENCE.XML IN YOUR EAR FILE | -- | jndi-namemy-service-DS/jndi-name | | !-- | Connect parameters | -- | connection-url | jdbc:${jdbc.vendor}://${db.host}:${db.port}/${db.name} | /connection-url | user-name${db.username}/user-name | password${db.password}/password | driver-class${jdbc.driverclass}/driver-class | | !-- | Minimum and maximum poolsize | -- | min-pool-size0/min-pool-size | max-pool-size5/max-pool-size | | !-- | No of minutes in idle state until connection is destroyed | -- | idle-timeout-minutes1/idle-timeout-minutes | | !-- | Class used to detect if connection is valid or not. Using MySQL, this | class shall only be used on drivers after 3.22.1 with ping support | -- | valid-connection-checker-class-name | org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker | /valid-connection-checker-class-name | | !-- | Class used when sorting exceptions | -- | exception-sorter-class-name | org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter | /exception-sorter-class-name | | | !-- | corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) | -- | metadata | type-mappingmySQL/type-mapping | /metadata | /local-tx-datasource | /datasources | | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058015#4058015 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058015 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [EJB 3.0] - Re: Can a Stateless bean make a call to an entity bean to pe
Hi oskar.carlstedt, First of all thanks a lot for your reply . Yes , I am using toplink here and I have already got the clue for ds.xml file but I want to where I should be putting this ds.xml file : 1.Should I pack it in the ear file along with the persistence.xml file OR 2. I should put it in the deploy directory directly , i.e. outside the ear file . Expecting a relief soon from you . Regards View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058062#4058062 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058062 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [EJB 3.0] - Re: Can a Stateless bean make a call to an entity bean to pe
TO further add to the things I had already put the ds.xml file in the deploy directory but it when I go to access the entity it throws up this error : Internal Exception: javax.naming.InvalidNameException: Not a compound name: my-ejb-test 16:05:48,312 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:220) 16:05:48,312 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl. Moreover in deploying this ear it throws this warning : 16:10:13,921 INFO [STDOUT] [TopLink Warning]: 2007.06.27 04:10:13.906--java.lang.NullPointerException: null was thrown on attempt of PersistenceLoadProcessor to load class src.FirstSessionBean. The class is ignored. 16:10:13,921 INFO [STDOUT] [TopLink Warning]: 2007.06.27 04:10:13.921--java.lang.NullPointerException: null was thrown on attempt of PersistenceLoadProcessor to load class com.hughes.testEjb.TestClient. The class is ignored. 16:10:13,921 INFO [STDOUT] [TopLink Warning]: 2007.06.27 04:10:13.921--java.lang.NullPointerException: null was thrown on attempt of PersistenceLoadProcessor to load class src.Employee. The class is ignored. 16:10:13,921 INFO [STDOUT] [TopLink Warning]: 2007.06.27 04:10:13.921--java.lang.NullPointerException: null was thrown on attempt of PersistenceLoadProcessor to load class src.FirstSession. The class is ignored. My ds.xml is : ?xml version=1.0 encoding=UTF-8? !-- = -- !-- -- !-- JBoss Server Configuration -- !-- -- !-- = -- !-- $Id: oracle-xa-ds.xml,v 1.13 2004/09/15 14:37:40 loubyansky Exp $ -- !-- = -- !-- ATTENTION: DO NOT FORGET TO SET Pad=true IN transaction-service.xml -- !-- = -- local-tx-datasource jndi-namemy-ejb-test/jndi-name connection-urljdbc:oracle:thin:@127.0.0.1:1521:XE/connection-url driver-classoracle.jdbc.driver.OracleDriver/driver-class user-namesystem/user-name ashu exception-sorter-class-nameorg.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter /exception-sorter-class-name type-mappingOracle9i/type-mapping /local-tx-datasource My persistent.xml is : ?xml version=1.0 encoding=UTF-8? persistence xmlns=http://java.sun.com/xml/ns/persistence; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; version=1.0 xsi:schemaLocation=http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd; persistence-unit name=testApp transaction-type=JTA oracle.toplink.essentials.PersistenceProvider jta-data-sourcejava:/my-ejb-test/jta-data-source /persistence-unit View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058071#4058071 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058071 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [EJB 3.0] - Re: Can a Stateless bean make a call to an entity bean to pe
Hi! The datasource file has its own deployment, so this file shall be put directly in the deploy folder. When doing this you'll see JBoss deploying the ds file. After the deloyment (takes a second or two) you can find the deployed datasource in the jmx-console (http://localhost:8080/jmx-console). In the jmx-console you shall be able to find a local transaction source, a connection pool etc. All these are are named from jndi-name in your ds.xml-file. The persitence.xml file shall be bundled in the classpath of the jar file containing your ejbs. The error you get must, as far as I can see, be due to an incorrect deployment of the ds-file. What if you only deploy the ds-file? Do get any errors? Can you see the deployed datasource in the jmx console? Best //Oskar View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058103#4058103 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058103 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [EJB 3.0] - Re: Can a Stateless bean make a call to an entity bean to pe
Why are you using TopLink? Regards Felix View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058214#4058214 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058214 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [EJB 3.0] - Re: Can a Stateless bean make a call to an entity bean to pe
Hi ! I am able to get the datasource being properly deployed and able to see it at the server console also. There is no error so far with this part . But when I go for deployment of the entity bean then it shows an error that this jndi name is not a compound name and then the call to the entity also fails . I had already put the ds.xml file in the deploy directory but it when I go to access the entity it throws up this error : Internal Exception: javax.naming.InvalidNameException: Not a compound name: my-ejb-test 16:05:48,312 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:220) 16:05:48,312 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl. And the question about using Toplink , I mean since I am not using hibernate that's why I am making use of toplink jars for persisietnce . View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058521#4058521 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058521 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user