File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Websphere and the fly likes Junit/Ant issues with WAS 7.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Junit/Ant issues with WAS 7.0" Watch "Junit/Ant issues with WAS 7.0" New topic

Junit/Ant issues with WAS 7.0

kp sunil

Joined: Sep 03, 2008
Posts: 4
I am in the process of upgrading our app to WLS 10.3 and WAS 7.0 (from WLS 9.2.3 and WAS respectively)

Our WebSphere server has global security turned on, implemented by a custom user registry (custom java code). The EJBs deployed are protected with only certain users with certain roles given access. All the role, password checking etc done through custom security realm. Then there are client programs (stand alone java) that runs from a different JVM and access the server and looks up EJBs and so forth.

Our application ported successfully from 6.1 to 7.0. I can access the app, the external client programs still run and honors the security framework and all that.

However, we have a bunch of JUnit test cases which run fine on 6.1.x framework. Some tests runs as a cactus test case on the server side and some run extending a 'TestCase'. With 7.x, none of the test cases extending the plain vanilla 'TestCase' seem to work. The EJBs (protected) are all out of bounds now and all such test cases throw a CORBA NO PERMISSION error, when run through ant-junit target. However, I can take the same test case and run it as externally as a "org.junit.runner.JUnitCore" and it runs fine. All the external clients (it be a UT case or a regular java program) has some IBM recommended wrapper around it that sets various java_options, jaas options, WS_EXT_DIRS etc. as shown below. Note that WEBWORKS_HOME is local to my app.


rem --------------------------------------------------------------------
rem The following 2 options are required to suppress Websphere server related logging on the console when
rem a stand alone program runs
rem --------------------------------------------------------------------
set JAVA_CLIENT_OPTIONS=%JAVA_CLIENT_OPTIONS% -Djava.util.logging.configureByServer=true

set JAVA_CMD=%JAVA_HOME%\bin\java

set WAS_EXT_DIRS=%JAVA_HOME%\jre\lib\ext;%JAVA_HOME%\jre\lib;%JAVA_HOME%\lib;%JAVA_HOME%\lib\ext;%WAS_HOME%\lib;%WAS_HOME%\lib\ext;%WAS_HOME%\properties;%WAS_HOME%\plugins
set WAS_BOOTCLASSPATH=%JAVA_HOME%\jre\lib\ibmorb.jar;%WAS_HOME%\properties


rem setup the WebSphere classpath
set WAS_CLASSPATH=%WAS_HOME%\properties

rem --------------------------------------------------------------------
rem Set the overall classpath
rem --------------------------------------------------------------------
set CLASSPATH=%WEBWORKS_LIB_DIR%\exported\manu_3rdparty.jar
set CLASSPATH=%WEBWORKS_LIB_DIR%\exported\manu_client.jar;%CLASSPATH%

So, all of a sudden, ant-junit seems to have lost the capacity to perform! But the same test case when run as a stand alone java program (with all the bells and whistles above) seems to work. And of course, they all work when talking to a 6.1.x server
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

Do you know what the username/credential is for invoking the EJB from your test environment? Perhaps you could add a testing role to the EJB, and run JUnit as that user?

It's just a shot in the dark, though. Why would the security mechanism kick in for the newer WebSphere, but not for the latter? What is the API version of the EJB container from one WebSphere version to the other?


-Cameron McKenzie
kp sunil

Joined: Sep 03, 2008
Posts: 4
When I added

and changed${}/sas.client.props

tests started running.

I have a new issue that I am trying to resolve gracefully.

My final <junitreport task always complains about

C:\build\unittest_utilities.xml:255: Could not find a valid processor version implementation from

I am of course running all WebSphere related tasks using "ws_ant". When I manually switch to a plain vanilla ant ant try to run only the above target stand alone, I get my reports.
I have tried all classpath tricks and -D flags to get around this. Any thoughts?
I agree. Here's the link:
subject: Junit/Ant issues with WAS 7.0
It's not a secret anymore!