0

I have a Maven project (ejb container) where I need to use the jcifs library. I made the entries in pom.xml like:

<dependency>
     <groupId>jcifs</groupId>
     <artifactId>jcifs</artifactId>
     <version>1.3.17</version>
     <type>jar</type>
</dependency>

Everything is okay, I see the jar file inside the ear package, I see it also in the dependencies of the project, I can use the classes but at runtime I get:

javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoClassDefFoundError: jcifs/smb/SmbFile
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)

What am I doing wrong?

siegi
  • 5,646
  • 2
  • 30
  • 42
Alex
  • 2,213
  • 4
  • 32
  • 44
  • I have put the jar file inside the libs folder of the JBoss server and it works now. But why it doesn't see the jar from the package ? – Alex Aug 09 '12 at 12:15
  • Ok, I have another dependency in the pom, but as same I get NoClassDefFoundError at runtime. Why ? – Alex Aug 16 '12 at 08:29

2 Answers2

0

Right-click the webproject and go to properties -> Java EE Module Dependencies. Check the Maven dependencies is checked.If not check and redeploy .

SANN3
  • 9,459
  • 6
  • 61
  • 97
0

I would like to help the people who are as stupid as I am. This is not really the about the same scenario as asked for in this question, but this question helped me to figure out my problem.

I wrote a little code in a scratch file, in my case in Intellij. Before that I added the jcifs dependency to my maven project, assuming that the scratch file would find it there, which in hindsight is a bit stupid, because how would the scratch space know.

So my hint is to have a look where the dependency will actually have an effect, i.e. is available - compile time, runtime, scratch space?

Also I wanted to mention that I used this library, which works very fine for me https://github.com/hierynomus/smbj.

So in my case I edited the run configuration so that it would take the maven modules configuration into the classpath.

So my guess is that @SANN3 's answer is correct for the actual question.

enter image description here

user637338
  • 2,565
  • 1
  • 25
  • 26