Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Problem with entity bean  RSS feed

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All ,


I am facing a problem in trying to put a call from a Stateless bean to an entity bean to persist an object . The beans are packed in an ear file and have been deployed on JBOss Server 4.xx . When I make a call to persist the entity bean object then it throws up an error as this :




** Please can you tell where the problem is . I am calling this stateless bean from a servlet .
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
first your configure jndi datasoruce
in datasoruce.xml
<local-tx-datasource>
<jndi-name>JNDI java:/system<</jndi-name>
<connection-url>jdbc racle:thin:@localhost:1521:XE</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<user-name>USERNAME HERE</user-name>
<password>PASSWORD HERE</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
</local-tx-datasource>
</datasources>


and then reference it in persistance.xml file
do not give datasource properties in persistance.xml
here you give the ORM related properties
 
Amit Chauhan
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mukhtiar ,
Thanks a lot for the Reply .
I had already all these datasource related entries in the datasource.xml file in the JbossServer/deploy directory and the server is giving a message that it is able to add this jndi name. But how can I give this persistence.xml information about that datasource.xml file information.
I mean I have deployed this persistence.xml file in the ear and now I need to put this datasource.xml file along with the persistence.xml file
in the ear or do I need to put this datasource.xml at two places : on in the deploy directory and other in the ear file .
Please provide me with some pointers over this, I am really stuck.
Regards
 
Amit Chauhan
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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-name>my-ejb-test</jndi-name>
<connection-url>jdbc racle:thin:@127.0.0.1:1521:XE</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>system</user-name>
ashu
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
</exception-sorter-class-name>

<type-mapping>Oracle9i</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-source>java:/my-ejb-test</jta-data-source>


</persistence-unit>
 
Mukhtiar Ahmed
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please check your Jboss log for your Data Source is bound successfully or not.
 
Amit Chauhan
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
As such there is no error thrown when the server is started but when I tried to look up for the datasource binding at the server console then there was an exception thrown up as this :






I tried to search for this exception and one of the web pages says that I am supposed to remove some hajndi entry from the jboss-service.xml file but this entry is absent in the server setup.

Now what do I do?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!