Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

EJB spec violation, (XDoclet

  Asked By: Charlie    Date: Jul 22    Category: Java    Views: 1018
  

I have an entity bean with an ejbCreate & ejbPostCreate with xdoclets as following:


/**
* @throws CreateException Thrown if method fails due to system-level error.
* @throws CreateException
* @throws RemoteException
* @ejb.create-method
*/
public Integer ejbCreate(
Author author,
String title,
String text) throws CreateException, RemoteException {
this.setStoryId(new Integer((new Object()).hashCode()));
this.setTitle(title);
this.setText(text);
this.setPubDate(new Date());

this.setUsername(author.getUsername());
return null;
}

and
/**
* @throws CreateException Thrown if method fails due to system-level error.
*/
public void ejbPostCreate(
Author author,
String title,
String text) throws CreateException {
}

but when I run xdoclet and deploy it in JBoss 4.0, the JBoss prompts:

20:19:40,328 WARN [verifier] EJB spec violation:
Bean : Story
Method : public abstract StoryLocal create(Author, String, String) throws CreateException, RemoteException
Section: 12.2.11
Warning: The methods in the local home interface must not include java.rmi.RemoteException in their throws clause.

what in XDoclet should change? to be added or deleted.
I preferably want to change the xdoclet and let the rest to be generated.

Share: 

 

5 Answers Found

 
Answer #1    Answered By: Liam Bouchard     Answered On: Jul 22

Your problem is that you are using local interfaces and throwsing
RemoteExeption in you methods such as ejbCreate.

There are 2 ways :

1- Change your interface type to remote and keep throwsing RemoteException

2- Remove "throws RemoteException"s from your methods implementations.

 
Answer #2    Answered By: Hababah Younis     Answered On: Jul 22

but what do you mean by I'm using local interfaces.
ofcourse, I know that ejbCreate shold not have RemoteException in the throws. and also you can solve the problem by surrounding the esp. line in a try/catch block.
but the thing is that actually I'm converting a practical XDoclet-less ejb  to the
one with it.
Now the question is what should be changed in XDoclet as it was working properly before..

 
Answer #3    Answered By: Edfu Massri     Answered On: Jul 22

Entity beans are usually deployed locally to be accessible to local EJBs due to performance criteria, if this applies to your case, therefore it makes sense not to have RemoteException.

would that be right?

 
Answer #4    Answered By: Samuel Costa     Answered On: Jul 22

Your problem seems to be that ejbCreate throws  a RemoteException, and
you define it in a @throws  line. Because JBoss 4.0 is complaining, try
taking the references to RemoteException out.

 
Answer #5    Answered By: Dirck Jansen     Answered On: Jul 22

Since u r using local ejbs remove @throws  RemoteException from XDoclet and also from the ejbCreate methos signature

There wont be a remote exception in case of local ejbs

 
Didn't find what you were looking for? Find more on EJB spec violation, (XDoclet Or get search suggestion and latest updates.




Tagged: