This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Junit/Ant issues with WAS 7.0" Watch "Junit/Ant issues with WAS 7.0" New topic
Author

Junit/Ant issues with WAS 7.0

kp sunil
Greenhorn

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 6.1.0.19 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 ut.com.mypcakage.UTMyTestCase" 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.



================
set JAVA_CLIENT_OPTIONS=-Dcom.ibm.CORBA.validateBasicAuth=true
set JAVA_CLIENT_OPTIONS=%JAVA_CLIENT_OPTIONS% -Dcom.ibm.CORBA.ConfigURL=file:%WEBWORKS_HOME%/config/properties/sas.client.props
set JAVA_CLIENT_OPTIONS=%JAVA_CLIENT_OPTIONS% -Djava.security.auth.login.config=%WEBWORKS_HOME%/config/properties/webworks_jaas.config
set JAVA_CLIENT_OPTIONS=%JAVA_CLIENT_OPTIONS% -Dcom.ibm.CORBA.RasManager=com.ibm.websphere.ras.WsOrbRasManager

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.manager=com.ibm.ws.bootstrap.WsLogManager
set JAVA_CLIENT_OPTIONS=%JAVA_CLIENT_OPTIONS% -Djava.util.logging.configureByServer=true
set JAVA_CLIENT_OPTIONS=%JAVA_CLIENT_OPTIONS% -Dcom.ibm.SSL.ConfigURL=file:%WEBWORKS_HOME%/config/properties/ssl.client.props

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

set JAVA_CLIENT_OPTIONS=%JAVA_CLIENT_OPTIONS% -Xbootclasspath/p:%WAS_BOOTCLASSPATH%
set JAVA_CLIENT_OPTIONS=%JAVA_CLIENT_OPTIONS% -Djava.ext.dirs=%WAS_EXT_DIRS%
set JAVA_OPTIONS=%JAVA_CLIENT_OPTIONS%

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.jar;%CLASSPATH%
set CLASSPATH=%WEBWORKS_LIB_DIR%\exported\manu_client.jar;%CLASSPATH%
set CLASSPATH=%WEBWORKS_RESOURCES_DIR%;%WEBWORKS_PROPERTIES_DIR%;%WEBWORKS_XSD_DIR%;%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
    
    1

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?

Hmmm...Thinking...

-Cameron McKenzie
kp sunil
Greenhorn

Joined: Sep 03, 2008
Posts: 4
When I added
-Djava.naming.provider.url=corbaloc:iiop:${SERVER_HOST_NAME}:${SERVER_ORB_PORT}

and changed
-Dcom.ibm.CORBA.ConfigURL=${customized.properties.dir}/sas.client.props
to
-Dcom.ibm.CORBA.ConfigURL=file:${customized.properties.dir}/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 com.ibm.xtq.xslt.jaxp.compiler.TransformerFactoryImpl

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?
Thanks>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Junit/Ant issues with WAS 7.0
 
Similar Threads
Error in starting Jboss through Command Prompt
building of project with Ant1.5 on WebSphere5.0
Application Client Naming Exception
really urgent - AIX graph could not be displayed
cannot find the path specified