Sorry, Jaziran..it's my fault..I should have explained more clearly.

Ok here's the big picture:-

For now everything (server and client and db) is run on one PC - which is my PC 
running WinXP. The production version will have clients and server on separate 
PCs with a remote interface but that's later. I am using JDK5.14, Eclipse 
Ganymede and JBoss GA 4.2.2 and OracleXE.

I want to create a JPA entity app first, get it working and then test it with a 
Java Application client. The whole app is much larger (a bidding auction 
involving JBoss ESB, jBPM and JRules among others),but for starters, I am just 
interested in getting the main engine working. So I start with the JPA entities 
routine and I just want to get to the point where the entities can be 
inserted/added, modified, deleted and searched (now through a Java Application 
client but later through a stateless EJB3 simply by adding the @Stateless 
annotation once the Java App client works.

My server-side or JPA Entity project is called BiddingTest and consists only of 
Bidder.java, a simple bidder entity class with Bidder ID and Bidder name as the 
fields (as listed above). I used Enterprise Application Project wizard from 
Eclipse to create this server-side and linked it to an EAR5 project called 
BiddingTestEAR.

Initially I did my client app as  another Java class within the server-side but 
it did not make sense so I created a separate Application Client project in 
Eclipse and referenced it to the above server-side project. I referenced this 
client side too, to the same EAR5 project,BiddingTestEAR as above. The name of 
the client project is called BiddingClient and there is only one class with 
main() in it, its name is BidClient.java.

In BiddingTest module/project, I have persistence.xml with a unit name of 
"BiddingTest". In my oracle-ds.xml file under server\default\deploy, I have :


  | <jta-data-source>java:/OracleXE1_DS</jta-data-source>
  | 

so my javax.sqlDataSource's JNDI name is OracleXE1_DS.

The JBoss container has its own unique customization so you have to add 
jboss-client.xml and application-client.xml to the client project's META-INF 
directory. I also have my jndi.properties file here but I duplicated the 
properties code in  BidClient.java.

In the EAR module, BiddingTestEAR, under its META-INF folder I have my 
application.xml file.

I linked BiddingTestEAR to the JBoss 4.2.2 Server in Eclipse and when I started 
the server, the server-side BiddingTest (comprising of the entity Bidder.java 
class) deploys OK and I can see the BIDDER table schema created in my OracleXE 
db. However of course, its contents are blank (it has no records).

So I then fired up my client application by running it as a Java Application 
and it has given me a string of errors since my first posting on this forum. 
The adventure has taken me all the way to understanding that :-

(a) You need to get the right combination of Hibernate components from the 
Hibernate Compability Matrix

(b) You need to add jbossclient-all.jar and a string of specific jars to the 
classpath of the client (no beginner would no this the first time !!!)

(c) You need to have application-client.xml and jboss-client.xml in the 
client's META-INF

So although my server side entity creating table program (BiddingTest) is 
working, I am unable to insert records (for starters!) from a client program 
(BiddingClient). My jta datasource is called OracleXE1_DS.

Up to this point in time, I am confused as to this portion of the code :-


  | InitialContext cx = new InitialContext();
  | 

I know this initializes the java naming in JBoss.

But then I don't know what to "lookup" after the code above. Do I look up the 
JNDI-bound datasource name as such (which I defined in my persistence.xml and 
my oracle-ds.xml) :-


  | DataSource obj = (DataSource) ctx.lookup("java:OracleXE1_DS");
  | 

or do I lookup my Java App client project name (nothing to do with datasource) 
as such :-


  | Object obj = ctx.lookup("java:BiddingClient");
  | 

I know that my entity class is called Bidder.java. So instead of the above 2 
code snippets, do i do this instead :-


  | Bidder bidder = (Bidder) ctx.lookup(Bidder.class.getName());
  | 


Up to this point, I have gotten rid of that annoying "Unable to find 
datasource" error message and I am only getting "BiddingClient not bound" and 
"OracleXE1_DS not bound" so it is just a case of getting the JNDI naming right 
for the client or probably the datasource.

All the code to this project are as I have posted from the beginning should you 
wish to refer.

This should be an easy project as it is just simple JPA entity creation but I 
guess running it as a Java EE on JBoss adds a layer of complexity!

Please help! Where am I going wrong ?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199441#4199441

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4199441
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to