I am trying to implement "JDO" in my android app.
The big step in this is to integrate it into the backend endpoints implementation of my google appengine portion of the app.
In doing so, I added "jdo-api.jar" to my classpath, which made my PMF.class file error free.
However when I try to run "mvn clean install" I am still getting the error "package javax.jdo not found" - what am I doing wrong here???
It sounds like you're modifying the classpath in an IDE (eclipse?), but when running mvn you're using the maven environment defined in pom.xml. Try adding the jdo-api dependency to the pom.xml
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version> ...fill in version here... </version>
</dependency>
Related
I am working with a maven project in eclipse which I have been testing using the built-in "run on server" tomcat option. When I try to do this, I get errors stating certain dependencies are unmet from an external jar I reference in the POM. However I have found if I add the jar via the DeploymentAssembly Tab I can run in eclipse without issues:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.company.user.server.UserDetailsAuthoritiesMapper#0'
The issue comes when I try to deploy on an actual tomcat instance. The Maven build runs fine, but when I start the servlet I get the same unmet dependency errors. This to me is indicating that the external jar is not being properly packaged into the war. What is the maven equivalent of adding the package via the DeploymentAssembly tab in eclipse? The entry in the POM.xml:
<dependency>
<groupId>com.company.webapp</groupId>
<artifactId>webapp-user</artifactId>
<version>106</version>
</dependency>
Thanks
You need to locate the maven info for the external jar. If you google the name of the jar and maven you often find a direct link to the block you need. For example if I want version 1.58 of the Bouncy castle jar Google "Maven BouncyCastle" you can find the artifact info. Add that info to your pom.xml as a new dependency in your block.
<!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.58</version>
</dependency>
After you rebuild, refresh maven in your IDE 1st after doing a clean, this will tell maven to pull down the jar and added it to your build.
You can also go to the repo directly and search:
Maven Repo: https://mvnrepository.com/
I'm trying to convert a "classic" JAVA EE project, using IBM websphere 8.0.0.5, into a maven multi module project and facing issues with the IBM dependecies.
We use IBM classes from the following packages:
com.ibm.websphere.asynchbeans
com.ibm.websphere.scheduler
com.ibm.websphere.ce.cm
com.ibm.ws.asynchbeans
com.ibm.ws.util.ThreadPool
To get my local project to be compiled I downloaded the was.installer-8.0.0.pm from IBM and installed it to my maven using
mvn install -f "was.installer-8.0.0.pom" -D serverInstallationFolder="C:\Program Files (x86)\IBM\WebSphere\AppServer"
This step was successfull according to command line output.
I then added the following dependencies to my project as described from IBM:
In parent:
<dependency>
<groupId>com.ibm.tools.target</groupId>
<artifactId>was</artifactId>
<version>8.0.0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
In module:
<dependency>
<groupId>com.ibm.tools.target</groupId>
<artifactId>was</artifactId>
</dependency>
But I still can't compile my project as the IBM packages are not found.
Can anyone help me to find and correct a mistake I made?
Edit
After following BevynQ tip from the comments I copied the "was_public.jar" to "was_public-8.0.0.jar" (described at IBM here) and added it to my repository:
mvn install:install-file -Dfile="C:\Program Files (x86)\IBM\WebSphere\AppServer\dev\was_public-8.0.0.jar" -DpomFile="C:\Program Files (x86)\IBM\WebSphere\AppServer\dev\was_public-8.0.0.pom"
I then changed the dependencies to:
<dependency>
<groupId>com.ibm.websphere.appserver</groupId>
<artifactId>was_public</artifactId>
<version>8.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ibm.websphere.appserver</groupId>
<artifactId>was</artifactId>
</dependency>
This helped to get the compiling errors for the imports to com.ibm.websphere done.
What I now have still open is the packages com.ibm.ws.* package. Anyone have an idea?
Edit 2
I added the following dependency and then I was rid of the com.ibm.ws.* import errors.
<dependency>
<groupId>com.ibm.websphere.ws</groupId>
<artifactId>com.ibm.ws.runtime</artifactId>
<version>1.0.0</version>
</dependency>
But it still does not compile as now indirectly references can not be found (in my case commonj.work.WorkManager). It seems I need to add further .jars for every single thing. Isn't there an easier way to provide all websphere jars at once as descirbe in the above linked tutorial with the com.ibm.toolsdependency (which do not work)?
In general, com.ibm.websphere are public API for use by applications (this is true of the packages you listed above) which is consistent with these being in was_public.jar
However, com.ibm.ws package is generally product internals. May I ask what interface methods you are using from the com.ibm.ws.asynchbeans package? Maybe there is a public API alternative.
Regarding commonj.work, the only place I can find this in the WebSphere Application Server product image is WAS/plugins/com.ibm.ws.prereq.commonj-twm.jar so it looks like you will need to use that to compile against.
Here's the solution so I solved my dependency problems:
I configured the company repository manager (nexus) as a mirror. In this nexus all ibm packages are present. As you can think that solved the main problem.
I then added the following dependencies according to common maven style:
Dependencies in pom.xml (version numbers extracted to properties):
<dependency>
<groupId>com.ibm.websphere.ws</groupId>
<artifactId>com.ibm.ws.runtime</artifactId>
<version>${ibm.ws.runtime.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.ws.prereq</groupId>
<artifactId>commonj-twm</artifactId>
<version>${ibm.ws.prereq.commonj-twm.version}</version>
</dependency>
Sorry I can't provide a "nice" solution that's useable by all people but the answer from njr and the comment from BevynQ helped at lot to get clearer with the problem and helped to solve the problem in a "more manual" way by copying the needed jars by hand.
I was facing this issue as I tried to build a project using Maven version 3.3.9, running on Java version 1.8.0_101, as depicted in the screenshot:
This is how I resolved it: Step 1. Download the commonj.jar from here.
Step 2. Determine which JDK your Maven is using by typing mvn -version in the command prompt.
Step 3. Go to that directory and place the commonj.jar file there in the jre/lib/ext directory, as shown below. Now your project should build in maven without any issues.
I've got this kind of error when I try to run my app in Eclipse.
Failed to execute goal on project. Could not resolve dependencies for project pl.wyk:Game-Logic:war:0.0.1-SNAPSHOT: Could not find artifact com.sun:tools:jar:1.8.0_45 at specified path C:\java\jdk/../lib/tools.jar.
But when I try run app from console everything is fine. So what is wrong with Eclipse? I use this same external Maven Runtime.
Try to add your system JDK as Library in Eclipse and use it for the project.
If this doesn't work then you may have to add scope dependency but may cause portability issues:
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.6</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
The problem was with Alternate JRE. You need to choose proper path. In my case:
C:\java\jdk\jre
I am using eclipse. I have one Google App Engine project with spring is working locally and I am able to deploy it to google server.
Now I changed it with Maven integrity. It works locally fine. I am running it locally by maven build by setting appengine:devserver as goal.
But when try to deploy it to Google server, then it says error as follows.
Please help me.
Failed to initialize App Engine SDK at C:\Users\mviramga.m2\repository\com\google\appengine\appengine-api-1.0-sdk\1.8.6\appengine-api-1.0-sdk-1.8.6.jar
Unable to find C:\Users\mviramga.m2\repository\com\google\appengine\appengine-api-1.0-sdk\1.8.6\appengine-api-1.0-sdk-1.8.6.jar\lib\shared
pom.xml
<appengine.target.version>1.8.6</appengine.target.version>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${appengine.target.version}</version>
</dependency>
I resolved the issue. I am using jdk7
Eclipse Project is taking appengine-api-1.0-sdk-1.8.6.jar as SDK library and search for other subfolders so it gives error. If I select sdk installed external folder then it was not setting that folder.
So I did added that folder as library in project and gave highest priority and then it worked. Thanks for your all help.
I'm trying to run the YouTube JSON-C Sample in eclipse. I have followed the instructions in the link and I managed to run it in the command line using mvn -q exec:java, but when I import the project to eclipse (I use eclipse indigo), it says that "The import com.google.api.client.googleapis cannot be resolved", and gives me compiler errors in every line that is related to the api. Is there some other configuration that needs to be done? Specifically adding google-api-java-client-1.5.0-beta jars to the build path?
Ok I finally solved the problem. What did the work for me was to execute mvn eclipse:eclipse on the project folder in terminal...
You need to check if you are pulling out all the dependencies in pom.xml from the repository:
<dependencies>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.5.0-beta</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.5.0-beta</version>
</dependency>
</dependencies>
Check the settings.xml file in the Maven installation directory if it is pointing to a global repository or if you have hosted your own Nexus/Sonatype repository then make sure that your settings.xml points to that and also you must have the above two jars in your repository.
Or if you just want to get the project up and running, then instead of importing as a Maven project, just import it as a normal Java project and manually add the two libraries to the project's classpath. That should at the least get you started with the project without worrying about the Maven stuff.