I did a grails clean and afterwards when I run via grails run-app the app never starts and the following is repeatedly displayed (goes on forever, stuck in some kind of loop).
I'm running Grails 1.0.4, Java 1.6 on Windows XP.
Grails is somehow stuck in an invalid configuration. Any idea how to restore it?
[groovyc] Compiling 3 source files to C:\Documents and Settings\Steve\.grails\1.0.4\projects\myproject\classes
[javac] Compiling 3 source files to C:\Documents and Settings\Steve\.grails\1.0.4\projects\myproject\classes
2008-12-28 10:40:27.549:/myproject:INFO: Destroying Spring FrameworkServlet 'grails'
[6688] spring.GrailsWebApplicationContext Closing org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext#1c3c6d8: display name [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext#1c3c6d8]; startup date [Sun Dec 28 10:40:23 PST 2008]; parent: org.springframework.web.context.support.XmlWebApplicationContext#93912f
2008-12-28 10:40:27.549:/myproject:INFO: Shutting down log4j
[groovyc] Compiling 3 source files to C:\Documents and Settings\Steve\.grails\1.0.4\projects\myproject\classes
[javac] Compiling 3 source files to C:\Documents and Settings\Steve\.grails\1.0.4\projects\myproject\classes
2008-12-28 10:40:27.877::INFO: jetty-6.1.12
2008-12-28 10:40:27.892::INFO: No Transaction manager found - if your webapp requires one, please configure one.
2008-12-28 10:40:27.970:/myproject:INFO: Set web app root system property: 'myproject-development-0.1' = [C:\dev\myproject\web-app]
2008-12-28 10:40:27.970:/myproject:INFO: Initializing log4j from [file:C:\Documents and Settings\Steve/.grails/1.0.4/projects/myproject/resources/log4j.properties]
2008-12-28 10:40:27.970:/myproject:INFO: Initializing Spring root WebApplicationContext
[7297] spring.GrailsWebApplicationContext Refreshing org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext#1ada1e0: display name [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext#1ada1e0]; startup date [Sun Dec 28 10:40:27 PST 2008]; parent: org.springframework.web.context.support.XmlWebApplicationContext#18b24cb
[7297] spring.GrailsWebApplicationContext Bean factory for application context [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext#1ada1e0]: org.springframework.beans.factory.support.DefaultListableBeanFactory#1cf6930
2008-12-28 10:40:27.299:/myproject:INFO: Initializing Spring FrameworkServlet 'grails'
2008-12-28 10:40:27.314::INFO: Started SelectChannelConnector#0.0.0.0:8080
Okay, I tracked it down. I had a single .java file that was completely commented out. This is 100% legal as far as Java is concerned but apparently Grails can't handle it. Grails must be assuming that any .java will have a corresponding .class files. Since the file contained no Java code, it produced no corresponding class file.
Follow-up: This has been fixed in 2.0-M2, see GRAILS-3763
Related
I'm getting the following error while importing the data from Neo4j.
OrientDb server is not running as per the documentation.
[cloud_user#xxxxxxx bin]$ ./orientdb-neo4j-importer.sh -neo4jlibdir ~/neo4j-community-3.4.7/lib/ -neo4jdbdir ~/backup_files/graph.db/
Neo4j to OrientDB Importer v.3.0.10 - Veloce (build eac0654847df662ca03b45a6a5efa5eadd229ca5, branch 3.0.x) - Copyrights (c) 2017 OrientDB LTD
WARNING: 'o' option not found. Defaulting to 'false'.
WARNING: 'i' option not found. Defaulting to 'false'.
WARNING: 'odbdir' option not found. Defaulting to '/opt/orientdb/databases/neo4j_import'.
Please make sure that there are no running servers on:
'/home/cloud_user/backup_files/graph.db' (Neo4j)
and:
'/opt/orientdb/databases/neo4j_import' (OrientDB)
Initializing Neo4j...Done
Initializing OrientDB...Exception in thread "main" java.lang.NoClassDefFoundError: com/tinkerpop/blueprints/impls/orient/OrientGraphFactory
at com.orientechnologies.orient.neo4jimporter.ONeo4jImporterInitializer.invoke(ONeo4jImporterInitializer.java:94)
at com.orientechnologies.orient.neo4jimporter.ONeo4jImporter.execute(ONeo4jImporter.java:108)
at com.orientechnologies.orient.neo4jimporter.ONeo4jImporterMain.main(ONeo4jImporterMain.java:25)
Caused by: java.lang.ClassNotFoundException: com.tinkerpop.blueprints.impls.orient.OrientGraphFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
[cloud_user#xxxxxxx bin]$
I struggled for more than 2 hours trying to import data from Neo4j to Orientdb. The documentation is quite sloppy.
You can solve this issue by downloading the jar- orientdb-graphdb-*.jar into lib folder. However, you still might face the other issues of missing classes.
Downloading jars below helped to resolve such issues:
blueprints-core-*.jar
gremlin-groovy-3.3.4.jar
Let me know if you still face class missing issues.
Hope that saves someone's time.
OrientDB does not contain all of the necessary libraries it needs to perform this task by default. Often, you can define submodules to be imported in a pom file, but if you aren't using a Java application, then you need to import these libraries yourself into the lib/ folder of your OrientDB home directory.
To get the importer to work download the following JAR files and move them into the lib/ folder:
- orientdb-graphdb
- Tinkerpop Blueprints Core
- Gremlin Groovy
If I leave the "spring-boot-starter-tomcat" plugin dependency set to compile in the gradle build file I get the following error messages deploying to a standalone Tomcat 7 server:
INFO: validateJarFile(/usr/share/tomcat/webapps/ROOT/WEB-INF/lib/tomcat-embed-core-8.0.36.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Aug 18, 2016 2:51:19 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/usr/share/tomcat/webapps/ROOT/WEB-INF/lib/tomcat-embed-el-8.0.36.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
If I change the dependency to provided I can deploy to Tomcat but get the following error attempting to run or debug within IntelliJ IDEA 15:
ERROR org.springframework.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [orderserver.Application]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
...
Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
...
Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext
...
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext
How can I exclude these dependencies from the war file generation while retaining the ability to run/debug within IDEA?
Even better is there a way to generate a single war file that has embedded Tomcat for standalone execution that can also be deployed to a Tomcat container?
This issue was resolved by changing the dependency to provided and using a "Grails" run/debug configuration instead of the "Application" configuration that was set when I created the project with IDEA 15.
When I am trying to create a new Grails project getting the following error:
Grails: 3.0.9
Jdk: 1.8
Command terminated with an exception: java.lang.Exception (see details for partial output)
Command: C:\Program Files\Java\jdk1.8.0_65\bin\javaw.exe (11-Nov-2015 11:43:39 am)
---- System.out ----
---- System.err ----
Error: Could not find or load main class org.codehaus.groovy.grails.cli.support.GrailsStarter
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
------System.out:-----------
------System.err:-----------
Error: Could not find or load main class org.codehaus.groovy.grails.cli.support.GrailsStarter
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Please help me to get the solution for this.
Thanks
It seems you are running the project (or create) as a Java project instead of Grails project, cause it is trying to execute de Main java class
MY ant build is stopped working with JNDI error, it was working perfectly couple of days ago. The log says that it there is no initial context exception.
Buildfile: C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build.xml
clean:
[delete] Deleting directory C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build
prepare:
[mkdir] Created dir: C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build
[mkdir] Created dir: C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build\classes
[mkdir] Created dir: C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build\dist
[mkdir] Created dir: C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build\report
compile:
[javac] C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build.xml:75: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 331 source files to C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build\classes
copyresources:
[copy] Copying 3 files to C:\vseelsh_workspace\vseelsh_perforce_ws\pem_rd\NBDX\nbdx\build\classes
test:
schemaexport:
[hibernatetool] Executing Hibernate Tool with a JPA Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] log4j:WARN No appenders could be found for logger (org.jboss.logging).
[hibernatetool] log4j:WARN Please initialize the log4j system properly.
[hibernatetool] log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[hibernatetool] SLF4J: Class path contains multiple SLF4J bindings.
[hibernatetool] SLF4J: Found binding in [jar:file:/C:/vseelsh_workspace/vseelsh_perforce_ws/pem_rd/NBDX/nbdx/lib/gwt/gwt-2.3.0/gwt-2.3.0/samples/DynaTableRf/war/WEB-INF/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[hibernatetool] SLF4J: Found binding in [jar:file:/C:/Jboss/jboss-as-7.1.1.Final/modules/org/slf4j/impl/main/slf4j-jboss-logmanager-1.0.0.GA.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[hibernatetool] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[hibernatetool] An exception occurred while running exporter #2:hbm2ddl (Generates database schema)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.service.jndi.JndiException: Error parsing JNDI name [java:/nbdxDS]
[hibernatetool] javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
BUILD FAILED
The issue is resolved. Actually my project has two persistence.xml files where one of them is used by build.xml to export schema. In this file used by build.xml I should not use data source tag to refer JNDI (it is directly referring database credentials to connect to it). I have mistakenly copied contents from one persistence.xml file to another which has caused to have jta-datasource tag in it which I could not notice. It has forced build process to look for data source referred as JNDI in this file which is basically not possible because data source is not yet created and stored in JNDI by any other process. After removing this jta-datasource tag has resolved from this persistence tag has resolved the issue.
I am trying to include a jar in my struts2 project so that its actions are available to use in my main project. After adding the line
struts.convention.action.includeJars=.*?survey.*?
to my struts.properties and trying to redeploy to Tomcat with Maven, I get the errors:
WARN InterceptorBuilder 14 Nov 2012 09:58:09: Unable to load config class com.googlecode.scopeplugin.ScopeInterceptor at interceptor - jar:file:/other/dev/survey/webapp/target/survey-4.4-RC11-SNAPSHOT/WEB-INF/lib/survey-controller-4.4-RC11-SNAPSHOT.jar!/struts.xml:12:91 probably due to a missing jar, which might be fine if you never plan to use the bean-scope interceptor
ERROR InterceptorBuilder 14 Nov 2012 09:58:09: Actual exception
Caught Exception while registering Interceptor class com.googlecode.scopeplugin.ScopeInterceptor - interceptor - jar:file:/other/dev/survey/webapp/target/survey-4.4-RC11-SNAPSHOT/WEB-INF/lib/survey-controller-4.4-RC11-SNAPSHOT.jar!/struts.xml:12:91
at com.opensymphony.xwork2.ObjectFactory.buildInterceptor(ObjectFactory.java:214)
at com.opensymphony.xwork2.config.providers.InterceptorBuilder.constructInterceptorReference(InterceptorBuilder.java:70)
at org.apache.struts2.convention.DefaultInterceptorMapBuilder.buildInterceptorList(DefaultInterceptorMapBuilder.java:99)
and down the trace a bit further:
ERROR Dispatcher 13 Nov 2012 17:37:13: Dispatcher initialization failed
Unable to load configuration. - [unknown location]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:436)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
I've seen in other posts that this is because it can't find the struts.xml because there are two struts.xml files - one in my main project, and another in the jar that I am including. Is there some way to exclude that dependency struts.xml if that is the issue? Or is this related to something else altogether?
Removing the includeJars line allows me to deploy my app, but I can't access the actions in the jar that is being included.
Make sure you have the bean-scope interceptor in your struts.xml, and also as a dependency in your pom.xml.