I upgraded AE to 1.7.2 and now get the following error when first trying to access a page:
What can I do to get 1.7.2 working???
Could not initialize class com.google.appengine.tools.appstats.RecordingData
Caused by:
java.lang.NoClassDefFoundError: Could not initialize class
com.google.appengine.tools.appstats.RecordingData
at com.google.appengine.tools.appstats.Recorder.makeAsyncCall(Recorder.java:300)
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.development.agent.runtime.Runtime.invoke(Runtime.java:115)
at com.google.appengine.tools.appstats.AppstatsFilter.call(AppstatsFilter.java:231)
Note: the "RecordingData" class that could not be initialized is in the appengine-api-labs.jar is definately in my build path only now it is not working. I guess though that the Could not initialize class error means it's being found but not working. the NoClassDefFoundError is misleading I suspect.
I had the same issue recently, I started working on an existing AppEngine project which had been using the 1.7.1 API. I had a new eclipse setup using the newest plugin (1.7.2.1 at the time of writing).
In my case there was an older copy of the labs jar (appengine-api-labs.jar) in the build path. Deleting this and replacing it with the version from the AppEngine SDK in current use resolved the issue.
You'll find the labs jar in your eclipse plugins directory under: appengine-java-sdk-[X.X.X.X]\lib\impl).
Once you have replaced the jar do a clean build and you should be laughing.
Related
The tutorial code from
http://doc.akka.io/docs/akka/2.0.2/intro/getting-started-first-java.html
Will not run. I have imported the required libraries but get the error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/typesafe/config/ConfigFactory
at akka.actor.ActorSystem$.apply(ActorSystem.scala:93)
at akka.actor.ActorSystem$.create(ActorSystem.scala:56)
at akka.actor.ActorSystem.create(ActorSystem.scala)
at Pi.calculate(Pi.java:152)
at Pi.main(Pi.java:15)
Caused by: java.lang.ClassNotFoundException: com.typesafe.config.ConfigFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 5 more
Anyone know how to get this working? I'm trying to run it in Eclipse.
Note: I'm running akka 2.1.2
The problem is that you are not actually using Akka 2.0.2: the Config library only became an external dependency in 2.0.3. Since you are getting started with Akka, may I suggest you look at the latest stable version 2.1.2 instead?
Concerning the problem at hand: you will need to add the artifact "com.typesafe"/"config" to your classpath (the exact version depends on which Akka version you are using, I suggest using a dependency management tool like Maven or SBT).
Here's a link to the documentation (including required Scala versions etc) for each major version of Akka: http://akka.io/docs/
I got a sample project, copied from somewhere else, when I am trying to run it in netbeans I am getting some error/exceptions in tomcat's console window.
java.lang.ClassNotFoundException: javax.persistence.Entity
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
at org.springframework.core.type.classreading.RecursiveAnnotationAttributesVisitor.visitEnd(AnnotationAttributesReadingVisitor.java:167)
at org.springframework.asm.ClassReader.a(Unknown Source)
at org.springframework.asm.ClassReader.accept(Unknown Source)
at org.springframework.asm.ClassReader.accept(Unknown Source)
javax.persistence is already added to my project. I even removed and re-added in netbeans but still same error. This error is when running the web applictation not when compiling.
You need to add following Jar Files to your Build Path: -
javax.persistence_2.0.3.v201010191057.jar
org.eclipse.persistence.jpa_2.3.0.v20110604-r9504.jar
org.eclipse.persistence.jpa.equinox_2.3.1.v20111018-r10243.jar
org.eclipse.persistence.antlr_2.3.0.v20110604-r9504.jar
org.eclipse.persistence.asm_2.3.0.v20110604-r9504.jar
Preferably adding the first one will work, as javax.persistence.Entity is found in that Jar only.
But you may also need to add the later ones, for working with JPA
Google them with the name of JPA Jars. You will get them.
The javax.persistence.Entity is a class inside the Java EE SDK library “javaee.jar“, you are missing this jar file in your project classpath.
refer this http://www.mkyong.com/hibernate/java-lang-classnotfoundexception-javax-persistence-entity/
JSP/servlets are something I would like to learn, so I set about creating my first tomcat application.
I have gone through the apache tutorial here, and progressed to trying to install my application in tomcat (simple test html file with appropriate dir structure). Now, I realise its very wishful thinking hoping to use the stock build.xml provided by the tutorial but I need to start somewhere, Im not sure how to write one myself just yet. I have looked for examples, but they dont seem to have 'install' targets, perhaps they are not web applications.
My project builds, but does not install onto tomcat via ant. When I attempt to 'ant install' my console outputs...
ant install
Buildfile: /home/mark/svn/tomcatapp/build.xml
Trying to override old definition of datatype resources
prepare:
compile:
[javac] /home/mark/svn/tomcatapp/build.xml:299: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
install:
BUILD FAILED
/home/mark/svn/tomcatapp/build.xml:375: java.lang.NoClassDefFoundError: org/apache/tomcat/util/buf/B2CConverter
at org.apache.catalina.util.Base64.encode(Base64.java:173)
at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:204)
at org.apache.catalina.ant.DeployTask.execute(DeployTask.java:211)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:811)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.util.buf.B2CConverter
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:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 19 more
Total time: 0 seconds
Why would a class fail to be found, would it not be contained within the tomcat install? There is a similar question, but I am not attempting to use the manager app, and I am not sure how to edit the class path - would I need to have compiled a .java class to create one for the project?
I am sure a more simple build file would suffice, but I am not sure which components are relevant. Sorry for the potentially very stupid questions.
Here is my install target from my build.xml file.
<target name="install" depends="compile"
description="Install application to servlet container">
<deploy url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"
localWar="file://${build.home}"/>
</target>
If you're using the sample build.xml , change
localWar="file://${build.home}"
to
war="${dist.home}/${app.name}-${app.version}.war"
If you have catalina-ant.jar in ANT_HOME/lib. Try removing it from this location.
Restart tomcat.
That has worked for me.
Short answer:
copy file tomcat-util.jar from CATALINA_HOME/lib to ANT_HOME/lib OR
when issuing ant commands, add -lib option with a path to that file,
for example ant -lib C:\Tomcat8\lib\tomcat-util.jar install (provided CATALINA_HOME points to C:\Tomcat8)
Explanation:
I have encountered similar problem with Tomcat 8.0.36. According to error message class org.apache.tomcat.util.codec.binary.Base64 was not found. ant install command from the tutorial executes deploy task, that is not a standard task in Ant, but a custom task provided by Tomcat. Deploy task is implemented by DeployTask class (full name of the class is org.apache.catalina.ant.DeployTask) which is placed in CATALINA_HOME/lib/catalina-ant.jar. Custom tasks (like DeployTask) usually are dependent on external libraries, so you need to add those libraries to Ant's classpath. For more information see Optional Tasks in Ant.
You have hit https://issues.apache.org/bugzilla/show_bug.cgi?id=52148
Upgrade to the latest Tomcat 7 release and the problem will go away.
I am also running a new version of Tomcat (7.0.32) and encountered the same error while trying to follow the tutorial. I know this isn't the best solution, but perhaps it will be helpful in your debugging: When I use the -lib option with ant I was able to make it pull in the jar files with the needed classes:
ant -lib /usr/local/apache-tomcat-7.0.32/lib/ -lib /usr/local/apache-tomcat-7.0.32/bin/ install (In my case /usr/local/apache-tomcat-7.0.32 is $CATALINA_HOME)
When I changed the sdk orm jar to v2 (default including by sdk),I got some excepion info.It's about the datanucleus-core-3.0.6.jar has ben registed bla bla....
After search,I knew it was a bug in 3.0.6. So, I relpace it by datanucleus-core-3.0.10.jar.
But it not success when compile the pojo Enhancer
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.NoSuchMethodError: org.datanucleus.plugin.PluginManager.<init>(Lorg/datanucleus/PersistenceConfiguration;Lorg/datanucleus/ClassLoaderResolver;)V
at org.datanucleus.OMFContext.<init>(OMFContext.java:159)
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
this is my jar file in the \lib\user\orm
asm-3.3.1.jar
datanucleus-api-jdo-3.0.5.jar
datanucleus-api-jpa-3.0.6.jar
datanucleus-appengine-2.0.0-final.jar
datanucleus-core-3.0.10.jar
geronimo-jpa_2.0_spec-1.0.jar
jdo-api-3.0.jar
transaction-api-1.1.jar
I has been looking for all day. Does any know what problem with it?
You have old versions of datanucleus-core and datanucleus-enhancer in the CLASSPATH somewhere. "OMFContext" from that stack trace hasn't existed in DataNucleus for a very long time.
I think I know, why it does not work to upgrade the appengine with a new datanucleus. It is not a classpath entry! I discovered that in the ant-macro.xml, which triggers the enhancing-step, there is a link to the appengine-tools-api.jar and there is the class EnhancerTask. This is probably a link to the old version since the new datanucleus-enhancer-3.0.1.jar has it's own EnhancerTask class. So the only way to use the new versions of datanucleus with the old appengine sdk (in contrary to http://code.google.com/p/datanucleus-appengine/wiki/HowToUpdateTheSDKWithANewPluginVersion) is to do the enhancement-step by either ant (https://developers.google.com/web-toolkit/doc/1.6/tutorial/appengine) or probably the eclipse-datanucleus-plugin. Unfortunately this plugin does not work properly in my Eclipse. After install/configure the plugin there is still no project-context menu "datanucleus", where I am supposed to add the support. So I'll try the ant version.
I am trying out m2eclipse, the Eclipse plugin for Maven, and have noticed that the resources are now excluded from the build path of all my projects.
I have seen a question on the M2Eclipse FAQ page which seems to deal with this exact question, but the answer (paraphrased) seems to say that this is intentional to allow resource filtering, and everything Should Just Work.
However, when I run my application from within Eclipse, lots of my resources in dependent projects are failing to get found by my application.
I have tried my usual Eclipse waving-a-rubber-chicken actions (cleaning all projects, starting with -clean) to no avail. I'm sure I'm missing something fairly simple. Does anyone have any suggestions?
EDIT: Some digging in the m2 console has revealed that one of the projects is not building correctly. I get a ClassNotFoundException when it tries to find org.apache.maven.plugin.MojoFailureException in a custom plugin used to build one of the projects.
org.apache.maven.lifecycle.LifecycleExecutionException: Internal error in the plugin manager executing goal 'ourdemain:ourcustomplugin:2.0:process': Mojo execution failed.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:505)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycleExecutor.java:265)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:191)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)
at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304)
at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
at org.maven.ide.eclipse.internal.project.DefaultBuildParticipant$1.execute(DefaultBuildParticipant.java:130)
at org.maven.ide.eclipse.internal.project.MavenProjectManagerImpl.execute(MavenProjectManagerImpl.java:986)
at org.maven.ide.eclipse.internal.project.MavenProjectFacade.execute(MavenProjectFacade.java:320)
at org.maven.ide.eclipse.internal.project.DefaultBuildParticipant.executePostBuild(DefaultBuildParticipant.java:116)
at org.maven.ide.eclipse.internal.project.DefaultBuildParticipant.build(DefaultBuildParticipant.java:80)
at org.maven.ide.eclipse.internal.builder.MavenBuilder.build(MavenBuilder.java:84)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:633)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.apache.maven.plugin.PluginExecutionException: Mojo execution failed.
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:601)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:498)
... 27 more
Caused by: org.apache.maven.plugin.MojoExecutionException: org/apache/maven/plugin/MojoFailureException
at org.codehaus.mojo.ruby.DefaultRubyMojo.execute(DefaultRubyMojo.java:98)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:579)
... 28 more
Caused by: java.lang.NoClassDefFoundError: org/apache/maven/plugin/MojoFailureException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.getConstructor(Class.java:1657)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:587)
at org.jruby.javasupport.Java.new_proxy_instance(Java.java:570)
at org.jruby.javasupport.JavaInvokerSnew_proxy_instancexx1.call(Unknown Source)
at org.jruby.runtime.callback.InvocationCallback.execute(InvocationCallback.java:49)
at org.jruby.internal.runtime.methods.FullFunctionCallbackMethod.internalCall(FullFunctionCallbackMethod.java:79)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:79)
at org.jruby.evaluator.EvaluationState.callNode(EvaluationState.java:577)
at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:206)
at org.jruby.evaluator.EvaluationState.setupArgs(EvaluationState.java:2182)
at org.jruby.evaluator.EvaluationState.attrAssignNode(EvaluationState.java:481)
at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:191)
at org.jruby.evaluator.EvaluationState.blockNode(EvaluationState.java:522)
at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:200)
at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:163)
at org.jruby.internal.runtime.methods.DefaultMethod.internalCall(DefaultMethod.java:167)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:79)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:125)
at org.jruby.evaluator.EvaluationState.callNode(EvaluationState.java:564)
at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:206)
at org.jruby.evaluator.EvaluationState.callNode(EvaluationState.java:544)
at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:206)
at org.jruby.evaluator.EvaluationState.localAsgnNode(EvaluationState.java:1230)
at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:285)
at org.jruby.evaluator.EvaluationState.rescueNode(EvaluationState.java:1522)
at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:349)
at org.jruby.evaluator.EvaluationState.ensureNode(EvaluationState.java:980)
at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:246)
at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:163)
at org.jruby.internal.runtime.methods.DefaultMethod.internalCall(DefaultMethod.java:167)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:79)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:125)
at org.jruby.evaluator.EvaluationState.fCallNode(EvaluationState.java:1019)
at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:252)
at org.jruby.evaluator.EvaluationState.blockNode(EvaluationState.java:522)
at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:200)
at org.jruby.evaluator.EvaluationState.rootNode(EvaluationState.java:1622)
at org.jruby.evaluator.EvaluationState.evalInternal(EvaluationState.java:355)
at org.jruby.evaluator.EvaluationState.eval(EvaluationState.java:163)
at org.jruby.Ruby.eval(Ruby.java:274)
at org.codehaus.plexus.component.jruby.JRubyRuntimeInvoker.runInterpreter(JRubyRuntimeInvoker.java:392)
at org.codehaus.plexus.component.jruby.JRubyRuntimeInvoker.invoke(JRubyRuntimeInvoker.java:313)
at org.codehaus.mojo.ruby.DefaultRubyMojo.execute(DefaultRubyMojo.java:81)
... 29 more
Caused by: java.lang.ClassNotFoundException: org.apache.maven.plugin.MojoFailureException
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
... 75 more
The resource filtering mentioned in the FAQ is run whenever the Maven builder is run on the project. In practice I've found this to be more trouble than it's worth as the Maven builder runs quite slowly, and is only run when configured (which by default is only on a full build), leaving you to scratch your head and wonder why your changes aren't picked up.
I tend to modify the Eclipse classpath to include src/main/resources. This is sufficient for most use cases.
For the cases where the simple approach doesn't work (for example if a dependent project has some complicated resource processing), I do as Robert suggests and turn off workspace resolution, then install the dependency to the local repository so it is included in the Maven classpath container.
Try switching between the embedded ( 3.0 AFAIK ) Maven runtime and the one you use to perform your builds ( locally installed ).
Maven installations http://img150.imageshack.us/img150/6193/m2eclipseinstallations.png