> #jdbc.datasources=jdbc/Cloudscape|jdbc:cloudscape:rmi:CloudscapeDB;create=true
> #jdbc.datasources=jdbc/Mysql|jdbc:mysql://localhost:3306/ThePackED?
> #jdbc.datasources=jdbc/Cloudscape|jdbc:cloudscape:rmi:CloudscapeDB;create=true
> jdbc.datasources=jdbc/mysql|jdbc:mysql://localhost:3306/ThePackED|jdbc/Cloudscape|jdbc:cloudscape:rmi:CloudscapeDB;create=true> Here is the code in a sample EJB for making a connection
> /**
> * a logical database name to be used to access data
> * this will be remove after we are able to use
> * the connection manager.
> */
> private String dbName = "java:comp/env/jdbc/ThePackED";
> /**
> * make a connection with the MySQL database via a Application Server
> */
> private void makeConnection() throws NamingException, SQLException {
> InitialContext ic = new InitialContext();
> DataSource ds = (DataSource)ic.lookup(dbName);
> conn = ds.getConnection();
> }
> And here is the client information
> public class GenerateDocumentListClient {
> public static void main(String[] args) {
> try {
> Context initial = new InitialContext();
> Object objref = initial.lookup("GenerateDocumentListBean");
> GenerateDocumentListHome home = (GenerateDocumentListHome)PortableRemoteObject.narrow(objref,
> GenerateDocumentListHome.class);
> GenerateDocumentList aGenerateDocumentList = home.create();
> // write your test code here
> System.out.println("aGenerateDocumentList = " + aGenerateDocumentList);
> System.out.println(aGenerateDocumentList.getProjectListTable());
> aGenerateDocumentList.remove();
> } catch (Exception ex) {
> System.err.println("Caught an unexpected exception!");
> ex.printStackTrace();
> }
> }
> }
> Here is what the application tells me
> // this is the value of aGenerateDocumentList after the home.create method call
> aGenerateDocumentList =IOR:0000000000000034524d493a7265706f7274696e672e47656e6572617465446f63756d656e744c6973743a30303030303030303030303030303030000000000100000000000000de000101000000000e3139322e3136382e312e3130320004de00000021afabcafe00000020b25dc41b000000020000000d0000000004000000040000000100000000000002000000010000001400000000000100200000000000010100000000000000001900000076000000000000006e66696c653a2f633a2f6a3273646b6565312e322e312f7265706f7369746f72792f57323030302f6170706c69636174696f6e732f5265706f7274696e67436c69656e742e6a617220687474703a2f2f57323030303a393139312f5265706f7274696e67436c69656e742e6a61720
> when I try to execute the business method getProjectList I get this:
> Caught an unexpected exception!
> java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
> java.rmi.RemoteException: Unknown Exception/Error thrown by EJB method.; nested exception is:
> javax.ejb.EJBException
> java.rmi.RemoteException: Unknown Exception/Error thrown by EJB method.; nested exception is:
> javax.ejb.EJBException
> javax.ejb.EJBException
> <>> If anyone could tell me whats wrong or give me an example or sample code for setting up the bean, client
> I would greatly appreciate it!
>
> Thanks!
> najmi
Replies: