-
1. Re: Need help for wildfly's ManagedExecutorService
jmesnil Mar 6, 2014 3:13 AM (in response to wyonge)WildFly provides a default managed executor service (as specified in EE spec) so you don't need to name the @Resource:
@Resource private ManagedExecutorService managedExecutorService;
If you really want to name it, use:
@Resource(lookup = "java:comp/DefaultManagedExecutorService") private ManagedExecutorService executorService;
-
2. Re: Need help for wildfly's ManagedExecutorService
emmartins Mar 6, 2014 8:46 AM (in response to wyonge)Any of these @Resource injections seem ok, can you share the whole console log and point us to the source code URL?
-
3. Re: Re: Need help for wildfly's ManagedExecutorService
wyonge Mar 6, 2014 9:30 PM (in response to jmesnil)I try to change the code to
@Resource private ManagedExecutorService mes;
or
@Resource(lookup="java:comp/DefaultManagedExecutorService") private ManagedExecutorService mes;
the problem still exists.
But if I get the ManagedExecutorService by jndi lookup ,it's work fine.
if (cmsg.getTarget().compareTo("Duke") == 0) { try { InitialContext ctx = new InitialContext(); ManagedExecutorService mes = (ManagedExecutorService) ctx.lookup("java:jboss/ee/concurrency/executor/default"); /* The bot replies to the message */ mes.submit(new Runnable() { public void run() { String resp = botstockbean.respond(cmsg.getMessage()); sendAll(session, new ChatMessage("Duke", cmsg.getName(), resp)); } }); } catch (NamingException e) { e.printStackTrace(); } }
Is there any problem about @Resource annotation
Ths source code is here :https://svn.java.net/svn/javaeetutorial~svn/trunk/examples/web/websocket/websocketbot/
-
4. Re: Need help for wildfly's ManagedExecutorService
sfcoy Mar 6, 2014 10:09 PM (in response to wyonge)Is there any chance that you or your IDE has added a WEB-INF/web.xml file to the application?
If so, what does it contain?
-
5. Re: Re: Need help for wildfly's ManagedExecutorService
wyonge Mar 7, 2014 2:02 AM (in response to sfcoy)In this sample appliction, it does not contains web.xml file.
I user maven import this application in IDE
-
6. Re: Need help for wildfly's ManagedExecutorService
jmesnil Mar 7, 2014 4:44 AM (in response to wyonge)I have tested the tutorial downloaded from https://svn.java.net/svn/javaeetutorial~svn/tags/javaeetutorial-7.0.0/ with WildFly 8.0.0.Final and it works as expected when I deploy the websocketbot.war and sent a message to the Duke bot.
If there is any issue, I think it comes from your IDE settings or the way it imported the maven project.