Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Can't connect to Jazz Server in WAS 7.0

Hi,

I'm trying to connect to a Jazz server on a web application using WAS 7.0 and getting the error listed below. When I use the same code as stand alone Java, it works fine, but that doesn't help me out, I need it to work in the web app. I have all the RTC Plain Java jars in WEB-INF/lib (I think it has something to do with not being able to load these properly in WAS)

Here is the Error I am getting:
4/20/12 14:31:31:984 EDT] 0000002c SystemErr R com.ibm.team.repository.common.TeamRepositoryException: Badly configured client. Missing a foundation component tag.
0000002c SystemErr R at com.ibm.team.repository.client.internal.TeamRepository.checkServerVersionMatches(TeamRepository.java:1582)
0000002c SystemErr R at com.ibm.team.repository.client.internal.TeamRepository.internalLogin(TeamRepository.java:1444)
0000002c SystemErr R at com.ibm.team.repository.client.internal.TeamRepository.login(TeamRepository.java:617)
0000002c SystemErr R at rtc.GetRTC.login(GetRTC.java:52)
0000002c SystemErr R at rtc.GetRTC.tryToConnect(GetRTC.java:32)


These are the two methods I am using:

public static void tryToConnect(){

TeamPlatform.startup();
RepositoryPackage.eINSTANCE.eContents();
System.out.println("started up");
try {
IProgressMonitor monitor = new SysoutProgressMonitor();
ITeamRepository repo = login(monitor);
} catch (TeamRepositoryException e) {
System.out.println("Unable to login: " + e.getMessage());
} catch (Throwable t){
t.printStackTrace();
} finally {
if(TeamPlatform.isStarted()) //eliminate the errors in console from trying to stop
TeamPlatform.shutdown();
}

}

public static ITeamRepository login(IProgressMonitor monitor) throws TeamRepositoryException {
ITeamRepository repository = TeamPlatform.getTeamRepositoryService().getTeamRepository(url);

LoginHandler lh = new LoginHandler(username,password);
repository.registerLoginHandler(lh);
monitor.subTask("Contacting " + repository.getRepositoryURI());

try{
repository.login(monitor);
if(repository.loggedIn())
monitor.subTask("Connected");
} catch (Throwable t) {
monitor.subTask("Couldn't connect");
t.printStackTrace();
}
return repository;

}


Any help would be greatly appreciated.

Thanks in advance,
Stephen

1

0 votes



5 answers

Permanent link
Thanks for the reply Nick, I've now got it connecting.

Here is what I changed for anyone else having this same problem:
- I removed the javax.servlet jar from my build path
- I changed the classloader mode and policy. (Right Click on the EAR -> Java EE -> Open WebSphere Application Server Deployment, go to Application section and make Classloader mode: PARENT_LAST and WAR classloader policy: APPLICATION)

I found this thread useful: https://jazz.net/forums/viewtopic.php?t=16564

2 votes

Comments

Good to hear that you were able to get it working. I wonder whether there's some way to specify that classloader mode in your WAR file's manifest, rather than having to configure it manually.


Permanent link
It's complaining because it can't find the following extension:
	<extension point="com.ibm.team.repository.common.componentConfigurations">

<componentConfiguration id="com.ibm.team.jazz.foundation" version="4.0" clientCompatibilityVersion="4.0RC2"/>
</extension>

(or similarly for 3.x). This lives in the com.ibm.team.repository.common plug-in. You must already have that plug-in available, though, or it wouldn't be able to resolve any of the classes from that plug-in, like com.ibm.team.repository.common.TeamRepositoryException.

