Re: [jboss-user] [EJB 3.0] - @Service loading resource file fails
by jaikiran pai
jaikiran pai [http://community.jboss.org/people/jaikiran] replied to the discussion
"@Service loading resource file fails"
To view the discussion, visit: http://community.jboss.org/message/547355#547355
--------------------------------------------------------------
Which version of JBoss AS is this? @Service is deprecated starting AS-6.0.0.M3 since we now have EJB3.1 @Singleton implemented in this version.
> manager = new DefaultCacheManager("mycache.xml");
> cache = manager.getCache("testCache");
> ...
>
>
> It fails on the startup of the application, it can't find the mycache.xml files.
> I have tried also with different paths like resources/mycache.xml and /mycache.xml
>
>
> The fact is that *properties files are loaded correctly with resources/file.properties but those are loaded after the application has been deployed.
It all depends on where the DefaultCacheManager looks for the file. I guess it looks for the file in the classpath. So where exactly in the .jar (or .ear) is that file located. The path you posted looks more like the path in your source rather than in the binary .jar/.ear.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/547355#547355]
Start a new discussion in EJB 3.0 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
16 years
[EJB 3.0] - @Service loading resource file fails
by Luca Merolla
Luca Merolla [http://community.jboss.org/people/osnetwork] created the discussion
"@Service loading resource file fails"
To view the discussion, visit: http://community.jboss.org/message/547333#547333
--------------------------------------------------------------
Hi there,
I was trying to implement a cache with Infinispan and the annotation @Service for making it Singleton, so in the constructor I have put something like this:
...
manager = new DefaultCacheManager("mycache.xml");
cache = manager.getCache("testCache");
...
It fails on the startup of the application, it can't find the mycache.xml files.
I have tried also with different paths like resources/mycache.xml and /mycache.xml
The fact is that *properties files are loaded correctly with resources/file.properties but those are loaded after the application has been deployed.
I suppose the problem is because the @Service is trying to load the files from different locations or in a different way. or the resources are not available until the application is deployed.
Does anybody of you have experienced this problem before?
Cheers,
Luca
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/547333#547333]
Start a new discussion in EJB 3.0 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
16 years