Friday, June 1, 2012

GWT+JPA Persistence.Exception source code not found

I'm trying to create a simple DB connection using JPA. It works fine
but when I try to Throw an Exception to the client I get the error:

[ERROR] [browsereditor] - Line 210: No source code is available for
type javax.persistence.EntityExistsException; did you forget to
inherit a required module?
[ERROR] [browsereditor] - Line 212: No source code is available for
type javax.persistence.EntityNotFoundException; did you forget to
inherit a required module?

I get no error in development mode and it compiles fine, but when the
app module is loaded there is where I get the error.

I have the required imports in server/Composer and client/Presenter
classes

import javax.persistence.EntityExistsException;
import javax.persistence.EntityNotFoundException;


I also added the following jars to the classpath and build path:

javax.persistence.jar
jpa-annotations-source.jar (http://code.google.com/p/google-web-
toolkit/issues/detail?id=1830#c14
)


I also tried adding to gwt.xml

<source path='client'/>
<source path='shared'/>
<source path='server'/>

Any ideas on how to tell eclipse where to find the source code??

Thanks

Here is the code:

//Create composer from Composer.class in server

public static Composer createComposer(String name)
throws EntityExistsException {
Composer comp = new Composer();
comp.setName(name);
comp.setId(1);

EntityManager entityManager = entityManager();
entityManager.getTransaction().begin();
entityManager.persist(comp);
entityManager.getTransaction().commit();
entityManager.close();

return comp;
}
///fire Request from createComposer(above) in Presenter.class

req.fire(new Receiver<ComposerProxy>() {

public void onSuccess(ComposerProxy arg0) {

ComposerProxy comp;
comp = arg0;
}

public void onFailure(Throwable caught)
throws Throwable {
// Convenient way to find out which
exception
// was thrown.
try {
throw caught;
} catch (EntityExistsException e) {

} catch (EntityNotFoundException e) {

}
}});
}});


[ERROR] [browsereditor] - Line 210: No source code is available for
type javax.persistence.EntityExistsException; did you forget to
inherit a required module?
[ERROR] [browsereditor] - Line 212: No source code is available for
type javax.persistence.EntityNotFoundException; did you forget to
inherit a required module?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment