Initially we had swagger-codegen 2.4.22 in our project. We have customized the generator as per requirement with below set of code. Which was working fine.
<java jar="#{baseDir}/lib/swagger-custom-codegen.jar" fork="true" failonerror="true">
<arg line="generate"/>
<arg line="-l de.hybris.platform.XXXXX.swagger.XXXXCodegen"/>
<arg line="-i #{templateDir}/#{version}/#{file}"/>
<arg line="-o #{baseDir}/gensrc/"/>
<arg line="-c #{baseDir}/resources/swaggerconfig/#{version}/swagger-generator-config.json"/>
<arg line="--model-package #{defaultPackage}.#{version}.dto"/>
<arg line="--api-package #{defaultPackage}.#{version}.api"/>
</java>
Now we are upgrading to swagger-codegen 3.0.31 and above piece of code is failing with below error.
[echo] building extension 'XXXXX'...
[java] Exception in thread "main" java.lang.RuntimeException: Can't load config class with name de.hybris.platform.XXXXX.swagger.XXXXCodegen Available: dart
[java] at io.swagger.codegen.v3.CodegenConfigLoader.forName(CodegenConfigLoader.java:31)
[java] at io.swagger.codegen.v3.cli.SwaggerCodegen.main(SwaggerCodegen.java:96)
[java] Caused by: java.lang.ClassCastException: class de.hybris.platform.XXXXX.swagger.XXXXCodegen cannot be cast to class io.swagger.codegen.v3.CodegenConfig (de.hybris.platform.XXXXX.swagger.XXXXCodegen and io.swagger.codegen.v3.CodegenConfig are in unnamed module of loader 'app')
[java] at io.swagger.codegen.v3.CodegenConfigLoader.forName(CodegenConfigLoader.java:29)
[java] ... 1 more
BUILD FAILED
What is going wrong here?
Related
Selenium test case requires an if/else condition. How can I insert an if/else condition in a Selenium test case? We have a build file which has a variable CUSTOMNAME which is passed at runtime through an Ant command. If the value is passed, then execute the below line else ignore and move on with rest of the test case.
Run Keyword If || ${CUSTOMNAME}>0 || Select Checkbox
Build file:
<target name="Compute" depends="init">
<echo message="${TODAY_DE}"/>
<exec executable="cmd">
<arg line="/k start cmd.exe"/>
<arg line="/k pybot"/>
<arg line="--variable BROWSER:${Internet}"/>
<arg line="--variable REMOTE_URL:${Remote_Url}"/>
<arg line="--variable SERVICE:${Service}"/>
<arg line="--variable CUSTOMNAME:${CUSTOMNAME}"/>
<arg line="--name ${Service}_${Internet}"/>
<arg line="--doc ${Service}_${Internet}"/>
<arg line="-o ${output.dir}\${Service}_${Internet}_output.xml"/>
<arg line="-l ${logs.dir}\${Service}_${Internet}_logs.xml"/>
<arg line="-r ${docs.dir}\${Service}_${Internet}.html"/>
<arg line="${Compute_Test}"/>
</exec>
</target>
You can use the if attribute to run the Compute <target> only if the CUSTOMNAME property is set:
<target name="Compute" depends="init" if="CUSTOMNAME">
Notice the added if="CUSTOMNAME".
I am running selenium with cucumber-jvm and junit framwork.I modified this example as per my requirement. I need to run test through ant file, so I created corresponding ant file, my feature file is running correcting and it's also suggesting on cmd to implement #Given, #When,#Then etc regular expression, But I am also creating this steps in java file and providing path that file's package in glue parameter of #cucumber.option in my test file. But it's not picking properly.
Here is my some ant file code
<target name="run" depends="compile">
<mkdir dir="out/cucumber-junit-report"/>
<java classname="cucumber.api.cli.Main" fork="true" failonerror="false">
<classpath refid="compile.classpath"/>
<arg value="--format"/>
<arg value="junit:out/cucumber-junit-report.xml"/>
<arg value="--format"/>
<arg value="pretty"/>
<arg value="--format"/>
<arg value="html:out/cucumber-html-report"/>
<arg value="src/test/resources"/>
</java>
<junitreport todir="out/cucumber-junit-report">
<fileset dir="out">
<include name="cucumber-junit-report.xml"/>
</fileset>
<report format="frames" todir="out/cucumber-junit-report"/>
</junitreport>
</target>
and here is my testclass code
package com.cucumber;
import com.cucumber.stepdefs.AddRecordStep;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
#RunWith(Cucumber.class)
#Cucumber.Options(
glue = {"com.cucumber.pageobjects"}
)
public class AddRecordTest {
}
I checked many link everylink is saying use glue and define path but I am not able to get solution by using this. Below is my package structure's Image
I am stuck here. Any help is appriciated.
It looks like your glue parameter is not correct. It seems you are glueing the pageobject instead of the stepdef. If your step definitions are in AddRecordStep class then your glue parameter should be glue = {"com.cucumber.stepdefs"}
Another note, if your stepdefs are in the same or in subpackages as your RunCukes then cucumber would automatically find them for you and glue parameter in that case becomes optional.
I am migrating an application from weblogic 8.1 to weblogic 10.3.5 version.
while building application through ant script; I am getting below error:-
weblogic.appc.run:
[java] Usage: java weblogic.appc [options] <ear, jar, war or rar file or directory>
[java]
[java] where options include:
[java] -help Print the standard usage message.
[java] -version Print version information.
[java] -output <file> Specifies an alternate output archive or
[java] directory. If not set, output will be
[java] placed in the source archive or directory.
[java] -plan <file> Specifies an optional deployment plan.
[java] -forceGeneration Force generation of EJB and JSP classes.
[java] Without this flag the classes may not be
[java] regenerated if it is determined to be
[java] unnecessary.
[java] -quiet Turns off output except for errors
[java] -lineNumbers Add JSP line numbers to generated class
[java] files to aid in debugging.
[java] -library <file> Comma-separated list of libraries. Each
[java] library may optionally set its name and
[java] versions, if not already set in its
[java] manifest, using the following syntax: <file>
[java] [#name=<string>#libspecver=<version>
[java] #libimplver=<version|string>]
[java] -librarydir <dir> Registers all files in specified directory
[java] as libraries.
[java] -writeInferredDescriptors Write out the descriptors with inferred
[java] information including annotations.
[java] -manifest <file> Include manifest information from specified
[java] manifest file.
[java] -clientJarOutputDir <dir> Specifies a directory to put generated
[java] client jars.
[java] Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/j2ee/J2EELogger
[java] -keepgenerated Keep the generated .java files.
[java] -verbose Compile with verbose output.
[java] -classpath <path> Classpath to use.
[java] -source <source> Source version.
[java] -target <target> Target version.
[java] -advanced Print advanced usage options.
[java]
[java] at weblogic.application.compiler.Appc.runBody(Appc.java:205)
[java] at weblogic.utils.compiler.Tool.run(Tool.java:158)
[java] at weblogic.utils.compiler.Tool.run(Tool.java:115)
[java] at weblogic.application.compiler.Appc.main(Appc.java:262)
[java] at weblogic.appc.main(appc.java:14)
[java] Caused by: java.lang.ClassNotFoundException: weblogic.j2ee.J2EELogger
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
[java] ... 5 more
Below are ANT script which I am running over it.
<java classname="weblogic.appc" failonerror="true" fork="true" maxmemory="512m">
<arg value="-disableHotCodeGen"/>
<arg line="-verbose"/>
<arg line="${weblogic.arg.line.compiler}"/>
<arg line="-compilerclass com.sun.tools.javac.Main"/>
<arg line="${weblogic.appc.options}"/>
<arg value="${compile.dir}/${ejb.domain}-ejbc.jar"/>
<arg value="${project.dir}/src/java"/>
<arg value="${compile.dir}/ejb/${ejb.domain}"/>
<classpath>
<path refid="weblogic.classpath"/>
<path refid="project.classpath"/>
<fileset dir="${java.home}/../lib" includes="tools.jar"/>
</classpath>
</java>
Even though I am not able to find java.lang.NoClassDefFoundError: weblogic/j2ee/J2EELogger . which jar does supports this? Also I have set PATH and CLASSPATH properly.
Let me know if more information is required from my side.
In short, ensure you have /wlserver_10.3/server/lib/weblogic.jar in your weblogic.classpath variable.
The class that isn't loading is from /modules/com.oracle.core.weblogic.msgcat_1.1.0.0.jar. This should be imported by virtue of the MANIFEST.MF file in /wlserver_10.3/server/lib/weblogic.jar. Assuming that you have weblogic.jar in your weblogic.classpath then the class weblogic.j2ee.J2EELogger should be loaded.
weblogic.jar loads /modules/features/weblogic.server.modules_10.3.5.0.jar which in turn through it's own MANIFEST.MF loads /modules/com.oracle.core.weblogic.msgcat_1.1.0.0.jar.
You also have multiple <arg line=""> tags in your ant configuration. You will need to revise these.
<arg line="-disableHotCodeGen -verbose -compilerclass com.sun.tools.javac.Main ${weblogic.appc.options} ${compile.dir}/${ejb.domain}-ejbc.jar ${project.dir}/src/java ${compile.dir}/ejb/${ejb.domain}">
Another example below is how I currently execute appc in my ant build.
<target name="appc" depends="compile,jar">
<java classname="weblogic.appc" fork="yes" jvm="${bea.java.home}/bin/java" maxmemory="1G" failonerror="true">
<arg line="${archive.jarfile} -J-Xmx1g"/>
<classpath>
<pathelement path="${container.cp};${server.additional.classpath}"/>
<pathelement path="${archive.jarfile}"/>
</classpath>
</java>
</target>
Also, run ant with the -v switch to see the command being issued, it should help to find your problem.
I have a project using forms, it compiles and runs just fine,
but when compiled with the generated ant it doesn't run
my ant file has the java2 task and i added the needed jars to my lib folder
<property name="javac2.home" value="lib/idea"/>
<path id="javac2.classpath">
<pathelement location="${javac2.home}/javac2.jar"/>
<pathelement location="${javac2.home}/jdom.jar"/>
<pathelement location="${javac2.home}/asm.jar"/>
<pathelement location="${javac2.home}/asm-commons.jar"/>
<pathelement location="${javac2.home}/jgoodies-forms.jar"/>
</path>
<taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.classpath"/>
<taskdef name="instrumentIdeaExtensions" classname="com.intellij.ant.InstrumentIdeaExtensions" classpathref="javac2.classpath"/>
but when I run my program I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/intellij/uiDesigner/core/Spacer
Caused by: java.lang.ClassNotFoundException: com.intellij.uiDesigner.core.Spacer
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:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
I have noticed that the version compiled from the Idea has some classes in the output folder (what is missing) while the ant generated version doesn't have those classes.
EDIT: i implemented the solution from below, this means I modified my ant build to extract the content of forms_rt.jar to my output folder
<unjar src="${javac2.home}/forms_rt.jar" dest="${webserver.output.dir}">
<patternset>
<include name="**/*.class"/>
</patternset>
</unjar>
You need to include forms_rt.jar from IDEA_HOME\redist into the classpath of your application, either via manifest or by unpacking the classes from this jar and packaging them together with the final jar of your application.
When you compile from IDEA, it copies the required classes to the output automatically (it's controlled via an option in Settings | GUI Designer).
I got error
BUILD FAILED
C:\Projects...\build.xml:987: com.microsoft.sqlserver.jdbc.SQLServerException: The procedure 'sys.sp_addlogin' cannot be executed within a transaction.
How can i make an ant sql task run this?
thanks
Try use CREATE LOGIN instead of sp_addlogin
http://msdn.microsoft.com/en-us/library/ms189751.aspx
Well that I tried too but since I couldn't change the SQL script I found a walk around by using executable
<exec executable="sqlcmd" >
<arg value= "-S"/>
<arg value= "${ServerName}"/>
<arg value="-d"/>
<arg value="DataBaseName"/>
<arg value="-i"/>
<arg value="${build.sql}/mssql/script.sql"/>
<arg value="-E"/>
<arg value="-b"/>
</exec>