I have just learnt that Arquillian does not support @Asynchronous calls. So if you have @Asynchronous EJBs, then they might run fine on JBoss 7 (provided it's full profile and not just web profile, as far as I know), but not when you deploy it via Arquillian.
The problem is, the errors this will produce are as misleading as it gets. I got NoClassDefFoundError for example.
Original situation
The bean.
@Stateless
@Asynchronous
@Local(LibraryImporter.class)
public class CacheAwareLibraryImporter implements LibraryImporter {
// … omitted for brevity
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public Future importLibrary(File libraryFile) {
// code...
}
}
The test.
@RunWith(Arquillian.class)
public class DefaultSongServiceMacOsIT {
@EJB
private LibraryService libraryService;
// … omitted for brevity
This doesn't work with Arquillian.
Workaround
Here's my workaround. You may want to
look at the diff file instead.
The
new bean (in src/test/java).
@Stateless
@Local({ LibraryImporter.class, SynchronousLibraryImporter.class })
public class SynchronousCacheAwareLibraryImporter extends
CacheAwareLibraryImporter implements SynchronousLibraryImporter {
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public Future importLibrary(File libraryFile) {
return super.importLibrary(libraryFile);
}
}
The
new interface (in src/test/java).
public interface SynchronousLibraryImporter extends LibraryImporter {
}
The test.
@RunWith(Arquillian.class)
public class DefaultSongServiceMacOsIT {
@EJB
private SynchronousLibraryService libraryService;
// … omitted for brevity
Nice...-ty. This is a
known issue and they haven't done much about it so far.
Great Article android based projects
ReplyDeleteJava Training in Chennai
Project Center in Chennai
Java Training in Chennai
projects for cse
The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training