In java class I am trying to get rid of ClassCast exception as below.
java.lang.ClassCastException: weblogic.jdbc.wrapper.Array_oracle_sql_ARRAY
Using
if (someArray instanceof weblogic.jdbc.wrapper.Array)
ar = (oracle.sql.ARRAY) ((weblogic.jdbc.wrapper.Array)someArray).unwrap(Class.forName("oracle.sql.ARRAY")));
else
ar = (oracle.sql.ARRAY)someArray;
But I am not able to find the maven dependency having weblogic.jdbc.wrapper.Array
http://adfpractice-fedor.blogspot.com/2011/09/weblogic-wrapping-data-types.html
Most likely the tutorial that you're reffering to was created using JDeveloper, which has a bunch of WebLogic jars bundled.
If you're not using JDeveloper, here's what you can do - first identify which jar contains the class (the most lightweight one I could find is com.bea.core.datasource6.jar - this jar is a part of JDeveloper):
<dependency>
<groupId>com.oracle.weblogic</groupId>
<artifactId>com.bea.core.datasource6</artifactId>
<version>12.2.1-0-0</version>
</dependency>
then, in order to resolve the jar, either:
use the Oracle Maven repository (you need to register in order to use it):
OR
use the Oracle Maven Synchronization plugin (WebLogic or JDeveloper install required) to populate your local (or remote) Maven repository with Oracle jars - this basically takes most jars from a WebLogic install and runs a mvn install:install-file on them
Related
I want to include (import) some classes from an java package that is shipped as a war in the maven central repository but also has a jar package. Which is why its dependency xml on the mvn repository website is stated as
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine-rest</artifactId>
<version>7.14.0</version>
</dependency>
I use the dependency in my pom and my code compiles successfully. But when I run mvn clean install I get the below error:
Failure to find org.camunda.bpm:camunda-engine-rest:jar:7.14.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
Also when I add type war (<type>war</type>) to my dependency, I dont get the above error but now my code wont compile.
It is strange because when I visit https://repo.maven.apache.org/maven2 and navigate to the GAV I can find the jars
The JARs in the directory you showed have classifiers.
If you need one of them, you must add the classifier to the dependency, e.g.
<classifier>classes</classifier>
I don't know Camunda, but I would also look into the documentation. It may be better to use some other approach instead of trying the use a class of a WAR.
problem using pure spring boot "starter" dependencies that it contains camunda engine plus tomcat, so even when you remove tomcat using either or , it continues to run on tomcat as its already with in camunda engine. And when you try to create war file and paste in into shared camunda engine outside then that war will no work. This is because that war you created containing camunda engine and a tomcat inside it and when you paste into another outside camunda engine, it gets confused to which camunda to use.
See this solution : http://javaint4bytes.blogspot.com/2019/11/camunda-spring-boot-with-shared-engine.html
A possibly better approach would be to not reference the complete WAR as a dependency but the specific jars you need from it. You can add the jars you are importing from in your code (e.g. camunda-engine) to your POM instead of the complete war file. Here is an example: https://github.com/rob2universe/camunda-custom-rest-endpoint/blob/main/custom-endpoint/pom.xml
I'm trying to set up Arquillian tests for an application running in a Websphere (WAS8) container. For this I used the Maven coordinates I found on arquillian.org:
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-was-remote-8</artifactId>
<version>1.0.0.Beta2</version>
</dependency>
Unfortunately, no arquillian-was-* artifacts can be found via the two mentioned Maven repositories Maven Central and the JBoss Maven Repository.
Any ideas how I could get a hold of the required Arquillian WAS8 container adapter via Maven? The source code is located on github but it's unclear how to obtain the required JAR files...
Check this link : https://docs.jboss.org/author/display/ARQ/WAS+V8.0+-+Remote .
You have to build it yourself because as the link says : "This container implementation is currently not available in public maven repositories." Build instructions can be found on the link. Good Luck ! :)
I have tried to add below in pom.xml
<scope>system</scope>
<systemPath>${project.basedir}/lib/example-lib.jar</systemPath>
but didn't work.
More information that I found :
It might be related to spring boot maven plugin. https://docs.spring.io/spring-boot/docs/current/maven-plugin/ which it not included scope "system" lib when building jar.
Ref : https://github.com/spring-projects/spring-boot/blob/master/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LibraryScope.java
Thank you in advanced.
I would suggest you to install the file to your local repo using below command. rather than using system path(as it would be difficult to manage paths when there are multiple developers(with more complexities with different OS))
mvn install:install-file -Dfile=<your jar file location\file name>.jar -DgroupId=com.kp<groupId> -DartifactId={your custom artifactId} -Dversion={version} -Dpackaging=jar
I use the above approach to use oracle's ojdbc.jar which is not part of Maven Repo.
Running into a small problem. I have a spring-maven project. And there are some external jars I need to add into the POM which I did using .
Now to build the WAR file we are using an Ant Maven task i.e. artifact:mvn providing the argument war:war.
Here somehow my external jars are not getting added to the WAR file i.e. WEB-INF/lib
Can some one please let me know if I am missing something. Below is my pom entry
<dependency>
<groupId>{test}</groupId>
<artifactId>Test</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/test.jar</systemPath>
</dependency>
Best solution is to start using a repository manager (a.k.a "Maven proxy server") and install the needed artifacts (test.jar) into the repository manager and use it as a usual dependency instead of using system scope via systemPath.
Calling mvn war:war via Ant does not make sense and shows you should learn how Maven works.
Change the packaging type in your pom file to war and you can simply call maven via:
mvn clean package
and everything should work. But this is only gues cause you didn't show your full pom file.
Install the test.jar locally using mvn install:install-file (docs). Now you can remove the system scope (and the systemPath) and everything will work out of the box.
I started a project with maven using the "quickstart" archetype. I then changed my POM to include neo4j:
https://github.com/ENCE688R/msrcs/blob/master/pom.xml
I added:
https://github.com/neo4j/neo4j/blob/master/community/embedded-examples/src/main/java/org/neo4j/examples/EmbeddedNeo4j.java
and ran
mvn package
This works with no errors, but
java -cp target/msrcs-1.0-SNAPSHOT.jar org.neo4j.examples.EmbeddedNeo4j
Returns the Error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/neo4j/graphdb/RelationshipType
What am I missing? At this point I simply need to test that I can include and use neo4j.
use
mvn exec:java -Dexec.mainClass=org.neo4j.examples.EmbeddedNeo4j
there is also mvn dependency:copy that copies all dependencies to target/dependencies
and there is the mvn appassembler plugin that allows you to generate startup shell scripts that include all your dependencies as a classpath.
And last but not least there is the maven assembly plugin mvn assembly:single which generates a single jar file that you can run java -jar my-jar-file.jar
You need to add the Neo4j dependencies to your classpath as well. At the moment you're only adding the source jar you created. If you look at this POM you'll see that Neo4J examples require many other dependencies.
Find the libs directory where the dependencies have been downloaded (this may be in your local .m2 maven repo) and add these jars to your classpath. You do not need to add each jar one-by-one as you can simply add a directory with wildcards - ex:
Windows:
java -cp "target/msrcs-1.0-SNAPSHOT.jar;lib/*" org.neo4j.examples.EmbeddedNeo4j
Mac/Unix:
java -cp "target/msrcs-1.0-SNAPSHOT.jar:lib/*" org.neo4j.examples.EmbeddedNeo4j
I've started to work on some maven archetypes which could be a good starting point as well.
For java Neo4j projects, use neo4j-archetype-quickstart.
For Spring Data Neo4j projects, use sdn-archetype-quickstart.