Message Boards

LiferayClient setup fails with NPE in Talend job

thumbnail
Gunther Verhemeldonck, modified 3 Years ago.

LiferayClient setup fails with NPE in Talend job

New Member Posts: 7 Join Date: 11/23/12 Recent Posts

Hi

I have a Talend Job to synchronize products to a Liferay Commerce 3.x instance, which works fine from within TOS.

When running the Job from Liferay Dispatches, the job fails with a NullPointerException when it tries to read the "connectTimeout" property of the tLiferayOutput component. As you can see below the value is set at 30 seconds within TOS.

I'd expect that these value are respected during the build of the Job (export to zip), but apparently the value/property cannot be resolved at runtime.

Exception in component tLiferayOutput_1 (SyncProducts)
java.lang.NullPointerException
        at com.liferay.talend.properties.connection.LiferayConnectionProperties.getConnectTimeout(LiferayConnectionProperties.java:77)
        at com.liferay.talend.runtime.LiferaySourceOrSink.getLiferayClient(LiferaySourceOrSink.java:107)
        at com.liferay.talend.runtime.LiferaySourceOrSink.initialize(LiferaySourceOrSink.java:214)
        at com.liferay.talend.runtime.LiferaySourceOrSink.initialize(LiferaySourceOrSink.java:57)

Any ideas on how to further troubleshoot this issue?

Tx

thumbnail
Igor Beslic, modified 2 Years ago.

RE: LiferayClient setup fails with NPE in Talend job

New Member Posts: 17 Join Date: 8/17/11 Recent Posts

Hi Gunther, I understand that this reply is extremelly late, but let me answer for others that may bump into it.

The problem you reffer should be already fixed in latest liferay talend components code present in master branch. The cause is probably inadequat implementation of component that prevents saved connectTimeout value to be deserialized before host class - in this case tLiferayOutput.

To save you the troubles of compiling new components code, here are two workarounds:
1. THIS DOES NOT WORK ALWAYS: set REST Connection Timeout to 300, Save talend job, set back REST Connection Timeout to 30 and save again

2. This would always work:

- Put tLiferayConnection component at workspace and configure it with credentials

- Right click on it and from Context Menu pick On Component Ok and link it to any other talend component that starts the flow (see screensot)

Here is my example where I start flow only after tLiferayConnection is initialized. Good thing is that you may re-use connection in all other tLiferay components that target same environment as tLiferayConnection


Do not forget to update connection settings in your tLiferayOutput to set Connection Component to use tLiferayConnection instead of in-component configuration as you did in your example:

Hope this would help all others with same problem.