org.apache.openjpa.util.MetaDataException while build time enhancing using ANT - openjpa

I am using OpenJPA's build time enhancement using ANT. Here is the project structure
TestOpenJPA
+ src
| + in
| | + ns
| | | xxx.java
| + META-INF
| | persistence.xml
+ build
+ dist
+ OpenJPA_lib_jar
| openjpa-all-2.2.0.jar
+ build.xml
Here is the enhancement snippet code from build.xml file
<!-- Define the classpath to include the necessary files. -->
<!-- ex. openjpa jars, persistence.xml, orm.xml, and target classes -->
<path id="jpa.enhancement.classpath">
<!-- Assuming persistence.xml/orm.xml are in META-INF -->
<pathelement location="META-INF" />
<!-- Location of the .class files -->
<pathelement location="build/classes" />
<!-- Add the openjpa jars -->
<fileset dir="OpenJPA_lib_jar">
<include name="*.jar" />
</fileset>
</path>
<!-- define the openjpac task; this can be done at the top of the -->
<!-- build.xml file, so it will be available for all targets -->
<taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="jpa.enhancement.classpath" />
<!-- invoke enhancer on all .class files below the model directory -->
<openjpac>
<classpath refid="jpa.enhancement.classpath" />
<fileset dir=".">
<include name="**/model/*.class" />
</fileset>
</openjpac>
<echo message="Enhancement complete" />
When I build the project in eclipse (indigo) I get following exception in the output.
[openjpac] <openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.util.MetaDataException: MetaDataFactory could not be configured (conf.newMetaDataFactoryInstance() returned null). This might mean that no configuration properties were found. Ensure that you have a META-INF/persistence.xml file, that it is available in your classpath, or that the properties file you are using for configuration is available. If you are using Ant, please see the <properties> or <propertiesFile> attributes of the task's nested <config> element. This can also occur if your OpenJPA distribution jars are corrupt, or if your security policy is overly strict.
[openjpac] at org.apache.openjpa.meta.MetaDataRepository.initializeMetaDataFactory(MetaDataRepository.java:1904)
[openjpac] at org.apache.openjpa.meta.MetaDataRepository.endConfiguration(MetaDataRepository.java:1885)
[openjpac] at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:518)
[openjpac] at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:443)
[openjpac] at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:104)
[openjpac] at org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
[openjpac] at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
[openjpac] at org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:968)
[openjpac] at org.apache.openjpa.ant.PCEnhancerTask.executeOn(PCEnhancerTask.java:88)
[openjpac] at org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:171)
[openjpac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[openjpac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[openjpac] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[openjpac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[openjpac] at java.lang.reflect.Method.invoke(Unknown Source)
[openjpac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[openjpac] at org.apache.tools.ant.Task.perform(Task.java:348)
[openjpac] at org.apache.tools.ant.Target.execute(Target.java:390)
[openjpac] at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:180)
[openjpac] at org.eclipse.ant.internal.core.ant.InternalAntRunner.parseBuildFile(InternalAntRunner.java:348)
[openjpac] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:634)
[openjpac] at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:496)
[openjpac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[openjpac] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[openjpac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[openjpac] at java.lang.reflect.Method.invoke(Unknown Source)
[openjpac] at org.eclipse.ant.core.AntRunner.run(AntRunner.java:378)
[openjpac] at org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchDelegate.runInSameVM(AntLaunchDelegate.java:321)
[openjpac] at org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchDelegate.launch(AntLaunchDelegate.java:274)
[openjpac] at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854)
[openjpac] at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
[openjpac] at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:696)
[openjpac] at org.eclipse.core.externaltools.internal.model.ExternalToolBuilder.launchBuild(ExternalToolBuilder.java:181)
[openjpac] at org.eclipse.core.externaltools.internal.model.ExternalToolBuilder.doBuildBasedOnScope(ExternalToolBuilder.java:169)
[openjpac] at org.eclipse.core.externaltools.internal.model.ExternalToolBuilder.build(ExternalToolBuilder.java:88)
[openjpac] at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
[openjpac] at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[openjpac] at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
[openjpac] at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
[openjpac] at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
[openjpac] at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[openjpac] at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
[openjpac] at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
[openjpac] at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
[openjpac] at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
[openjpac] at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
[openjpac] at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
BUILD FAILED
Can anyone let me know what is

When I added <config propertiesFile = "${basedir}/src/META-INF/persistence.xml"/> in the <openjpac> tag the MetaDataException is gone. I found the solution here

Related

JNDI: Cannot instantiate class: org.jboss.naming.remote.client.InitialContextFactory

There is a similar question already on the board, nonetheless the solution code suggested is not working for me. I want to implement a simple chat program (jms pub/sub) by using Java Messaging Service and a Wildfly 10 Application Server. I configured and started the server in eclipse (status: Started,Synchronized). When I compile my programm consisting of only one class, this error message occurs:
javax.naming.NoInitialContextException: Cannot instantiate class: org.jboss.naming.remote.client.InitialContextFactory [Root exception is java.lang.ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory] at javax.naming.spi.NamingManager.getInitialContext(Unknown Source) at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source) at javax.naming.InitialContext.init(Unknown Source) at javax.naming.InitialContext.<init>(Unknown Source) at Chat.<init>(Chat.java:55) at Chat.main(Chat.java:128) Caused by: java.lang.ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source) at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source) ... 6 more
I dont think that there is anything wrong with the JNDI properties in the code (I tried several derivates):
Properties jndiProps = new Properties();
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.naming.remote.client.InitialContextFactory");
jndiProps.put(Context.PROVIDER_URL,"remote://localhost:9090");
jndiProps.put(Context.SECURITY_PRINCIPAL, "testuser");
jndiProps.put(Context.SECURITY_CREDENTIALS, "testpassword");
jndiProps.put("jboss.naming.client.ejb.context", true);
Context ctx = new InitialContext(jndiProps);
The wildfly 10 jar is added to the project path, as well as the jms.jar
What else can cause the error?
Edit:
I tried to use maven because I thought some jars are not recognized. I added wildfly10 and jms to my pom file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mannheim</groupId>
<artifactId>hello</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-ejb-client-bom</artifactId>
<version>10.0.0.Final</version>
</dependency>
</dependencies>
</project>
In the pom file it says for both dependencies:
Missing artifact javax.jms:jms:jar:1.1
So there are still problems with recognizing the jar.files i guess?
Refer sample example of Wildfly 10.

Error in Gatling maven plugin

I´m using gatling-maven-plugin to run some Performance test.
I just follow the official documentation http://gatling.io/docs/2.2/extensions/maven_plugin/
I have this configuration
<!--PERFORMANCE TEST-->
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>2.2.4</version>
<configuration>
<!--<disableCompiler>true</disableCompiler>-->
<configFolder>${project.basedir}/src/test/resources</configFolder>
<dataFolder>${project.basedir}/src/test/resources/data</dataFolder>
<resultsFolder>${project.basedir}/target/gatling/results</resultsFolder>
<bodiesFolder>${project.basedir}/src/test/resources/bodies</bodiesFolder>
<simulationsFolder>${project.basedir}/src/test/scala/performance/</simulationsFolder>
<runDescription>This-is-the-run-description</runDescription>
<simulationClass>${project.basedir}\src\test\scala\performance\TillScenario</simulationClass>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
it´s complaining because
error: java.lang.NoClassDefFoundError: scala/reflect/internal/AnnotationInfos$ErroneousAnnotation$
at scala.tools.nsc.typechecker.Typers$class.newTyper(Typers.scala:100)
at scala.tools.nsc.Global$$anon$1.newTyper(Global.scala:463)
at scala.tools.nsc.typechecker.Namers$Namer.<init>(Namers.scala:58)
at scala.tools.nsc.typechecker.Namers$NormalNamer.<init>(Namers.scala:50)
at scala.tools.nsc.typechecker.Namers$class.newNamer(Namers.scala:51)
at scala.tools.nsc.Global$$anon$1.newNamer(Global.scala:463)
at scala.tools.nsc.typechecker.Analyzer$namerFactory$$anon$1.apply(Analyzer.scala:43)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:441)
at scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:432)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:441)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:399)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:399)
at scala.collection.Iterator$class.foreach(Iterator.scala:750)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1202)
at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:399)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1500)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1487)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1482)
at scala.tools.nsc.Global$Run.compile(Global.scala:1580)
at scala.tools.nsc.Driver.doCompile(Driver.scala:32)
at scala.tools.nsc.MainClass.doCompile(Main.scala:23)
at scala.tools.nsc.Driver.process(Driver.scala:51)
at scala.tools.nsc.Main.process(Main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sbt.compiler.RawCompiler.apply(RawCompiler.scala:33)
at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1$$anonfun$apply$2.apply(AnalyzingCompiler.scala:146)
at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1$$anonfun$apply$2.apply(AnalyzingCompiler.scala:142)
at sbt.IO$.withTemporaryDirectory(IO.scala:344)
at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1.apply(AnalyzingCompiler.scala:142)
at sbt.compiler.AnalyzingCompiler$$anonfun$compileSources$1.apply(AnalyzingCompiler.scala:139)
at sbt.IO$.withTemporaryDirectory(IO.scala:344)
at sbt.compiler.AnalyzingCompiler$.compileSources(AnalyzingCompiler.scala:139)
at sbt.compiler.IC$.compileInterfaceJar(IncrementalCompiler.scala:58)
at com.typesafe.zinc.Compiler$.compilerInterface(Compiler.scala:148)
at com.typesafe.zinc.Compiler$.create(Compiler.scala:53)
at io.gatling.compiler.ZincCompiler$delayedInit$body.apply(ZincCompiler.scala:147)
at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:71)
at scala.App$$anonfun$main$1.apply(App.scala:71)
at scala.collection.immutable.List.foreach(List.scala:318)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
at scala.App$class.main(App.scala:71)
at io.gatling.compiler.ZincCompiler$.main(ZincCompiler.scala:36)
at io.gatling.compiler.ZincCompiler.main(ZincCompiler.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)
at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)
Caused by: java.lang.ClassNotFoundException: scala.reflect.internal.AnnotationInfos$ErroneousAnnotation$
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 54 more
And If I add this line in the configuration
<disableCompiler>true</disableCompiler>
it´s complaint because cannot find the my simulationClass
Caused by: java.lang.IllegalArgumentException: The requested class 'path\TillScenario' can not be found in the classpath or does not extends Simulation.
Any idea what I´m doing wrong?
Not sure whether you have added the Scala Maven Plugin or not after disabling the gatling-maven-plugin, but this might explain the second error, as described here. You should compile your Simulation classes somehow, either via the Gatling plugin or the Scala plugin.
As for the first error, it looks like a dependency mismatch issue. Make sure you are using the binary compatible versions of Gatling dependencies as well as Scala ones.
I hope this is helpful.
I resolved by updating scala library version from 2.11.6 to 2.11.8
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.8</version>
</dependency>

