-
1. Re: Is this JBoss or an iBatis issue? Classpath issues...
asack Apr 7, 2006 9:48 AM (in response to asack)Just to add, the exception I'm getting is:
java.io.IOException: Could not find resource "com/blah/blah/sqlmapConfig.xml" etc. which is definitely in the my.jar module. -
2. Re: Is this JBoss or an iBatis issue? Classpath issues...
asack Apr 7, 2006 1:15 PM (in response to asack)"asack" wrote:
Just to add, the exception I'm getting is:
java.io.IOException: Could not find resource "com/blah/blah/sqlmapConfig.xml" etc. which is definitely in the my.jar module.
Well it seems I can load if I set the current Context ClassLoader to myClass.getClass().getClassLoader(). I obviously do not understand JBoss class loading strategy as well as I thought. Why do I have do this since I should have classloading scope within my own EAR? (I tried 403SP1 and 404RC2 with the same results). Also if I do this then if iBatis needs anything from a common library (like a type callback handler), its no longer visible unless I include it within the EAR - I *thought* I could a bunch of EARs sharing one library resource that provides interfaces and objects ocmmon to all of them. -
3. Re: Is this JBoss or an iBatis issue? Classpath issues...
asack Apr 7, 2006 5:46 PM (in response to asack)Has anyone ever used iBatis from within an EAR with EAR isolation on? If so, what was your package layout and where were are your resource files? Any advice would be much apprecaited. I'm going nuts with this one.
-
4. Re: Is this JBoss or an iBatis issue? Classpath issues...
adrianoats Jun 24, 2009 10:01 AM (in response to asack)Sorry to re-open such an old thread but, as my colleague above sad so perfectly, I'm also going nuts with this one.
Same problem: Ibatis, configuration files, mysql connector all inside a jar file.
When running my app, whenever I try to get a Reader from the resource(getResourceAsReader(packageA/packageB/dao.xml)) an IO.Exception is thrown (could not find resource at: packageA/packageB/dao.xml).
The xml file is inside the jar and I dont have a clue what I'm missing here.
Can anyone please give me some directions?
Sir asack, did you solve that? What did you do?
Thanks in advance. Any help would be really darn good.
Thanks and sorry about my lousy english. -
5. Re: Is this JBoss or an iBatis issue? Classpath issues...
jaikiran Jun 24, 2009 10:39 AM (in response to asack)whenever I try to get a Reader from the resource(getResourceAsReader(packageA/packageB/dao.xml)) an IO.Exception is thrown (could not find resource at: packageA/packageB/dao.xml).
Please post your code as well as the exception stacktrace.
While posting logs or xml content or code, please remember to wrap it in a code block by using the Code button in the message editor window. Please use the Preview button to ensure that your post is correctly formatted. -
6. Re: Is this JBoss or an iBatis issue? Classpath issues...
adrianoats Jun 24, 2009 1:20 PM (in response to asack)Hey Jaikiran, thanks a lot for your support...
Here is the code......DaoManager gerenteDB; private static void carregarBD() { try { gerenteBD = DaoManagerBuilder.buildDaoManager(Resources .getResourceAsReader(resource), properties); } catch (DaoException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
And here is the stack trace14:12:00,280 ERROR [STDERR] java.io.IOException: Could not find resource sped/contabil/entidade/dao.xml 14:12:00,280 ERROR [STDERR] at com.ibatis.common.resources.Resources.getResourceAsStream(Resources.java:101) 14:12:00,280 ERROR [STDERR] at com.ibatis.common.resources.Resources.getResourceAsStream(Resources.java:86) 14:12:00,280 ERROR [STDERR] at com.ibatis.common.resources.Resources.getResourceAsReader(Resources.java:150) 14:12:00,280 ERROR [STDERR] at sped.contabil.entidade.ConexaoBD.carregarBD(ConexaoBD.java:186)
I found the following link https://jira.jboss.org/jira/browse/JBAS-3086
On that link, it seems that is a workaround is explained but... I didn't quite get it.
Is my doubt understandable now? If not, please ask for any detail you'd like because, I gotta admit, I have no further ideas for this problem.
Thanks a lot. -
7. Re: Is this JBoss or an iBatis issue? Classpath issues...
adrianoats Jun 24, 2009 1:22 PM (in response to asack)In time,
resource is a String with the content: sped/contabil/entidade/dao.xml
Thanks -
8. Re: Is this JBoss or an iBatis issue? Classpath issues...
jaikiran Jun 25, 2009 9:11 AM (in response to asack)Which exact version of JBoss AS, Java and iBatis do you use?
-
9. Re: Is this JBoss or an iBatis issue? Classpath issues...
adrianoats Jun 25, 2009 12:24 PM (in response to asack)Thanks again, my friend.... here is the info you've requested
Ibatis:
Implementation-Version: 2.1.7 build# 597
Jdk: jdk1.5.0_15
Jboss Version: 4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221140)
Any ideas?
Thanks. -
10. Re: Is this JBoss or an iBatis issue? Classpath issues...
jaikiran Jun 25, 2009 3:59 PM (in response to asack)Try this change in your code:
gerenteBD = DaoManagerBuilder.buildDaoManager(Resources .getResourceAsReader(this.getClass().getClassLoader(), resource), properties);
-
11. Re: Is this JBoss or an iBatis issue? Classpath issues...
adrianoats Jun 26, 2009 3:42 PM (in response to asack)Hmmm thanks....
At first try, it didn't work.....
Thanks a lot for your support. -
12. Re: Is this JBoss or an iBatis issue? Classpath issues...
adrianoats Jun 29, 2009 7:57 AM (in response to asack)Unfortunately,
That didn't work indeed. I´ve tested a lot of variations too with no sucess....
Thanks a lot for your support. -
13. Re: Is this JBoss or an iBatis issue? Classpath issues...
jaikiran Jun 29, 2009 10:45 AM (in response to asack)It's mainly related to which classloader iBatis ends up using. I guess it's using the wrong classloader. I thought passing the classloader would fix the issue, but as you mention it doesn't. It probably might be a good idea to open a forum thread in iBatis forums.
-
14. Re: Is this JBoss or an iBatis issue? Classpath issues...
adrianoats Jun 29, 2009 12:53 PM (in response to asack)I see, thanks for the help and explanation...
Could you, please, tell me a little more about the classloaders...
I got it when you said that Ibatis ends using the wrong one.... what I didnt get was what are it's options?
Is there more than one classloader in a web app? why is that?
Thanks.