Originally, I was trying to tie together Oracle Database (21c) with RabbitMQ, to enable more efficient microservice communication between the database and a Docker environment (Swarm mode). I found this Java application. It works, but it doesn't work every time as I get an "Uncaught Java-exception". I couldn't figure out why, and the project seems to be abandoned(?), at least no commit has been made in almost 10 years. There are also unanswered issues. Anyway, I decided to try to learn some Java, and write my own program. I did, and running the app from the command line it behaves as expected (publishes "Hello World!" to a RabbitMQ queue). Great, then I load the app into the database like so:
loadjava -v -synonym -u user/pass@hostpdb -resolve -resolver "((* schema) (* PUBLIC) (* -))" target\AMQPforOracle-0.0.1.jar
It loads without errors. I find the class:
my/org/app/Publish JAVA CLASS VALID
I then create the function:
create or replace function amqp_test_send
return number
as language java
name 'my.org.app.Publish() return java.lang.Int';
With:
select object_name,object_type,status from user_objects where object_type LIKE 'JAVA%' and object_name like '%Publish';
I get this error:
ORA-29540: klassen my/org/app finnes ikke (Norwegian, translates to: class ... not found)
I have made sure the schema and user is correct.
Mind you, the original app i found on github does not produce this error, so I am doing something wrong, I am just not sure what. Why does it refer to my/org/app, when my/org/app/Publish should be the class? Is it something in my POM?:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>my.org.app</groupId>
<artifactId>oradb-amqp</artifactId>
<version>0.1</version>
<dependencies>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>5.14.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>my.org.app.Publish</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Any hints would be greatly appreciated!