Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The spring application try to create a bean for SAML2SSOManager .but throws class not found exception #94

Open
jofisiva opened this issue Aug 15, 2018 · 3 comments

Comments

@jofisiva
Copy link

import org.wso2.carbon.identity.sso.agent.exception.SSOAgentException;
import org.wso2.carbon.identity.sso.agent.saml.SAML2SSOManager;
import org.wso2.carbon.identity.sso.agent.util.SSOAgentUtils;

/**
*
*/
@RestController
@RequestMapping("/saml")
public class SSORestController {

private static final XLogger LOGGER = XLoggerFactory.getXLogger(SSORestController.class);

@Autowired
public SAML2SSOManager saml2SSOManager;

@bean(name = "saml2SSOManager")
public SAML2SSOManager saml2SSOManager() {
try {
SSOAgentConfig ssoAgentConfig = this.ssoAgentConfig();
ssoAgentConfig.initConfig(this.samlProperties());

        return new SAML2SSOManager(ssoAgentConfig);
    } catch (Exception ex) {
        LOGGER.debug("SAML2SSOManager error " + ex.getMessage());
    }
    return null;
}

@Bean
public SSOAgentConfig ssoAgentConfig() {
    return new SSOAgentConfig();
}

@Bean
public Properties samlProperties() {
    try {
        return PropertiesLoaderUtils.loadProperties(new ClassPathResource("/config/travelocity.properties"));
    } catch (IOException ex) {
        LOGGER.info("Could not load properties from " + ex.getMessage());
    }
    return null;
}

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.wso2.carbon.identity.sso.agent.saml.SAML2SSOManager]: Factory method 'saml2SSOManager' threw exception; nested exception is java.lang.NoClassDefFoundError: org/wso2/carbon/user/api/UserStoreException
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:579)
... 35 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/wso2/carbon/user/api/UserStoreException
at com.aimia.aip.identity.config.AppServiceConfig.saml2SSOManager(AppServiceConfig.java:269)
at com.aimia.aip.identity.config.AppServiceConfig$$EnhancerBySpringCGLIB$$1eb8fcb9.CGLIB$saml2SSOManager$5()
at com.aimia.aip.identity.config.AppServiceConfig$$EnhancerBySpringCGLIB$$1eb8fcb9$$FastClassBySpringCGLIB$$8a5dee81.invoke()
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361)
at com.aimia.aip.identity.config.AppServiceConfig$$EnhancerBySpringCGLIB$$1eb8fcb9.saml2SSOManager()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 36 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.wso2.carbon.user.api.UserStoreException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 47 common frames omitted

@jofisiva
Copy link
Author

Can you please mention which jar package to include in pom.xml ?

org.wso2.carbon.identity.agent.sso.java
org.wso2.carbon.identity.sso.agent
5.1.18


opensaml.wso2
opensaml2


commons-collections.wso2
commons-collections


@jofisiva
Copy link
Author

@dunithd @Chintana

@jofisiva
Copy link
Author

jofisiva commented Aug 15, 2018

Can you anyone please confirm what is the pom.xml entries for these three classes?

import org.wso2.carbon.user.api.UserRealm;
import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.user.core.UserStoreManager;

public class SAML2SSOManager {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant