Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JBoss connection -- EJB3

843830Sep 19 2007 — edited Sep 21 2007
I am implemented a entity bean and a session bean.
I am writing a client to test my session bean.
Also, I am using JBoss.
in my cleint class I am trying to connect to my database (local host) but I am having problems with JBoss connection.
I am using SQL server 2005. Any Help would be great so I can get this program to run.

When I start JBoss .. it says that SQL is not bound.
this is the error .. how can I fix that ..
Also, does this mean that I am missing some Jar files.

--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: persistence.units:jar=Demo.jar,unitName=DemoPU
State: FAILED
Reason: javax.naming.NameNotFoundException: SQL not bound
I Depend On:
jboss.jca:service=DataSourceBinding,name=SQL
Depends On Me:
jboss.j2ee:jar=Demo.jar,name=CustomerBean,service=EJB3
jboss.j2ee:jar=Demo.jar,name=KBSessionBean,service=EJB3
-----------------------------------------------------------------------------------------------------------

Also this is the code I am trying to run..

public class Client {

/** Creates a new instance of Client */
public static void main(String[] args) throws Exception
{
Connection conn;
// Step 1: Load the JDBC driver.
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
System.out.println("Driver Loaded.");
// Step 2: Establish the connection to the database.
String url = "jdbc:sqlserver://localhost:1433;database=jdocxpt";
conn = DriverManager.getConnection(url, "sa", "");
System.out.println("Got Connection.");

Context ctx = getInitialContext();
CustomerRemote c = (CustomerRemote) ctx.lookup("CustomerBean/remote");

TempCustomer first = new TempCustomer();
TempCustomer second = new TempCustomer();

first.setId(15);
first.setName("roro");
second.setId(9);
second.setName("jojo");
c.addCustomer(first);
c.addCustomer(second);
conn.close();
}

Thanks for your help in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 19 2007
Added on Sep 19 2007
2 comments
128 views