[
https://issues.apache.org/jira/browse/SLING-5827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15367474#comment-15367474
]
Ivo Leitão commented on SLING-5827:
-----------------------------------
Hi !
I was little confused also but I suspect the problem is the way I have made my
declarative component. In my case I have two configuration pids
This is my component configuration header:
{code:title=Component.java|borderStyle=solid}
@Component(
configurationPid = {
WSConstants.CPID_WS,
WSConstants.XXX
},
configurationPolicy = ConfigurationPolicy.REQUIRE,
reference = {
@Reference(
name = WSConstants.CONTEXT_SERVICE_REF,
service = DataContext.class,
cardinality = ReferenceCardinality.MANDATORY)
})
{code}
The component annotation
{code:title=Configuration.java|borderStyle=solid}
@ObjectClassDefinition(pid = WSConstants.XXXX, name = "%name", description =
"%description", localization = "OSGI-INF/l10n/ws/xxxx/xxx", icon =
@Icon(resource = "OSGI-INF/icon/ws.png", size = 32))
public @interface Configuration {
@AttributeDefinition(name = "%name.name", description =
"%name.description")
String name() default "xxxx";
@AttributeDefinition(name = "%namespaceUri.name", description =
"%namespaceUri.description")
String namespaceUri() default "xxxx";
@AttributeDefinition(name = "%serviceName.name", description =
"%serviceName.description")
String serviceName() default "xxxx";
@AttributeDefinition(name = "%wsdlLocation.name", description =
"%wsdlLocation.description")
String wsdlLocation() default "xxxx";
@AttributeDefinition(name = "%address.name", description =
"%address.description")
String address() default "xxxx";
@AttributeDefinition(name = "%userName.name", description =
"%userName.description")
String userName() default "xxxx";
@AttributeDefinition(name = "%password.name", type =
AttributeType.PASSWORD, description = "%password.description")
String password() default "xxxx";
@AttributeDefinition(name = "%connectionTimeout.name", type =
AttributeType.LONG, min = "0", description = "%connectionTimeout.description")
long connectionTimeout() default 10000;
@AttributeDefinition(name = "%receiveTimeout.name", type =
AttributeType.LONG, min = "0", description = "%receiveTimeout.description")
long receiveTimeout() default 180000;
@AttributeDefinition(name = "%proxyEnabled.name", type =
AttributeType.BOOLEAN, description = "%proxyEnabled.description")
boolean proxyEnabled() default false;
@AttributeDefinition(name = "%proxyHost.name", description =
"%proxyHost.description")
String proxyHost() default "localhost";
@AttributeDefinition(name = "%proxyPort.name", description =
"%proxyPort.description")
int proxyPort() default 8888;
@AttributeDefinition(name = "%startDateFormat.name", description =
"%startDateFormat.description")
String startDateFormat() default "dd.MM.yyyy HH:mm:ss";
@AttributeDefinition(name = "%successStatusCodes.name", description =
"%successStatusCodes.description")
String[] successStatusCodes() default {
WSConstants.DEFAULT_SUCCESS_STATUS_CODE, "1", "5650", "5651" };
}
{code}
The component configuration file obtained via file install or similar
{code:title=configuration.config|borderStyle=solid}
name="xxxx"
proxyEnabled=B"false"
serviceName="xxxx"
wsdlLocation="xxxx"
successStatusCodes=["0","1","5650","5651"]
receiveTimeout=L"180000"
namespaceUri="xxxx"
proxyHost="localhost"
userName="SSO"
connectionTimeout=L"10000"
address="http://xxx.com"
password="xxxx"
startDateFormat="dd.MM.yyyy\ HH:mm:ss"
proxyPort=I"8888"
{code}
This is a webservice proxy component and I have several each with multiple
configuration pids. I suspect this is the problem but I'm not completely sure
> HeltthCheckMetadata ClassCast Exception
> ---------------------------------------
>
> Key: SLING-5827
> URL: https://issues.apache.org/jira/browse/SLING-5827
> Project: Sling
> Issue Type: Bug
> Components: Health Check
> Affects Versions: Health Check Core 1.2.4
> Reporter: Ivo Leitão
> Assignee: Bertrand Delacretaz
> Priority: Critical
> Fix For: Health Check Core 1.2.6
>
>
> I'm getting a classcastexception in the healthcheck component. This is
> happenning only for my components (don't know why :-S).
> I have looked at the source code and in my case at the
> AsyncHelthCheckExecutor the code passes the lines bellow
> {code:title=AsyncHelthCheckExecutor.java|borderStyle=solid}
> ServiceReference serviceReference = event.getServiceReference();
> final boolean isHealthCheck =
> serviceReference.isAssignableTo(bundleContext.getBundle(),
> HealthCheck.class.getName());
> if (isHealthCheck) {
> // True at my case
> }
> {code}
> Later in the method getHealthCheckTitle of the class HealthCheckMetadata at
> the line bellow:
> {code:title=HealthCheckMetadata.java|borderStyle=solid}
> if (StringUtils.isBlank(name)) {
> name = (String) ref.getProperty(Constants.SERVICE_PID);
> }
> {code}
> ref.getProperty(Constants.SERVICE_PID) is returning an ArrayList and I have
> the stacktrace bellow as a result
> {code:title=Stacktrace|borderStyle=solid}
> java.lang.ClassCastException: java.util.ArrayList cannot be cast to
> java.lang.String
> at
> org.apache.sling.hc.util.HealthCheckMetadata.getHealthCheckTitle(HealthCheckMetadata.java:146)
> at
> org.apache.sling.hc.util.HealthCheckMetadata.<init>(HealthCheckMetadata.java:53)
> at
> org.apache.sling.hc.core.impl.executor.AsyncHealthCheckExecutor.serviceChanged(AsyncHealthCheckExecutor.java:114)
> at
> org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:991)
> at
> org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:839)
> at
> org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:546)
> at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4557)
> at org.apache.felix.framework.Felix.registerService(Felix.java:3549)
> at
> org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:348)
> at
> org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:869)
> at
> org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:857)
> at
> org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationManager.java:133)
> at
> org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:915)
> at
> org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:715)
> at
> org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:399)
> at
> org.apache.felix.scr.impl.config.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:676)
> at
> org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:339)
> at
> org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:360)
> at org.apache.felix.scr.impl.Activator.access$000(Activator.java:53)
> at
> org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:260)
> at
> org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:259)
> at
> org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:232)
> at
> org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482)
> at
> org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:415)
> at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)
> at
> org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
> at
> org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:916)
> at
> org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:835)
> at
> org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:517)
> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4541)
> at org.apache.felix.framework.Felix.startBundle(Felix.java:2172)
> at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
> at aQute.launcher.Launcher.update(Launcher.java:482)
> at aQute.launcher.Launcher.activate(Launcher.java:381)
> at aQute.launcher.Launcher.run(Launcher.java:275)
> at aQute.launcher.Launcher.main(Launcher.java:132)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)