Error while running CentraSite plugin with code based on CSAF API

Hello,

I’m developing an importer plugin for CentraSite (following the examples in the documentation - HowtoextendAddAssetsDiagraminCentraSiteControl.pdf).
The import code (that is called in the execute() method in the ImportAdapter), simply calls my class based on the CSAF API (dg-csaf.pdf).


	@Override
	public boolean execute() {
		boolean result = true;
		Migrator migrator = new Migrator();
		migrator.execute(Migrator.IMPORT_ACTION, getServerFilePath());
		if (migrator.hasError()) {result = false;}
		return result;
	}

I have two asset types created directly in CS: MyService and MyProject and the corresponding beans classes where generated with the GenerateCSAFBeans.cmd.

When I run the Migrator directly (that is, directly from eclipse) everything works fine, and all assets are created / updated as intended, but when I run via the Centrasite Import plugin, it starts working but when I try to create the first myService object it gives the following error :

this is one of the generated beans

I’ve already created a jar with only the bean interfaces and corresponding implementation classes and placed in every folder I could think of and still have the same problem.

This is a list of folders where I placed the myBeans.jar:

Am I missing the right place to put myBeans.jar or is something else that I’m doing wrong?
Does someone have a clue that I could follow?

I’ve been searching for a solution, and apparently there is nothing wrong with the location of the classes.

I create the connection to CentraSite, after that I can acess my interface (put there a public static property just for testing) and just afterwards when I try to create the object in the BeanPool is where the error occurs:

Code where error happens (last line) if I’m running the code via CentraSite import Plugin, when running directly from development environment it executes as expected.

	private void setConnection(boolean hasBrowserBehaviour) throws CSAppFrameworkException
	{
		// try {
		logger.info("Connecting to CentraSite...");
		provider = new StandaloneRegistryProvider(centraSiteUrl, centraSiteUser, centraSitePassword,
				hasBrowserBehaviour);

		Configuration conf = new Configuration();
		conf.setBeanMode(beanMode);
		conf.setRegistryProvider(provider);
		
		// Add the bean types to be used.
		conf.addBeanType(MyService.class);

		context = SessionContext.createInstance(conf);
		if (context == null)
		{
			throw new CSAppFrameworkException("Could not establish a session to " + centraSiteUrl
					+ ", with user " + centraSiteUser + "!");
		}
	}
...

...
	setConnection(true);		
	System.err.println(MyService.COMPONENT_NAME); // just to test the accessibility to myService interface
	context.getCurrentBeanPool().create(MyService.class);
...

Hi,

For avoiding class loading issues it is important to keep the CentraSiteFramework-common.jar together with your MyBeans.jar. To use the beans in Control you need to put them into the PluggableUI\CentraSiteControl\lib directory of your installation.

To avoid any conflicts I would propose to remove them from the other locations mentioned below.