-
1. Re: Thread.currentThread().getContextClassLoader().getResource() in .ear does not work when update to AS 8.0.0.Alpha1-SNAPSHOT
jaikiran Mar 6, 2013 4:31 AM (in response to zhfeng)What kind of a jar is blacktie-admin-services-5.0.0.M2-SNAPSHOT.jar? An EJB module? Your application.xml has marked it as a "java" module which is incorrect unless you are trying to deploy an "application client" jar. I'm 99% sure, you don't want that
-
2. Re: Thread.currentThread().getContextClassLoader().getResource() in .ear does not work when update to AS 8.0.0.Alpha1-SNAPSHOT
jaikiran Mar 6, 2013 4:34 AM (in response to jaikiran)And looking at the stacktrace in that JIRA:
Caused by: org.jboss.narayana.blacktie.jatmibroker.core.conf.ConfigurationException: Could not find the file: btconfig.xml
at org.jboss.narayana.blacktie.jatmibroker.core.conf.XMLParser.loadProperties(XMLParser.java:135)
at org.jboss.narayana.blacktie.jatmibroker.core.conf.AtmiBrokerEnvXML.getProperties(AtmiBrokerEnvXML.java:30)
at org.jboss.narayana.blacktie.jatmibroker.xatmi.ConnectionFactory.<init>(ConnectionFactory.java:52)
at org.jboss.narayana.blacktie.jatmibroker.xatmi.ConnectionFactory.getConnectionFactory(ConnectionFactory.java:40)
at org.jboss.narayana.blacktie.jatmibroker.xatmi.BlackTieService.<init>(BlackTieService.java:52)
at org.jboss.narayana.blacktie.jatmibroker.xatmi.mdb.MDBBlacktieService.<init>(MDBBlacktieService.java:39)
at org.jboss.narayana.blacktie.administration.BlacktieAdminServiceXATMI.<init>(BlacktieAdminServiceXATMI.java:64)
at org.jboss.narayana.blacktie.administration.BlacktieAdminServiceXATMI$$$view3.<init>(Unknown Source)
at sun.reflect.GeneratedConstructorAccessor22.newInstance(Unknown Source) [:1.7.0_09]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_09]
at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_09]
at java.lang.Class.newInstance0(Class.java:372) [rt.jar:1.7.0_09]
at java.lang.Class.newInstance(Class.java:325) [rt.jar:1.7.0_09]
at org.jboss.invocation.proxy.AbstractClassFactory.newInstance(AbstractClassFactory.java:225)
at org.jboss.invocation.proxy.ProxyFactory.newInstance(ProxyFactory.java:270)
at org.jboss.as.ee.component.ViewService$DefaultViewInstanceFactory.createViewInstance(ViewService.java:263)
at org.jboss.as.ee.component.ViewService$View.createInstance(ViewService.java:157)
at org.jboss.as.ejb3.component.EJBComponent.createViewInstanceProxy(EJBComponent.java:166)
... 16 more
where is the org.jboss.narayana.blacktie.administration.BlacktieAdminServiceXATMI located and which jar does it belong to? And what kind of a component is that?
-
3. Re: Thread.currentThread().getContextClassLoader().getResource() in .ear does not work when update to AS 8.0.0.Alpha1-SNAPSHOT
zhfeng Mar 6, 2013 4:57 AM (in response to jaikiran)actually it listens on a hornet queue and handle the incoming messages.
-
4. Re: Thread.currentThread().getContextClassLoader().getResource() in .ear does not work when update to AS 8.0.0.Alpha1-SNAPSHOT
jaikiran Mar 6, 2013 5:00 AM (in response to zhfeng)Is it an MDB then? Can you post the full stacktrace? When do you see this exception? After the application has fully deployed or before that?
-
5. Re: Thread.currentThread().getContextClassLoader().getResource() in .ear does not work when update to AS 8.0.0.Alpha1-SNAPSHOT
zhfeng Mar 6, 2013 5:05 AM (in response to jaikiran)yeah, it'a MDB. the full stacktrace is in the issue BLACKTIE-433. this exceptin happens after the app deployed and repeat many times.
-
6. Re: Thread.currentThread().getContextClassLoader().getResource() in .ear does not work when update to AS 8.0.0.Alpha1-SNAPSHOT
zhfeng Mar 6, 2013 5:07 AM (in response to jaikiran)org.jboss.narayana.blacktie.administration.BlacktieAdminServiceXATMI located in the lib/blacktie-jatmibroker-xatmi-5.0.0.M2-SNAPSHOT.jar
-
7. Re: Thread.currentThread().getContextClassLoader().getResource() in .ear does not work when update to AS 8.0.0.Alpha1-SNAPSHOT
jaikiran Mar 6, 2013 5:39 AM (in response to zhfeng)For now, as a workaround, move the file reading/loading part to a @PostConstruct method instead of the constructor of that MDB. Something like:
MyMDB { @PostConstruct private void onConstruct() { URL resource = Thread.currentThread().getContextClassLoader().getResource(env); if (resource == null) { throw new ConfigurationException("Could not find the file: " + env); } }
-
8. Re: Thread.currentThread().getContextClassLoader().getResource() in .ear does not work when update to AS 8.0.0.Alpha1-SNAPSHOT
zhfeng Mar 7, 2013 3:56 AM (in response to jaikiran)Thanks a lot. but our MDB looks like not calling @PostConsturct method
@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/BTR_BTDomainAdmin") }, messageListenerInterface = javax.jms.MessageListener.class) public class BlacktieAdminServiceXATMI extends MDBBlacktieService implements javax.jms.MessageListener, BlacktieAdministration { private static final Logger log = LogManager.getLogger(BlacktieAdminServiceXATMI.class); private AdministrationProxy administrationProxy; public BlacktieAdminServiceXATMI() throws ConfigurationException { super("BlacktieAdminServiceXATMI"); administrationProxy = new AdministrationProxy(); } @PostConstruct public void init() { log.info("init PostConstruct"); try { administrationProxy.onConstruct(); connectionFactory = ConnectionFactory.getConnectionFactory(); } catch (ConfigurationException e) { log.warn("init failed with " + e); } } ... }
the server.log is the followng and there is no "init PostConstruct"
16:42:30,027 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 80) HQ221005: trying to deploy queue jms.queue.BTR_BTDomainAdmin 16:42:30,027 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 80) JBAS011601: Bound messaging object to jndi name java:/queue/BTR_BTDomainAdmin 16:42:30,032 INFO [org.jboss.as.ejb3] (MSC service thread 1-3) JBAS014142: Started message driven bean 'BlacktieAdminServiceXATMI' with 'hornetq-ra' resource adapter
-
9. Re: Thread.currentThread().getContextClassLoader().getResource() in .ear does not work when update to AS 8.0.0.Alpha1-SNAPSHOT
nickarls Mar 7, 2013 4:02 AM (in response to zhfeng)That's very strange. Are you sure you are deploying the same code you edited and it's not some non-ee @PostConstruct annotation?
-
10. Re: Thread.currentThread().getContextClassLoader().getResource() in .ear does not work when update to AS 8.0.0.Alpha1-SNAPSHOT
jaikiran Mar 7, 2013 4:37 AM (in response to zhfeng)1 of 1 people found this helpfulThe @PostConstruct will only be invoked when the MDB instance is created, which typically happens when a message is delivered and a new MDB instance is required.
-
11. Re: Thread.currentThread().getContextClassLoader().getResource() in .ear does not work when update to AS 8.0.0.Alpha1-SNAPSHOT
zhfeng Mar 7, 2013 5:23 AM (in response to jaikiran)Thanks jaikiran,
yeah, I understand and it works now.