Hi,
some things you can try to debug problem:
- print the classpath content to verify the WL libs are actually present?
- run ant with debug flag (e.g. -verbose or -debug)
- run in IDE to verify the problem is only with command-line and not
hiding some other classloader issue.
If all this fails, you may want to try to produce the simplest possible
standalone project that reproduces problem and append it to a Jira issue
so we can have some concrete scenario to investigate.
Cheers
On 02/03/2010 18:31, Anikushkina Natalia wrote:
> Hello All!
>
> I encountered a problem during creating InitialContext in the test step
> class. I've got an exception:
>
> [scenarioRunner] javax.naming.NoInitialContextException: Cannot instantiate
> class: weblogic.jndi.WLInitialContextFactory [Root exception is
> java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory]
> [scenarioRunner] at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
> ...
> [scenarioRunner] Caused by: java.lang.ClassNotFoundException:
> weblogic.jndi.WLInitialContextFactory
> [scenarioRunner] at
> java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> [scenarioRunner] at java.security.AccessController.doPrivileged(Native
> Method)
>
> This means that the weblogic libraries were not defined in class path. But I
> provided definition of weblogic libraries in class path for the scenario
> runner task. See my build.xml for ant below. Could you provide any advices
> how I can avoid this problem?
>
> <project name = "jbehave_test" default = "test">
> <description>Unit testing system.</description>
> <import file = "${basedir}/../../../../../../../source/build.xml"/>
> <target
> name = "test"
> description = "Execute jbehave unit tests"
> depends = "compile-tests">
> <path id = "run.classpath">
> <path refid = "build.classpath"/>
> <path refid = "test.lib.path"/>
> </path>
> <taskdef name="scenarioRunner"
> classname="org.jbehave.ant.ScenarioRunnerTask"
> classpathref="run.classpath" />
> <scenarioRunner
> scenarioIncludes="**/scenarios/**/*.java"
>
> scenarioExcludes="**/scenarios/**/*Steps.java,**/scenarios/ShowScenario.java"
> classLoaderInjected="false"
> scope="test"
> batch="true"
> sourceDirectory="${project.src.dir}"
> testSourceDirectory="${test.src.dir}" >
> </scenarioRunner>
> <antcall target = "test.report"/>
> </target>
> <target
> name = "compile-tests"
> depends = "test-init, version-init, init"
> description = "Compile tests.">
> <mkdir dir = "${test.compile.dir}"/>
> <javac
> debug = "true"
> debuglevel = "lines,source"
> fork = "yes"
> destdir = "${test.compile.dir}"
> executable = "${JAVA_HOME}/bin/javac"
> source = "1.5">
> <src path = "${basedir}"/>
> <src path = "${project.src.dir}"/>
> <classpath refid = "test.lib.path"/>
> </javac>
> <path id = "build.classpath">
> <pathelement path = "${test.compile.dir}"/>
> </path>
> </target>
> <target name = "test-init" description = "Target initiates basic pathes
> and properties, makes necessary directories.">
> <property name = "project.src.dir" location =
> "${basedir}/../../../../../../../source"/>
> <property name = "config.dir" location = "${project.src.dir}"/>
> <property file = "${config.dir}/build.properties"/>
> <property name = "test.src.dir" value =
> "${basedir}/../../../../../../sources"/>
> <property name = "test.lib.dir" value =
> "${basedir}/../../../../../../lib"/>
> <property name = "project.lib.dir" value =
> "${basedir}/../../../../../../../lib"/>
> <property name = "test.output.dir" value =
> "${BASE_OUTPUT_DIR}/jb_test"/>
> <property name = "test.rawreport.dir" value =
> "${test.output.dir}/rawtestoutput"/>
> <property name = "test.output.htmlreport.dir" value =
> "${test.output.dir}/test-reports"/>
> <property name = "test.compile.dir" value =
> "${test.output.dir}/jb_test-classes"/>
> <echo>"Using wl: ${WL_HOME}</echo>
> <path id = "test.lib.path">
> <pathelement location="${WL_HOME}/lib/weblogic.jar"/>
> <pathelement location="${WL_HOME}/lib/webservices.jar"/>
> <pathelement location="${WL_HOME}/lib/wlclient.jar"/>
> <pathelement location="${WL_HOME}/lib/webserviceclient.jar"/>
> <pathelement location="${WL_HOME}/lib/xbean.jar"/>
> <pathelement location="${WL_HOME}/lib/apachexmlbeansutil.jar"/>
> <pathelement location="${WL_HOME}/lib/wsse.jar"/>
> <pathelement location="${WL_HOME}/../common/lib/apache_xbean.jar"/>
> <fileset dir = "${test.lib.dir}">
> <include name = "*.jar"/>
> </fileset>
> <fileset dir = "${project.lib.dir}/proprietary">
> <include name = "*.jar"/>
> </fileset>
> <fileset dir = "${project.lib.dir}/3rd_party">
> <include name = "*.jar"/>
> </fileset>
> </path>
> <classloader classpathref="test.lib.path" />
> <mkdir dir = "${test.output.dir}"/>
> <mkdir dir = "${test.rawreport.dir}"/>
> </target>
> <target name = "test.report">
> <taskdef name="renderReports"
> classname="org.jbehave.ant.ReportRendererTask"
> classpathref="test.lib.path" />
>
> <renderReports
> outputDirectory="${test.output.dir}"
> formats="txt,html,xml"
>
> templateProperties="defaultFormats=stats\nrenderedDirectory=rendered" />
>
> </target>
> </project>
>
> TIA,
> Natalia
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email