It's all about the answers!

Ask a question

Error provisioning precondition extending AbstractScmService


Atul Kumar (1872029) | asked May 13 '14, 12:42 a.m.
edited May 16 '14, 1:18 a.m. by Sreerupa Sen (1.0k4)
Following is the Advisor code:
public class DeliverWhenReviewCompletedInTR extends AbstractScmService implements IOperationAdvisor {
    IRepositoryItemService itemService;  
    @Override
    public void run(AdvisableOperation operation, IProcessConfigurationElement advisorConfiguration, IAdvisorInfoCollector collector, IProgressMonitor monitor)         throws TeamRepositoryException {
        Properties prop = new Properties();
        try {   
            prop.load(new FileInputStream("config.properties"));
        } catch (IOException ex) {
            ex.printStackTrace();
        }
       
        Object operationData = operation.getOperationData();
        if (!(operationData instanceof DeliverOperationData)) {
            return;
        }
        DeliverOperationData data = (DeliverOperationData) operationData;
        List<IChangeSetHandle> changeSetHandles = data.getChangeSetHandles();

        itemService = getService(IRepositoryItemService.class);
        RestClient client = new RestClient();
        Resource resource = client.resource(prop.getProperty("TeamReviewServerURL") + "/rtcArtifact");
        List<String> rtcArtifactUuids = new ArrayList<String>();
        for (IChangeSetHandle iChangeSetHandle : changeSetHandles) {
            rtcArtifactUuids.add(iChangeSetHandle.getItemId().getUuidValue());
        }
        MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl<String, String>();
        queryParams.put(RtcArtifact.QueryParams.CHANGESET_UUID.name(), rtcArtifactUuids);
        resource.queryParams(queryParams);
        ClientResponse response = resource.contentType("text/plain").accept("text/plain").get();
        //Handle response here...
    }  
}

Tried testing the precondition with different versions of JTS:

a. 4.0.3 :- the provision status shows "the bundle could not be resolved" for the precondition. Searched this on jazz forum to find a similar question (https://jazz.net/forum/questions/126661/crjzs0383e-the-test-bundle-could-not-be-resolved). This question also noted this : I have not faced such issue with RTC 3.x and RTC 4.0.1 but facing for RTC 4.0.3.

Also tried writing a simple HelloWorld kind-of precondition and delploying it on the same server. But this also resulted in the same error - bundle could not be resolved.

b. 3.0.1.3 :- on this server, with the zip I found on the machine \\9.184.167.152\e$, after deploying the precondition, requestResetting, and restarting the server, the CCM application becomes unavailable. Any references to CCM result in 404 error.

c. 4.0.4 :- installed 4.0.4 from the repository on machine 9.184.167.152.  On starting the server, on the steps, deploying JTS and CCM applications, following exception is thrown, although the server starts
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:600)
        at org.eclipse.equinox.weaving.aspectj.AspectJWeavingActivator.start(Unknown Source)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
        at java.security.AccessController.doPrivileged(AccessController.java:277)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
        at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:374)
        at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1067)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:561)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:546)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:459)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:440)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:337)
Caused by: java.lang.NoClassDefFoundError: org.eclipse.equinox.service.weaving.IWeavingServiceFactory
        at org.eclipse.equinox.weaving.aspectj.AspectJWeavingStarter.start(Unknown Source)
        ... 19 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.equinox.service.weaving.IWeavingServiceFactory
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:460)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
        ... 20 more
No JMX HTML Adapter available

Tried uninstalling and installing this server multiple times, but the same exception resulted. As the server started with this error, I provisioned my precondition and did requestReset. Now, on restarting the server, I again get the same exception and the CCM application becomes unavailable, and all the URLs related to CCM result in HTTP 404.

Accepted answer


permanent link
Ralph Schoon (60.7k33643) | answered May 13 '14, 2:37 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
There are far too many cases that could cause your problem. If your deployment is not right an it is wrong enough the CCM application would not start. Does your extension work with Jetty? If you did not try yet, please perform https://jazz.net/library/article/1000 and also read https://rsjazz.wordpress.com/2013/02/28/setting-up-rational-team-concert-for-api-development/ .

Once your development environment is set up and your extension deploys in Jetty, we might be able to help get it deployed on other Appservers. All you can really do wrong then is missing libraries, packaging, *.ini files.

Atul Kumar selected this answer as the correct answer

Comments
Atul Kumar commented May 15 '14, 8:26 a.m.

Haven't tried the extension on Jetty. Tried provisioning on the default server (tomcat) that comes with JTS.


1
Ralph Schoon commented May 15 '14, 8:34 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

My experience is that it is a lot of wasted time to try to deploy an extensions without trying it out on Jetty first. The effort of following the Extensions Workshop and setting up a proper environment with Jetty and Tomcat for debugging and using it as described there saves 5 times more time than it costs.

2 other answers



permanent link
Olivier Thomann (111) | answered May 16 '14, 2:09 p.m.
JAZZ DEVELOPER
You might want to go through this article
https://jazz.net/library/article/495 .

It might help you to find out what is wrong with the deployment.

Olivier

Comments
Atul Kumar commented May 20 '14, 2:31 a.m.

Hi Olivier,

Had gone through this article, but it provides only basic steps to provision a precondition.

Thanks for the pointer.


permanent link
Atul Kumar (1872029) | answered May 20 '14, 2:02 a.m.
Hi Ralph,
The plugin was missing a dependency on another project, which was not getting available on the classpath at server. The provisionStatus didn't provide any stacktraces, so it became difficult to figure that out. So, started with your advisor (https://rsjazz.wordpress.com/2012/11/01/restrict-delivery-of-changesets-to-workitem-types-advisordelivery-of-changesets-associated-to-wrong-work-item-types-advisor/), and added my logic step-by-step to figure out the dependency issue.

The precondition is successfully provisioned now, and is working fine too!

Thanks a lot for your help.

Your answer


Register or to post your answer.