-
1. Re: Help with XDoclet
jborn Feb 13, 2002 9:53 AM (in response to jborn)I finally got the DemoBean deployed!!! I had been tweaking the build.xml all week and
have the following three remembered changes:
1. Change the home and interface tags in the DemoBean.java to remote. I had both thinking
that both the remote and home intefaces would be generated for me. I was wrong. I still thought I
saw "both" as a valid item for home and intefaces generate tag?
2. Modify the config/application/application.j file I removed the following because I don't have a web piece
<web-uri><XDtAnt:property name="app.war.name"/></web-uri>
<context-root><XDtAnt:property name="app.contextroot"/></context-root>
3. Removed the webdoclet and jmxdoclet tasks from the build.xml that was supplied with the sample. webdoclet
generated a war file and since I don't have a web piece I could remove this.. What is jmxdoclet used for?
I still have a PROBLEM!!
I can't get the following client to run:
package ejb.demo;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import ejb.demo.*;
/** This simple application tests the 'Interest' Enterprise JavaBean which is
implemented in the package 'org.jboss.docs.interest'. For this to work, the
Bean must be deployed on an EJB server.
*/
class DemoClient {
/** This method does all the work. It creates an instance of the Interest EJB on
the EJB server, and calls its `calculateCompoundInterest()' method, then prints
the result of the calculation.
*/
public static void main(String[] args) {
// Enclosing the whole process in a single `try' block is not an ideal way
// to do exception handling, but I don't want to clutter the program up
// with catch blocks
try {
// Get a naming context
InitialContext jndiContext = new InitialContext();
System.out.println("Got context");
// Get a reference to the Demo Bean
Object ref = jndiContext.lookup("net.theborns.Demo");
System.out.println("Got reference");
// Get a reference from this to the Bean's Home interface
ejbDemoHome home = (ejbDemoHome) PortableRemoteObject.narrow(ref, ejbDemoHome.class);
System.out.println("Got home");
// Create an Demo object from the Home interface
ejbDemo demo = home.create();
System.out.println("Created demo");
// call the demoSelect() method to return the string to print.
System.out.println(demo.demoSelect());
} catch(Exception e) {
System.out.println("Exception in main" + e.toString());
}
}
}
I get the following messages and errors on the command line:
Got context
Got reference
Got home
Created demo
Exception in mainjava.rmi.ServerException: RemoteException occurred in server th
read; nested exception is:
javax.transaction.TransactionRolledbackException: Deprecated; nested exc
eption is:
javax.ejb.EJBException: Deprecated
in the JBoss stderr file I have the follow exception:
[ERROR,ejbDemo] TRANSACTION ROLLBACK EXCEPTION:
javax.transaction.TransactionRolledbackException: Deprecated; nested exception is:
javax.ejb.EJBException: Deprecated
javax.ejb.EJBException: Deprecated
at org.jboss.ejb.EnterpriseContext$EJBContextImpl.getEnvironment(EnterpriseContext.java:317)
at ejb.demo.DemoBean.setSessionContext(Unknown Source)
at ejb.demo.ejbDemoSession.setSessionContext(Unknown Source)
at org.jboss.ejb.StatelessSessionEnterpriseContext.(StatelessSessionEnterpriseContext.java:49)
at org.jboss.ejb.plugins.StatelessSessionInstancePool.create(StatelessSessionInstancePool.java:62)
at org.jboss.ejb.plugins.AbstractInstancePool.add(AbstractInstancePool.java:153)
at org.jboss.ejb.plugins.AbstractInstancePool.internalGet(AbstractInstancePool.java:216)
at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:191)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:74)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:138)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:347)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:100)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:170)
at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:286)
at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:410)
at java.lang.reflect.Method.invoke(Native Method)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
at sun.rmi.transport.Transport$1.run(Transport.java:152)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
at java.lang.Thread.run(Thread.java:484)
What is wrong? Does this have anything to do with the generated home and remote interfaces?
Please help?
jb