How to exclude META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA' in sbt

I have created jar from Intellij for spark+ scala code and try to run the jar in the dev cluster, But I end up with the following error:
Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:286)
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:239)
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:317)
at java.util.jar.JarVerifier.update(JarVerifier.java:228)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:348)
at java.util.jar.JarFile.getInputStream(JarFile.java:415)
at sun.misc.JarIndex.getJarIndex(JarIndex.java:137)
at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:674)
at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:666)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:665)
at sun.misc.URLClassPath$JarLoader.<init>(URLClassPath.java:638)
at sun.misc.URLClassPath$3.run(URLClassPath.java:366)
at sun.misc.URLClassPath$3.run(URLClassPath.java:356)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:355)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:332)
at sun.misc.URLClassPath.getResource(URLClassPath.java:198)
at java.net.URLClassLoader$1.run(URLClassLoader.java:358)
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)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at org.apache.spark.util.Utils$.classForName(Utils.scala:174)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:689)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
enter code here
Could you please advise how to exclude META-INF details?
Thanks.
You will want to add a maven-shade plugin and use the excludes like follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
..
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
This will remove the signed files and address your issue.

Maven -> module name could not be determined

I need to build sapui5 project using maven. SAP provides there own plugins for build, and all plugins seems to be at the place, but maven-plugin-coldwater fails on build.
So here is the part of build log. I can't google something useful about this error.
[ERROR] Failed to execute goal com.sap.ui5.tools.build:maven-coldwater-plugin:1.28.5:merge-modules (merge-application-modules) on project cprail.create.quote: Execution merge-application-modules of goal com.sap.ui5.tools.build:maven-coldwater-plugin:1.28.5:merge-modules failed: module name could not be determined -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.sap.ui5.tools.build:maven-coldwater-plugin:1.28.5:merge-modules (merge-application-modules) on project cprail.create.quote: Execution merge-application-modules of goal com.sap.ui5.tools.build:maven-coldwater-plugin:1.28.5:merge-modules failed: module name could not be determined
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
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 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution merge-application-modules of goal com.sap.ui5.tools.build:maven-coldwater-plugin:1.28.5:merge-modules failed: module name could not be determined
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:144)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.IllegalArgumentException: module name could not be determined
at com.sap.ui5.tools.build.utils.jsparser.JSModuleAnalyzer.onDefine(JSModuleAnalyzer.java:261)
at com.sap.ui5.tools.build.utils.jsparser.JSModuleAnalyzer.visit(JSModuleAnalyzer.java:130)
at com.sap.ui5.tools.build.utils.jsparser.JSModuleAnalyzer.analyze(JSModuleAnalyzer.java:73)
at com.sap.ui5.tools.build.utils.jsparser.JSModuleAnalyzer.analyze(JSModuleAnalyzer.java:64)
at com.sap.ui5.tools.build.utils.jsparser.JSModuleAnalyzer.getInfo(JSModuleAnalyzer.java:33)
at com.sap.ui5.tools.build.utils.modules.FileSystemResourceScanner.findPrefix(FileSystemResourceScanner.java:125)
at com.sap.ui5.tools.maven.merge.MergedModuleMojo.doExecute(MergedModuleMojo.java:296)
at com.sap.ui5.tools.maven.collage.MergedModuleMojo.doExecute(MergedModuleMojo.java:61)
at com.sap.ui5.tools.maven.base.AbstractUI5Mojo.execute(AbstractUI5Mojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
... 20 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
I met the same issue in my product build. after disabling autoDetectPrefix(remove <autoDetectPrefix>true</autoDetectPrefix>), it works fine.
<plugin>
<groupId>com.sap.ui5.tools.build</groupId>
<artifactId>maven-coldwater-plugin</artifactId>
<version>${sapui5.version}</version>
<executions>
<execution>
<id>merge-application-modules</id>
<phase>prepare-package</phase>
<goals>
<goal>merge-modules</goal>
</goals>
<configuration>
<themes>base,sap_hcb,sap_bluecrystal,sap_belize,sap_belize_plus,sap_belize_hcb,sap_belize_hcw</themes>
<directions>ltr,rtl</directions>
<locales>*</locales>
<resourceRoots>
<resourceRoot>
<folder>${basedir}/src/*******</folder>
<filters>
<filter>!**/test/**</filter>
</filters>
<autoDetectPrefix>true</autoDetectPrefix>
</resourceRoot>
</resourceRoots>
<outputFolder>${merged.stuff}</outputFolder>
<autoDetectOutputPrefix>true</autoDetectOutputPrefix>
<defaultPreloadFile>XXXXX.js</defaultPreloadFile>
<verbose>true</verbose>
</configuration>
</execution>
<execution>
<id>optimize-war</id>
<phase>package</phase>
<goals>
<goal>optimize</goal>
</goals>
<configuration>
<optimizeDefaultArtifact>false</optimizeDefaultArtifact>
</configuration>
</execution>
</executions>
<configuration>
<scanNonStandardFolders>true</scanNonStandardFolders>
</configuration>
</plugin>

How to run JUnit Eclipse Plugin tests with JMock?

I have Eclipse plug-in and junit tests for it, which are using jMock library.
When I run my test 'as junit', all tests are running correctly. But when I run them 'as JUnit plugin test' I'm getting the following error:
java.lang.TypeNotPresentException: Type [unknown] not present
at sun.reflect.annotation.TypeNotPresentExceptionProxy.generateException(TypeNotPresentExceptionProxy.java:27)
at sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:56)
at $Proxy4.value(Unknown Source)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:29)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:40)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:30)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
at org.eclipse.pde.internal.junit.runtime.UITestApplication$1.run(UITestApplication.java:114)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3468)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3115)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.pde.internal.junit.runtime.UITestApplication.start(UITestApplication.java:46)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Caused by: java.lang.NoClassDefFoundError: org/junit/internal/runners/JUnit4ClassRunner
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:183)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:576)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:546)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:477)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:465)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:445)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:376)
at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:33)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:449)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:95)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:107)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:31)
at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:370)
at sun.reflect.annotation.AnnotationParser.parseClassValue(AnnotationParser.java:351)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:280)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:222)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3070)
at java.lang.Class.getAnnotation(Class.java:3029)
at org.junit.internal.builders.IgnoredBuilder.runnerForClass(IgnoredBuilder.java:13)
... 39 more
Caused by: java.lang.ClassNotFoundException: org.junit.internal.runners.JUnit4ClassRunner
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:489)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 70 more
How to fix this?
Appreciate any help.
I've fixed it. JMock plugin, which I initially created, was the following:
plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin
id="jmock-2.5.1"
name="JMockClasses Plug-in"
version="1.0.0"
provider-name="">
<runtime>
<library name="bsh-core-2.0b4.jar">
<export name="*"/>
</library>
<library name="cglib-2.1_3-src.jar">
<export name="*"/>
</library>
...
<library name="jmock-2.5.1.jar">
<export name="*"/>
</library>
<library name="jmock-junit4-2.5.1.jar">
<export name="*"/>
</library>
...
</runtime>
<requires>
<import plugin="org.eclipse.core.runtime.compatibility"/>
</requires>
</plugin>
i. e. it was just a library on my classpath. I've changed it to the following:
META-INF/MANIFEST.MF:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: JMockPlugin
Bundle-SymbolicName: org.jmock_2.5.1
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: jmock.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.junit4
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: bsh-core-2.0b4.jar,
cglib-2.1_3-src.jar,
cglib-nodep-2.1_3.jar,
hamcrest-core-1.1.jar,
hamcrest-library-1.1.jar,
jmock-2.5.1.jar,
jmock-junit3-2.5.1.jar,
jmock-junit4-2.5.1.jar,
jmock-legacy-2.5.1.jar,
jmock-script-2.5.1.jar,
objenesis-1.0.jar
Now Eclipse OSGI classloader is able to load my JMockPlugin and I do not have any problems.