1

I'm not sure about how the protocol is in here but this is what I'm doing. There's an issue I found which I solved myself so I'm posting the issue and posting the solution as question and answer respectively. So here goes the issue:

I was trying to perform unit tests using junit, embedded glashfish, JPA and hit a roadblock when a java.lang.ExceptionInInitializerError at org.apache.derby.jdbc.EmbeddedDataSource.findDriver(Unknown Source) raised after running the tests.

Any ideas?

The pom file has

...
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.11</version>
</dependency>
<dependency>
    <groupId>org.glassfish.main.extras</groupId>
    <artifactId>glassfish-embedded-all</artifactId>
    <version>4.0</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.apache.derby</groupId>
    <artifactId>derby</artifactId>
    <version>10.10.1.1</version>
</dependency>
...
Jonathan Morales Vélez
  • 3,030
  • 2
  • 30
  • 43

1 Answers1

1

The issue was the order in the dependencies of the pom file.

The Derby dependency was after the embedded glassfish one. Dependencies then go like this

...
<dependency>
    <groupId>org.apache.derby</groupId>
    <artifactId>derby</artifactId>
    <version>10.10.1.1</version>
</dependency>
<dependency>
    <groupId>org.glassfish.main.extras</groupId>
    <artifactId>glassfish-embedded-all</artifactId>
    <version>4.0</version>
    <scope>test</scope>
</dependency>
...

Looks like a foolish solution but I spent hours researching until I found it. Hope it helps

Jonathan Morales Vélez
  • 3,030
  • 2
  • 30
  • 43