You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by axiez <le...@gmail.com> on 2009/02/03 07:55:41 UTC

client throwing exception

I have an entity and stateless session bean in one JVM and client (code given
below) calling from another JVM.
import javax.naming.Context;
import javax.naming.InitialContext;
import java.io.*;
import java.util.Properties;
import java.util.*;
import javax.ejb.EJBException;
public class BankClient {
    public static void main(String[] args) {
        try {
            Properties p = new Properties();
            p.load(new FileInputStream("jndi.properties"));
            p.put("openejb.authentication.realmName","geronimo-admin");
            InitialContext ctx = new InitialContext(p);
            Account a = (Account) ctx.lookup("AccountBeanRemote");
            a.createAccount("bailey","savings","3833",2524);
            AccountNtt a34 = a.find("3833");
            System.out.println(a34.ownerName+"    "+a34.accountType+"   
"+a34.accountNumber+"    "+a34.balance);
        }
        catch(Exception ex) {
            System.err.println("Caught an unexpected exception!");
            ex.printStackTrace();
        }
    }
}
a.createAccount method is throwing exception: Caught an unexpected
exception! javax.ejb.EJBException: The bean encountered a non-application
exception.
Account.java is business interface implemented by AccountBean.java and
AccountNtt is an entity.
-- 
View this message in context: http://www.nabble.com/client-throwing-exception-tp21804757s134p21804757.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: client throwing exception

Posted by axiez <le...@gmail.com>.
This is no more a problem. Actual problem is something else as identified
from application server log.

axiez wrote:
> 
> I have an entity and stateless session bean in one JVM and client (code
> given below) calling from another JVM.
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import java.io.*;
> import java.util.Properties;
> import java.util.*;
> import javax.ejb.EJBException;
> public class BankClient {
>     public static void main(String[] args) {
>         try {
>             Properties p = new Properties();
>             p.load(new FileInputStream("jndi.properties"));
>             p.put("openejb.authentication.realmName","geronimo-admin");
>             InitialContext ctx = new InitialContext(p);
>             Account a = (Account) ctx.lookup("AccountBeanRemote");
>             a.createAccount("bailey","savings","3833",2524);
>             AccountNtt a34 = a.find("3833");
>             System.out.println(a34.ownerName+"    "+a34.accountType+"   
> "+a34.accountNumber+"    "+a34.balance);
>         }
>         catch(Exception ex) {
>             System.err.println("Caught an unexpected exception!");
>             ex.printStackTrace();
>         }
>     }
> }
> a.createAccount method is throwing exception: Caught an unexpected
> exception! javax.ejb.EJBException: The bean encountered a non-application
> exception.
> Account.java is business interface implemented by AccountBean.java and
> AccountNtt is an entity.
> 

-- 
View this message in context: http://www.nabble.com/client-throwing-exception-tp21804757s134p21866354.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: client throwing exception

Posted by axiez <le...@gmail.com>.
Entry in geronimo.log is:
08:37:03,109 ERROR [EjbModuleBuilder] PersistenceUnitBuilder.initContext()
failed: Could not parse persistence.xml file:
jar:file:/D:/g/geronimo-tomcat6-javaee5-2.1.3/repository/default/a1/1233716817000/a1-1233716817000.jar/ejb.jar!/META-INF/persistence.xml
persistence.xml contents are:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="manager">
       
<procider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <jta-data-source>jdbc/MyDataSource</jta-data-source>
        <class>AccountNtt</class>
    </persistence-unit>
</persistence>

axiez wrote:
> 
> I have an entity and stateless session bean in one JVM and client (code
> given below) calling from another JVM.
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import java.io.*;
> import java.util.Properties;
> import java.util.*;
> import javax.ejb.EJBException;
> public class BankClient {
>     public static void main(String[] args) {
>         try {
>             Properties p = new Properties();
>             p.load(new FileInputStream("jndi.properties"));
>             p.put("openejb.authentication.realmName","geronimo-admin");
>             InitialContext ctx = new InitialContext(p);
>             Account a = (Account) ctx.lookup("AccountBeanRemote");
>             a.createAccount("bailey","savings","3833",2524);
>             AccountNtt a34 = a.find("3833");
>             System.out.println(a34.ownerName+"    "+a34.accountType+"   
> "+a34.accountNumber+"    "+a34.balance);
>         }
>         catch(Exception ex) {
>             System.err.println("Caught an unexpected exception!");
>             ex.printStackTrace();
>         }
>     }
> }
> a.createAccount method is throwing exception: Caught an unexpected
> exception! javax.ejb.EJBException: The bean encountered a non-application
> exception.
> Account.java is business interface implemented by AccountBean.java and
> AccountNtt is an entity.
> 

-- 
View this message in context: http://www.nabble.com/client-throwing-exception-tp21804757s134p21823623.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.