Google App Engine entities in a separate project are not being dataenhanced - java

I have my application entities in a separate project from my main servlet, and they aren't being DataNucleus enhanced.
Not sure if I'm just breaking the rules or what, but setting the ORM setting on the project doesn't enhance my .class files. The way my workspace is built is by compiling the projects, then running an ant script builds jar files and copies them into the lib directory of my servlet.
I suppose that if I must, I can add some java tasks to my ant scripts to enhance my .class files. If that's the case, an example of the task would be helpful.
I do want to keep my projects are they are, let me know what I need to do to maintain that.
This is my build.xml of the project containing my entities:
<project default="default">
<property name="appengine.sdk.dir" location="C:\superlongpathtomyeclipseplugins\plugins\com.google.appengine.eclipse.sdkbundle_1.6.5\appengine-java-sdk-1.6.5"/>
<import file="${appengine.sdk.dir}/config/user/ant-macros.xml"/>
<target name="default" depends="dist"/>
<target name="dist">
<enhance>
<classpath>
<pathelement path="${appengine.sdk.home}/lib/*"/>
<pathelement path="bin"/>
</classpath>
<fileset dir="bin" includes="**/*.class" />
</enhance>
<jar basedir="bin" destfile="dist\sessionexample.model.jar"/>
</target>
</project>
But now here is the error I'm getting:
java.lang.RuntimeException: Unexpected exception
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:76)
at com.google.appengine.tools.enhancer.Enhance.(Enhance.java:71)
at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:51)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:74)
... 2 more
Caused by: java.lang.NoClassDefFoundError: com/google/appengine/api/datastore/Key
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethods(Unknown Source)
at org.datanucleus.metadata.annotations.AbstractAnnotationReader.getJavaBeanAccessorAnnotationsForClass(AbstractAnnotationReader.java:238)
at org.datanucleus.metadata.annotations.AbstractAnnotationReader.getMetaDataForClass(AbstractAnnotationReader.java:128)
at org.datanucleus.metadata.annotations.AnnotationManagerImpl.getMetaDataForClass(AnnotationManagerImpl.java:136)
at org.datanucleus.metadata.MetaDataManager.loadAnnotationsForClass(MetaDataManager.java:2278)
at org.datanucleus.metadata.MetaDataManager.loadClasses(MetaDataManager.java:385)
at org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput(DataNucleusEnhancer.java:743)
at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:545)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1252)
... 7 more
Caused by: java.lang.ClassNotFoundException: com.google.appengine.api.datastore.Key
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.google.appengine.tools.enhancer.EnhancerLoader.loadClass(EnhancerLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 18 more
Do I need to keep adding things to my <classpath> until it works?

The DataNucleus project defines many ways to run enhancement. It's for you to choose which one makes most sense to your environment and build system. Any other methods not defined on that page are not supported (by us)

Finally got an ant task to run:
<project default="default">
<property name="appengine.sdk.dir" location="c:\pathtoeclipse\eclipse\plugins\com.google.appengine.eclipse.sdkbundle_1.6.5\appengine-java-sdk-1.6.5"/>
<import file="${appengine.sdk.dir}/config/user/ant-macros.xml"/>
<target name="default" depends="dist"/>
<target name="dist">
<enhance>
<classpath>
<pathelement path="${appengine.sdk.home}/lib/*"/>
<pathelement path="${appengine.sdk.home}/lib/user/*"/>
<pathelement path="${appengine.sdk.home}/lib/user/orm/*"/>
<pathelement path="bin"/>
</classpath>
<fileset dir="bin" includes="**/*.class" />
</enhance>
<jar basedir="bin" destfile="dist\sessionexample.model.jar"/>
</target>
</project>

Related

Ant file not able to run Java application via class files

I am using Ant to run my Java application. I have my main in Subscriber class which uses other libraries. So I wanted to run the Controller.Subscriber. But I get the following bug:
[java] Error: A JNI error has occurred, please check your installation and try again
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/paho/client/mqttv3/MqttCallback
[java] at java.lang.Class.getDeclaredMethods0(Native Method)
[java] at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
[java] at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
[java] at java.lang.Class.getMethod0(Class.java:3018)
[java] at java.lang.Class.getMethod(Class.java:1784)
[java] at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
[java] at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
[java] Caused by: java.lang.ClassNotFoundException: org.eclipse.paho.client.mqttv3.MqttCallback
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[java] ... 7 more
[java] Java Result: 1
My Ant file is the following:
<project default="run">
<target name="run">
<java classname="Controller.Subscriber" fork="true">
<classpath>
<pathelement path="target/classes"/>
</classpath>
</java>
</target>
</project>
The path to the Subscriber class: target/classes/Controller/Subscriber.class
What am I doing wrong? Do I have to first to create jar file from my class files to can run the java program or can I execute the class files? Or do I miss a parameter in my java command?
I also tried the following Ant file by giving explicit classpath:
<project default="run">
<target name="run">
<java classname="Controller.Subscriber" fork="true" classpath="classpath">
<classpath>
<pathelement path="target/classes"/>
</classpath>
</java>
</target>
<path id="classpath">
<fileset dir="target">
<include name="*.jar"/>
</fileset>
</target>
</project>
But I am getting the same error message.
I have found the solution to the problem: I have to use classpathref instead of classpath. For some reason classpath="classpath" does not read the id "classpath". But classpathref solved the problem.

Getting java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver while building selenium test by Ant

When I am trying to run my test case as Java Application, it executes successfully. But when I am running it through Ant, I am getting error that WebDriver class definition is not found. However, I have included the respective jar.
Please let me know where I am going wrong.
Below java file of test case resides in C:\Automation_Practice\DEPAutomation\src\workflows
package workflows;
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
public class UploadToken {
public static void main(String[] args) throws InterruptedException, IOException {
// Variable Declaration
WebDriver driver = new FirefoxDriver();
Actions action = new Actions(driver);
String baseUrl = "https://staging.maas360.com/emc/";
//String expectedTitle = "MaaS360";
//String actualTitle = "";
String uname = "3043275_sagrawal";
String password = "admin#123";
//Open Home Page
driver.manage().window().maximize();
driver.get(baseUrl);
//Login
driver.findElement(By.id("EMail")).sendKeys(uname);
driver.findElement(By.id("Password")).sendKeys(password);
driver.findElement(By.id("submit")).click();
//Go to Enrollments Page
Thread.sleep(5000);
WebElement deviceMenu = driver.findElement(By.xpath(".//*[#id='203']"));
WebElement enrollments = driver.findElement( By.xpath(".//[#id='766']"));
action.moveToElement(deviceMenu).perform();
Thread.sleep(5000);
enrollments.click();
//Go to Streamlined Enrollment page
Thread.sleep(10000);
driver.switchTo().frame(driver.findElement(By.id("Content")));
WebElement streamlineButton = driver.findElement(By.id("streamlinedEnrollButton"));
streamlineButton.click();
//Upload Token
Thread.sleep(10000);
driver.findElement(By.id("tokenNameInput")).sendKeys("Token 1");
WebElement browseButton = driver.findElement(By.xpath("//input[#id='fileInputTokenFile']"));
browseButton.click();
Thread.sleep(10000);
Runtime.getRuntime().exec("C:/Users/akhandelwal/Desktop/akash.exe");
Thread.sleep(5000);
driver.findElement(By.id("confirmFormSubmit")).click();
//Authenticate token upload
Thread.sleep(5000);
driver.findElement(By.id("passwordtext")).sendKeys(password);
driver.findElement(By.id("confirmPasswordFormSubmit")).click();
Thread.sleep(10000);
//Close Browser
driver.quit();
}
}
All the jars of selenium resides in C:\Automation_Practice\DEPAutomation\lib
Here is my build.xml file
<?xml version="1.0" encoding="UTF-8"?>
<project name="DEP" default="exec" basedir=".">
<!-- set global properties for this build -->
<property name="src" location="./src"/>
<property name="build.dir" location="${basedir}/build"/>
<property name="external.jars" value=".\lib"/>
<property name="TestOperation.dir" value="${external.jars}/TestOperation" />
<property name="test.dir" value="${src}/workflows"/>
<target name="setClasspath">
<path id="classpath_jars">
<pathelement path="${basedir}/"/>
<fileset dir="${external.jars}">
<include name="**/*.jar"/>
</fileset>
</path>
<pathconvert pathsep=";" property="test.classpath" refid="classpath_jars" />
</target>
<target name="clean">
<echo message="----------Delete the binary folder and create it again----------" />
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
</target>
<target name="compile" depends="clean,setClasspath">
<echo message="----------Compile the source files to ${build.dir}----------" />
<echo message="classpath:${test.classpath}"/>
<javac srcdir="${test.dir}" destdir="${build.dir}" debug="on" includeantruntime="false">
<classpath refid="classpath_jars"/>
</javac>
</target>
<target name="exec" depends="compile">
<jar destfile="${TestOperation.dir}/TestOperation.jar" basedir="${build.dir}">
<manifest >
<attribute name="Main-Class" value="workflows.UploadToken" />
</manifest>
</jar>
<java fork="true" jar="${TestOperation.dir}/TestOperation.jar" />
</target>
</project>
On running the Ant Build I am getting following error message:
Buildfile: C:\Automation_Practice\DEPAutomation\build.xml
clean:
[echo] ----------Delete the binary folder and create it again----------
[delete] Deleting directory C:\Automation_Practice\DEPAutomation\build
[mkdir] Created dir: C:\Automation_Practice\DEPAutomation\build
setClasspath:
compile:
[echo] ----------Compile the source files to C:\Automation_Practice\DEPAutomation\build----------
[echo] classpath:C:\Automation_Practice\DEPAutomation;C:\Automation_Practice\DEPAutomation\lib\TestOperation\TestOperation.jar;C:\Automation_Practice\DEPAutomation\lib\apache-mime4j-0.6.jar;C:\Automation_Practice\DEPAutomation\lib\bsh-1.3.0.jar;C:\Automation_Practice\DEPAutomation\lib\cglib-nodep-2.1_3.jar;C:\Automation_Practice\DEPAutomation\lib\commons-codec-1.10.jar;C:\Automation_Practice\DEPAutomation\lib\commons-collections-3.2.1.jar;C:\Automation_Practice\DEPAutomation\lib\commons-exec-1.3.jar;C:\Automation_Practice\DEPAutomation\lib\commons-io-2.4.jar;C:\Automation_Practice\DEPAutomation\lib\commons-lang3-3.4.jar;C:\Automation_Practice\DEPAutomation\lib\commons-logging-1.1.3.jar;C:\Automation_Practice\DEPAutomation\lib\cssparser-0.9.16.jar;C:\Automation_Practice\DEPAutomation\lib\gson-2.3.1.jar;C:\Automation_Practice\DEPAutomation\lib\guava-18.0.jar;C:\Automation_Practice\DEPAutomation\lib\hamcrest-core-1.3.jar;C:\Automation_Practice\DEPAutomation\lib\hamcrest-library-1.3.jar;C:\Automation_Practice\DEPAutomation\lib\htmlunit-2.17.jar;C:\Automation_Practice\DEPAutomation\lib\htmlunit-core-js-2.17.jar;C:\Automation_Practice\DEPAutomation\lib\httpclient-4.4.1.jar;C:\Automation_Practice\DEPAutomation\lib\httpcore-4.4.1.jar;C:\Automation_Practice\DEPAutomation\lib\httpmime-4.4.1.jar;C:\Automation_Practice\DEPAutomation\lib\jcommander-1.29.jar;C:\Automation_Practice\DEPAutomation\lib\jetty-io-9.2.11.v20150529.jar;C:\Automation_Practice\DEPAutomation\lib\jetty-util-9.2.11.v20150529.jar;C:\Automation_Practice\DEPAutomation\lib\jna-4.1.0.jar;C:\Automation_Practice\DEPAutomation\lib\jna-platform-4.1.0.jar;C:\Automation_Practice\DEPAutomation\lib\junit-dep-4.11.jar;C:\Automation_Practice\DEPAutomation\lib\nekohtml-1.9.22.jar;C:\Automation_Practice\DEPAutomation\lib\netty-3.5.7.Final.jar;C:\Automation_Practice\DEPAutomation\lib\phantomjsdriver-1.2.1.jar;C:\Automation_Practice\DEPAutomation\lib\sac-1.3.jar;C:\Automation_Practice\DEPAutomation\lib\selenium-java-2.46.0-srcs.jar;C:\Automation_Practice\DEPAutomation\lib\selenium-java-2.46.0.jar;C:\Automation_Practice\DEPAutomation\lib\serializer-2.7.2.jar;C:\Automation_Practice\DEPAutomation\lib\testng-6.8.5.jar;C:\Automation_Practice\DEPAutomation\lib\websocket-api-9.2.11.v20150529.jar;C:\Automation_Practice\DEPAutomation\lib\websocket-client-9.2.11.v20150529.jar;C:\Automation_Practice\DEPAutomation\lib\websocket-common-9.2.11.v20150529.jar;C:\Automation_Practice\DEPAutomation\lib\xalan-2.7.2.jar;C:\Automation_Practice\DEPAutomation\lib\xercesImpl-2.11.0.jar;C:\Automation_Practice\DEPAutomation\lib\xml-apis-1.4.01.jar
[javac] Compiling 3 source files to C:\Automation_Practice\DEPAutomation\build
exec:
[jar] Building jar: C:\Automation_Practice\DEPAutomation\lib\TestOperation\TestOperation.jar
[java] java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver
[java] at java.lang.Class.getDeclaredMethods0(Native Method)
[java] at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
[java] at java.lang.Class.privateGetMethodRecursive(Unknown Source)
[java] at java.lang.Class.getMethod0(Unknown Source)
[java] at java.lang.Class.getMethod(Unknown Source)
[java] at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
[java] at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
[java] Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.WebDriver
[java] at java.net.URLClassLoader.findClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClass(Unknown Source)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClass(Unknown Source)
[java] ... 7 more
[java] Error: A JNI error has occurred, please check your installation and try again
[java] Exception in thread "main"
[java] Java Result: 1
BUILD SUCCESSFUL
Total time: 2 seconds

Build error: NoClassDefFoundError: org/apache/xpath/XPathAPI [duplicate]

This question already has answers here:
java.lang.NoClassDefFoundError: org/apache/xpath/XPathAPI
(2 answers)
Closed 3 years ago.
I have upgraded my J2EE web application from jdk6,tomcat6 to jdk7 and tomcat7
but while deploying teamcity is giving following error.
[xmltask] java.lang.NoClassDefFoundError: org/apache/xpath/XPathAPI
java.lang.NoClassDefFoundError: org/apache/xpath/XPathAPI
at com.oopsconsultancy.xmltask.jdk14.XPathAnalyser14.analyse(XPathAnalyser14.java:29)
at com.oopsconsultancy.xmltask.XmlReplace.apply(XmlReplace.java:72)
at com.oopsconsultancy.xmltask.XmlReplacement.apply(XmlReplacement.java:61)
at com.oopsconsultancy.xmltask.ant.XmlTask.processDoc(XmlTask.java:707)
at com.oopsconsultancy.xmltask.ant.XmlTask.execute(XmlTask.java:676)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: java.lang.ClassNotFoundException: org.apache.xpath.XPathAPI
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 25 more
The missing class is contained in xalan-2.7.0 (See Maven central). So I think the problem is how your classpath has been set.
Considering that this appears to be an error reported by the xmltask task, does this mean the error is being thrown by ANT?
Google found the following example which might be the answer to your problems:
https://wiki.nci.nih.gov/display/NBIA/Migration+to+Java+7
Add the xalan jar to the classpath of your taskdef:
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
<classpath>
<pathelement path="${common.lib.dir}/xmltask-1.15.1.jar" />
<pathelement path="${common.lib.dir}/xalan-2.7.1.jar"/>
</classpath>
</taskdef>
if using maven add this to your dependencies section:
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.0</version>
</dependency>
I am not sure but, i guess jar named xalan-2.4.0.jar is missing
please download it and place inside.
http://www.java2s.com/Code/Jar/x/Downloadxalan240jar.htm
Add xpath to your classpath and try the deploy again. If you are not sure which xpath jar you need search in the tomcat libraries folder for xpathapi jar
Xpathapi is a jar used for evaluating xpaths (related to xml) in java. if you are not sure which version you need, google for it and fetch the latest xpath api jar .
For now I just remove
from my build.xml, and its working.
I know its not a solution but we have to deliver.
In Build.xml, change the java version to 1.7 and classpath XMLTask from 1.15.1 to 1.16.1.. It works
This is how I solved this, inlcuding Xalan and Serializer
Download xalan-j2-2.7.0.jar & serializer-2.7.0.jar
Update build.xml to include these jars in path
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
<classpath>
<pathelement location="../xmltask-v1.14.jar"/>
<pathelement path="../xalan-j2-2.7.0.jar"/>
<pathelement path="../serializer-2.7.0.jar"/>
</classpath>
</taskdef>
This should get it running.
You should remove import org.apache.xpath.operations.String;.

JDO3.0 enhance failure in GAE 1.7.2

I use ant to build my GAE WebApp. This is the datanucleus target:
<target name="datanucleusenhance" depends="compile"
description="Performs enhancement on compiled data classes.">
<enhance_war war="war">
</enhance_war>
</target>
This is the error I got:
org.datanucleus.exceptions.NucleusException: Plugin (Bundle) "org.datanucleus" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL
"file:/home/xxxx/.eclipse/org.eclipse.platform_4.2.0_1473617060/plugins/com.google.appengine.eclipse.sdkbundle_1.7.2/appengine-java-sdk-1.7.2/lib/opt/tools/datanucleus/v1/datanucleus-core-1.1.5.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/war/WEB-INF/lib/datanucleus-core-3.1.0-m5.jar."
I've tried this ant target:
<target name="datanucleusenhance" depends="compile" description="Performs enhancement on compiled data classes.">
<enhance_war war="war">
<args>
<arg value="-enhancerVersion" />
<arg value="v3.1.0" />
</args>
</enhance_war>
</target>
I've tried to delete "datanucleus-core-1.1.5.jar". The error then is:
java.lang.RuntimeException: Unexpected exception
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:76)
at com.google.appengine.tools.enhancer.Enhance.<init>(Enhance.java:71)
at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:51)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:74)
... 2 more
Caused by: java.lang.NoClassDefFoundError: org/datanucleus/OMFContext
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:172)
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:150)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1157)
... 7 more
Caused by: java.lang.ClassNotFoundException: org.datanucleus.OMFContext
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at com.google.appengine.tools.enhancer.EnhancerLoader.loadClass(EnhancerLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 10 more
How can I use JDO3.0 with GAE1.7.2?
Using the GAE plugin for Intellij, I had to remove the default configured orm directory, and specifically add the higher version libraries.
The GAE SDK is organized as such:
/lib/user/orm (default persistence libraries I removed)
AND
/lib/opt/user/datanucleus/v2
To access this configuration in IntelliJ, from the context menu for my project:
{context menu} -> Open Module Settings -> Libraries -> AppEngine ORM
Use the [-] button to remove the jars within this directory: /lib/user/orm
Use the [+] button to add the jars within this directory: /lib/opt/user/datanucleus/v2
Got the answer. The correct ant target should be:
<target name="datanucleusenhance" depends="compile" description="Performs enhancement on compiled data classes.">
<enhance_war war="war">
<args>
<arg value="-enhancerVersion" />
<arg value="v2" />
</args>
</enhance_war>
</target>
the version is the GAE JDO/JPA plugin version.(Thanks DataNucleus!:)
You seem to be confusing which versions of dependent jars to use. GAE 1.7.2 uses GAE JDO/JPA plugin v2.x, which in turn needs DataNucleus 3.x. You evidently have (various) DataNucleus 1.x jars present.

Web-start exception JNLP

So I'm a bit confused on how to sign a jar in order for it to run as a jnlp.
At present I have a jar, it runs, starts to download and verify stuff, then it gets to the end and a window pops up saying it's unable to launch, then it gives the exception:
JNLPException[category: Launch File Error : Exception: null : LaunchDesc:
<jnlp codebase="http:/SomeHost:8080/_test/" href="jnlpcomponent1.jnlp" spec="1.0+">
<information>
<title>jnlpcomponent1</title>
<vendor>SUN_MICR</vendor>
</information>
<security>
<all-permissions/>
</security>
<resources>
<jar href="lib/activation.jar" download="eager"/>
<jar href="lib/mail.jar" download="eager"/>
</resources>
<component-desc/>
</jnlp>
]
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
at com.sun.javaws.Launcher.prepareResources(Unknown Source)
at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I am fairly sure this has something to do with the jar being signed wrong / poorly... I could use some help in understanding what's going on here and how to fix it though.
Thanks a lot.
I am fairly sure this has something to do with the jar being signed
wrong / poorly
Exactly that happent, one of your jars isn't signed (properly)
What is always working for me:
unzip all jars than sign with 1 process. If is confirmed as it working, than I will remove 1-2 jar to match the original deployment design. And you will know in what jar is the problem, than easier to fix it.
You can use ANT to sign the JAR file. This way you can sign your files from within your IDE and it makes for a faster work-flow for when you deploy your appplication. Every change requires that you re-sign your application.
<project name="YourProject" default="dist" basedir="jarsigning">
<target name="signMainJar">
<signjar jar="../dist/YourApp.jar" destDir="signed" alias="WhateverYouSetIt2"
keystore="fileNameOfCerticate" storepass="passw03d" lazy="true" />
<echo message="The file was signed." />
</target>
<!-- Use this if you are using any libraries. These also need to be signed. -->
<target name="signLibs">
<signjar destDir="signed" alias="WhateverYouSetIt2"
keystore="fileNameOfCerticate" storepass="passw03d" force="true">
<path>
<fileset dir="lib" includes="*.jar" />
</path>
</signjar>
<echo message="The library files were signed." />
</target>
</project>
Before you can run this script, you need to first create a jarsigning directory and place a certificate (key) to be used for signing. Inside that folder, create a folder called "signed" and this is where your signed code will be placed by the script. Use the keystore tool to create a self-signed certificate if you have not purchased one from a granting authority like Verisign or GoDaddy.

Categories