2

I'm developing a Spring project and I need to call a function that is in another jar.

I have imported the jar, and tried to access the class:

  1. Imported the jar
  2. Create an object using the class.

The problem is that, when I run the program, it doesn't start because this error:

java.lang.ClassNotFoundException:
org.apache.ibatis.exceptions.PersistenceException
2016-11-09 16:07:33.867 ERROR 8912 --- [nio-9090-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : 
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; 
nested exception is java.lang.NoClassDefFoundError: org/apache/ibatis/exceptions/PersistenceException] with root cause

The problem is that my outer jar, is not working (it's programmed in Spring) because it can't load the context...

So my question is... Hoy can be the context loaded when I try to work with this classes?

Thanks

EDIT: one tip of Eclipse: The type org.apache.ibatis.session.SqlSession cannot be resolved. It is indirectly referenced from required .class files

Joas Jueas
  • 51
  • 4
  • add the xml that does the mapping and the log! – Ahmad Sanie Nov 09 '16 at 14:45
  • The xml is ok, the jar works itself, I will edit now to add the full trace! – Joas Jueas Nov 09 '16 at 14:48
  • 1
    How have you imported the jar? This looks like a classpath problem. Are you using a dependency management tool such as Maven? – Taylor Nov 09 '16 at 15:17
  • Yes, I'm using Maven, but I imported it by going into classpath and adding the external jar. The problem is that the class I'm trying to use, have some @Autowired, that can't work because the context isn't load – Joas Jueas Nov 09 '16 at 15:33
  • Possible [duplicate](http://stackoverflow.com/questions/5113579/how-to-import-spring-config-xml-of-one-project-into-spring-config-xml-of-another) – Maxime Nov 09 '16 at 16:01

0 Answers0