• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Remote Exception in EJB with MySQL

Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am working on a class projectand am having a problem connecting between the J2EE Reference
Implementation Server and MySql. I have set-up the defualt.properties file for MySql

# JDBC Driver Examples:
# Oracle thin driver: oracle.jdbc.driver.OracleDriver
# Merant driver: intersolv.jdbc.sequelink.SequeLinkDriver
# Cloudscape driver: COM.cloudscape.core.RmiJdbcDriver
# MySQL driver: org.gjt.mm.mysql.Driver
# JDBC URL Examples:
# Oracle thin driver:
# jdbc racle:thin:@<host>:<port>:<sid>
# Cloudscape RMI driver:
# jdbc:cloudscape:rmi:<database>;create=true
# Merant driver:
# jdbc:sequelink://<host>:<port>/[SQLServer];Database=<database>
# MySQL driver:
# jdbc:mysql://<host>:<port>/<database>
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,
GenerateDocumentList aGenerateDocumentList = home.create();
// write your test code here
System.out.println("aGenerateDocumentList = " + aGenerateDocumentList);
} catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
Here is what the application tells me
// this is the value of aGenerateDocumentList after the home.create method call
aGenerateDocumentList =IOR:0000000000000034524d493a7265706f7274696e672e47656e6572617465446f63756d656e744c6973743a30303030303030303030303030303030000000000100000000000000de000101000000000e3139322e3136382 e312e3130320004de00000021afabcafe00000020b25dc41b000000020000000d0000000004000000040000000100000000000002000000010000001400000000000100200000000000010100000000000000001900000076000 000000000006e66696c653a2f633a2f6a3273646b6565312e322e312f7265706f7369746f72792f57323030302f6170706c69636174696f6e732f5265706f7274696e67436c69656e742e6a617220687474703a2f2f573230303 03a393139312f5265706f7274696e67436c69656e742e6a61720
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:
java.rmi.RemoteException: Unknown Exception/Error thrown by EJB method.; nested exception is:
<<no stack trace available>>
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!

Posts: 6965
Eclipse IDE Debian Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
    Bookmark Topic Watch Topic
  • New Topic