Unable to load configuration after including Jar - struts2

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.

Related

Error while migrating data from Neo4j to OrientDb

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

Grails 3.1.10 exclude spring-boot-starter-tomcat plugin from war generation

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.

Jenkins Failed Inspecting Plugin during development

I'm trying to develop a new Jenkins plugin that has a jar dependency to something from my Nexus repo.
When I try to launch the plugin in a debug mode to attach my IDE
mvnDebug hpi:run
I get the following error message:
Apr 25, 2016 11:04:37 AM jenkins.InitReactorRunner$1 onTaskFailed
SEVERE: Failed Inspecting plugin C:\dev\Eclipse\vsync\work\plugins\vsync.hpl
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:230)
at java.util.zip.ZipFile.<init>(ZipFile.java:160)
at java.util.jar.JarFile.<init>(JarFile.java:168)
at java.util.jar.JarFile.<init>(JarFile.java:132)
at jenkins.util.AntClassLoader.addPathFile(AntClassLoader.java:502)
at hudson.ClassicPluginStrategy$AntClassLoader2.addPathFiles(ClassicPluginStrategy.java:768)
at hudson.ClassicPluginStrategy.createClassLoader(ClassicPluginStrategy.java:278)
at hudson.ClassicPluginStrategy.createPluginWrapper(ClassicPluginStrategy.java:253)
at hudson.PluginManager$1$3$1.run(PluginManager.java:254)
at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
at jenkins.model.Jenkins$7.runTask(Jenkins.java:905)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1176)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:795)
I've checked my vsync.hpl file and see that it was properly generated, but the Libraries list is quite long due to all the dependencies that my jar has pulled in with it.
I suspect that Jenkins is failing trying to access/open one of those dependencies, but I have no idea which one it is. Is there a way to get additional debug information out, to know which jar/zip file is failing?
Or baring that, is there a way I can put Jenkins itself (ie the Jetty container) in a debug mode and attach a debugger to that so I can step through the plugin load process and see what is failing?
I have encountered the same Exception and in my case, it was caused by having a pom dependency in pom.xml, like below:
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>cli</artifactId>
<version>1.596.1</version>
<type>pom</type>
</dependency>
Which cause Jenkins try to extract pom file, which fails.

The rule 'OCLint:ivar assignment outside accessors or init' does not exist

I am trying to integrate SonarQube to generate report on my iOS project,
I am using Objective-C Sonar plugin
When i run ./run-sonar.sh
OCLint generates a compile_commands.json file in my root directory.
and after that getting following error
11:24:39.782 INFO - Processing OCLint report /Users/.......app/./sonar-reports/oclint.xml
11:24:39.899 ERROR - Reporting 1073 violations.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 16.240s
Final Memory: 6M/86M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: The rule 'OCLint:ivar assignment outside accessors or init' does not exist.
Can any one help me on this issue?
Thanks
AMR
Thnaks
I had a similar error. My sonar server had two objective-c code analyser plugin. The Sonar Plugin for Objective C (free) and SonarSource Objective-C plugin (commercial)
When I removed (uninstalled) one of the plugin from sonar server the error stopped to occur
I had a similar error too with the last version of this plugin which is a fork of the one you used.
I downgrade my OCLint version from 0.11 to 0.10.1 and everything work perfectly.
It seems that the OCLint rules defined in the plugin was different of the OCLint version installed on my server.
I am not sure what version of the objective-c-sonar plugin that you were using.
I solved similar issue before.
Goto ${SONAR_INSTALLATION_FOLDER}/extensions/plugins/, copy the sonar-objective-c-plugin-${version}.jar to somewhere else.
unzip the jar file, and edit below file
org/sonar/plugins/objectivec/profile-oclint.xml
Add the rule you are missing following the layout of the xml file,
may be look similar below
<rule>
<repositoryKey>OCLint</repositoryKey>
<key>ivar assignment outside accessors or init</key>
</rule>
And edit another file org/sonar/plugins/objectivec/rules-oclint.xml
<rule>
<key>ivar assignment outside accessors or init</key>
<name>ivar assignment outside accessors or init</name>
<priority>MAJOR</priority>
<description>ivar assignment outside accessors or init</description>
</rule>
And then using zip to package the files unpacked as the new jar file.
Override the original plugin jar file in ${SONAR_INSTALLATION_FOLDER}/extensions/plugins/, restart the sonar, issue could be gone.
Repeat the step for all similar issues you encountered.

After grails clean I can't run-app

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

Resources