You will also need the com.ibm.team.rtc.common plug-in, which has a similar extension for the RTC component configuration (which is distinct from Foundation's). But the error would be different if that was the problem.

So it looks like the plugin extension registry is not properly initialized. Your code is doing everything it should, though, i.e. calling TeamPlatform.startup as early as possible. The only way it could be done earlier is if you called it in a static initializer in the first loaded class in your WAR.

When running as standalone Java (i.e. outside an OSGi/Equinox container), TeamPlatform.startup does various initialization, including poofing up a fake-o extension registry by scanning for all plugin.xml files on the classpath. When running under Equinox, this is skipped since Equinox is then responsible for managing the extension registry.

What do you get if you print out (before TeamPlatform.startup()) the results of:
com.ibm.team.repository.common.internal.util.InternalTeamPlatform.isStarted()
and
com.ibm.team.repository.common.internal.util.InternalTeamPlatform.asBundle()
?

The call to RepositoryPackage.eINSTANCE.eContents() used to be needed as a workaround in the past (especially when multiple classloaders were in play, like in a web container). I don't think it is now, but it doesn't hurt, so I would leave it in for now until you get things working, then can try without.

If you're able to run under debug, try setting a breakpoint in com.ibm.team.repository.common.internal.util.InternalTeamPlatform.start(boolean) and see whether initializeRegistry() gets called.

It's likely due to classloader differences when running under WAS. Others seem to have worked around the problem by tweaking WAS class loader order settings, e.g. see https://jazz.net/forums/viewtopic.php?t=16564 and https://jazz.net/forums/viewtopic.php?t=20933

There are several other topics discussing this in the forum, but no one clear solution.
e.g.
https://jazz.net/forums/viewtopic.php?t=14200
https://jazz.net/forums/viewtopic.php?t=21428
https://jazz.net/forums/viewtopic.php?t=19246
https://jazz.net/forums/viewtopic.php?t=16564
https://jazz.net/forums/viewtopic.php?t=2426
https://jazz.net/forums/viewtopic.php?t=5458

0 votes


Permanent link
I think the last post is long ago, but probably for anyone is this answer useful. 
I had the same problem as i use the RTC Plainlibs in Jython. (To extend an application(server-side) without compiling the code witch use the rtc). 

The fail for me was that i don't have the control, witch classloader loads the Plugin.xml - Files. (And as a developer i like to have the control ;D )

So i must correct the class of IBM. 
The Class StandaloneExtensionRegistry has a code line in the constructor: 
"StandaloneExtensionRegistry.class.getClass().getClassLoader()". 

I changed this to: 

 ClassLoader loader = ClassLoader.getSystemClassLoader();
 extensionFiles = loader.getResources("plugin.xml"); 

And add the *.Jars to the SystemClassLoader - path. 

Perhaps this is useful for anyone. 

JJ 

(Veersion 3.. of Plainlibs) 

0 votes


Permanent link
For others hitting this, in addition to trying Stephen's answer above, you can try seeing whether WebSphere (or someone else) is configuring a different Eclipse/Equinox extension registry than the "standalone" one we try to set up as part of TeamPlatform.startup().  Check the result of:

  org.eclipse.core.runtime.RegistryFactory.getRegistry() 

before calling TeamPlatform.startup().

0 votes


Permanent link
One more piece of information on this issue.

Setting PARENT_LAST as the class load policy might not work  if your application also contains 3rd party libraries that rely on WAS classes.

WAS support suggested these steps for loading the RTC Plain Java Client classes with a different class loader than the third party classes:
Package the RTC java client library as a server scoped shared library.
Make the shared library an isolated shared library by checking the "Use an isolated class loader for this shared library" checkbox in the Integrated Solutions console.
Associate the shared library with your application.
There should now be no need to use PARENT_LAST classloading.

For information on isolated shared libraries, see
http://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/index.jsp?topic=/com.ibm.iea.was_v7/was/7.0/Administration/WASv7_IsolatedSharedLibraries/player.html

For information on creating a shared library, see:
see http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/topic/com.ibm.websphere.ejbfep.multiplatform.doc/info/ae/ae/tcws_sharedlib.html


Ruby
Martha (Ruby) Andrews
Jazz L3 Developer

0 votes

Comments

For reference, this is also being tracked in the following work item:
Error running plain java app in WAS (76455)

To avoid this problem, with use RTC client API as isolated shared library, the user application still "REQUIRED" to use PARENT_LAST classloading.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Apr 20 '12, 2:37 p.m.

Question was seen: 9,149 times

Last updated: May 27 '13, 2:50 p.m.

Confirmation Cancel Confirm