Jahia Dev Forum > Jahia 7, NullPointerException...

0 (0 Good)
0 (0 Bad)

Jahia 7, NullPointerException loading AuthValve in Jahia

by  dott_matte »  2015/03/16 17:02

Hi, I have this class that extends AutoRegisteredBaseAuthValve.

When I try to load it in Jahia 7 CE I got the NullPointerException exception below.

What can I do?

I read this https://www.jahia.com/documentation-and-downloads/developers-techwiki/security/authentification-valves but I can't see any diccerences between my code and the wiki's.

Thanks

----------------------------------------------

package org.jahia.params.valves;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLEncoder;

import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.jahia.api.Constants;

import org.jahia.pipelines.PipelineException;
import org.jahia.pipelines.valves.ValveContext;
import org.jahia.services.notification.HttpClientService;
import org.jahia.services.usermanager.JahiaUser;

/**
 * @author Charles Flond Date: 31/01/11 Time: 11:50
 */
public class FacebookAuthValveImpl extends AutoRegisteredBaseAuthValve {

    private String appId;

    private String appSecret;

    private HttpClientService httpClientService;

    private String getAccessToken(String fbCode, HttpServletRequest request)
            throws IOException {
        // Build the URL to request the access token
        StringBuilder tokenUrl = new StringBuilder();
        tokenUrl.append("https://graph.facebook.com/oauth/access_token?redirect_uri=")
                .append(URLEncoder.encode(request.getRequestURL().toString(), "UTF-8"))
                .append("&client_id=").append(appId).append("&client_secret=").append(appSecret)
                .append("&code=").append(fbCode);

        // Connection and reading of the access token page
        String result = httpClientService.executeGet(tokenUrl.toString());
        if (result == null) {
            return null;
        }

        // Parsing of the access token page to extract the token and the expiration
        String fbToken = null;
        String[] pairs = result.split("&");
        for (String pair : pairs) {
            String[] kv = pair.split("=");
            if (kv.length != 2) {
                throw new RuntimeException("Unexpected auth response");
            } else {
                if (kv[0].equals("access_token")) {
                    fbToken = kv[1];
                    break;
                }
            }
        }
        return fbToken;
    }

    public String getAppId() {
        return appId;
    }

    // Invoke method
    @Override
    public void invoke(Object context, ValveContext valveContext) throws PipelineException {
        // Retrieve the context, the current request and the get parameter (code)
        AuthValveContext authContext = (AuthValveContext) context;
        HttpServletRequest request = authContext.getRequest();
        String fbCode = request.getParameter("code");

        // If we have the code from Facebook, we can start to work
        if (fbCode != null) {
            try {
                JahiaUser jfu = null;

                String fbToken = getAccessToken(fbCode, request);
                if (fbToken != null) {
//                    JahiaUserManagerFacebookProvider provider = (JahiaUserManagerFacebookProvider) ServicesRegistry
//                            .getInstance().getJahiaUserManagerService().getProvider("facebook");
//                    jfu = provider.lookupUserByAccessToken(fbToken);
                }

                if (jfu != null) {
                    authContext.getSessionFactory().setCurrentUser(jfu);
                    request.getSession().setAttribute(Constants.SESSION_USER, jfu);
                } else {
                    throw new RuntimeException("Cannot retrieve user from access token");
                }
                return;
            } catch (Exception e) {
                Logger.getLogger(getClass()).warn("Error authenticating the user via Facebook", e);
            }
        }
        valveContext.invokeNext(context);
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }

    public void setHttpClientService(HttpClientService httpClientService) {
        this.httpClientService = httpClientService;
    }
    
    private String readURL(URL url) throws IOException {

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        InputStream is = url.openStream();
        int r;

        while ((r = is.read()) != -1) {
            baos.write(r);
        }

        return new String(baos.toByteArray());
    }
}

----------------------------------------------

This is the spring bean config

    <bean id="FacebookAuthValve" class="org.jahia.params.valves.FacebookAuthValveImpl">
        <property name="appId" value="xxxxxxxxxxxxxxxxxxx"/>
        <property name="appSecret">
            <bean class="org.jahia.utils.EncryptionUtils$EncryptedPasswordFactoryBean">
                <property name="password" value="xxxxxxxxxxxxxxxxxxxxxxxxx" />
            </bean>
        </property>
        <property name="httpClientService" ref="HttpClientService"/>
    </bean>

 

Stack trace:
-------------
Cause level : 0 (level 0 is the most precise exception)
java.lang.NullPointerException
    at org.jahia.params.valves.AutoRegisteredBaseAuthValve.afterPropertiesSet(AutoRegisteredBaseAuthValve.java:116)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$301(AbstractDelegatedExecutionApplicationContext.java:60)
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$1.run(AbstractDelegatedExecutionApplicationContext.java:168)
    at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.normalRefresh(AbstractDelegatedExecutionApplicationContext.java:164)
    at org.jahia.bundles.blueprint.extender.config.JahiaOsgiBundleXmlApplicationContext$JahiaOsgiApplicationContextExecutor.refresh(JahiaOsgiBundleXmlApplicationContext.java:107)
    at org.jahia.bundles.blueprint.extender.config.JahiaOsgiBundleXmlApplicationContext.refresh(JahiaOsgiBundleXmlApplicationContext.java:96)
    at org.jahia.bundles.extender.jahiamodules.Activator.start(Activator.java:640)
    at org.jahia.bundles.extender.jahiamodules.Activator.access$100(Activator.java:113)
    at org.jahia.bundles.extender.jahiamodules.Activator$4.bundleChanged(Activator.java:294)
    at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:868)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:789)
    at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:514)
    at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4403)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2092)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.restartBundlesAfterUpdate(DirectoryWatcher.java:1193)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:513)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:294)
Cause level : 1
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FacebookAuthValve' defined in URL [bundle://134.7:0/META-INF/spring/xxxxxxx.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$301(AbstractDelegatedExecutionApplicationContext.java:60)
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$1.run(AbstractDelegatedExecutionApplicationContext.java:168)
    at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
    at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.normalRefresh(AbstractDelegatedExecutionApplicationContext.java:164)
    at org.jahia.bundles.blueprint.extender.config.JahiaOsgiBundleXmlApplicationContext$JahiaOsgiApplicationContextExecutor.refresh(JahiaOsgiBundleXmlApplicationContext.java:107)
    at org.jahia.bundles.blueprint.extender.config.JahiaOsgiBundleXmlApplicationContext.refresh(JahiaOsgiBundleXmlApplicationContext.java:96)
    at org.jahia.bundles.extender.jahiamodules.Activator.start(Activator.java:640)
    at org.jahia.bundles.extender.jahiamodules.Activator.access$100(Activator.java:113)
    at org.jahia.bundles.extender.jahiamodules.Activator$4.bundleChanged(Activator.java:294)
    at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:868)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:789)
    at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:514)
    at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4403)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2092)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.restartBundlesAfterUpdate(DirectoryWatcher.java:1193)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:513)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:294)
Caused by: java.lang.NullPointerException
    at org.jahia.params.valves.AutoRegisteredBaseAuthValve.afterPropertiesSet(AutoRegisteredBaseAuthValve.java:116)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)
    ... 27 more

  • Jahia 7, NullPointerException loading AuthValve in Jahia
    2015/03/16 17:02

    dott_matte <p>Hi, I have this class that extends&nbsp;<span style="line-height: 20.7999992370605px;">AutoRegisteredBaseAuthValve.</span></p> <p>When I try to load it in Jahia 7 CE I got the NullPointerException exception below.</p> <p>What can I do?</p> <p>I read this&nbsp;https://www.jahia.com/documentation-and-downloads/developers-techwiki/security/authentification-valves but I can&#39;t see any diccerences between my code and the wiki&#39;s.</p> <p>Thanks</p> <p><span style="line-height: 20.7999992370605px;">----------------------------------------------</span></p> <p>package org.jahia.params.valves;</p> <p>import java.io.ByteArrayOutputStream;<br /> import java.io.IOException;<br /> import java.io.InputStream;<br /> import java.net.URL;<br /> import java.net.URLEncoder;</p> <p>import javax.servlet.http.HttpServletRequest;<br /> import org.apache.log4j.Logger;<br /> import org.jahia.api.Constants;</p> <p>import org.jahia.pipelines.PipelineException;<br /> import org.jahia.pipelines.valves.ValveContext;<br /> import org.jahia.services.notification.HttpClientService;<br /> import org.jahia.services.usermanager.JahiaUser;</p> <p>/**<br /> &nbsp;* @author Charles Flond Date: 31/01/11 Time: 11:50<br /> &nbsp;*/<br /> public class FacebookAuthValveImpl extends AutoRegisteredBaseAuthValve {</p> <p>&nbsp; &nbsp; private String appId;</p> <p>&nbsp; &nbsp; private String appSecret;</p> <p>&nbsp; &nbsp; private HttpClientService httpClientService;</p> <p>&nbsp; &nbsp; private String getAccessToken(String fbCode, HttpServletRequest request)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throws IOException {<br /> &nbsp; &nbsp; &nbsp; &nbsp; // Build the URL to request the access token<br /> &nbsp; &nbsp; &nbsp; &nbsp; StringBuilder tokenUrl = new StringBuilder();<br /> &nbsp; &nbsp; &nbsp; &nbsp; tokenUrl.append(&quot;https://graph.facebook.com/oauth/access_token?redirect_uri=&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .append(URLEncoder.encode(request.getRequestURL().toString(), &quot;UTF-8&quot;))<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .append(&quot;&amp;client_id=&quot;).append(appId).append(&quot;&amp;client_secret=&quot;).append(appSecret)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .append(&quot;&amp;code=&quot;).append(fbCode);</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; // Connection and reading of the access token page<br /> &nbsp; &nbsp; &nbsp; &nbsp; String result = httpClientService.executeGet(tokenUrl.toString());<br /> &nbsp; &nbsp; &nbsp; &nbsp; if (result == null) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return null;<br /> &nbsp; &nbsp; &nbsp; &nbsp; }</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; // Parsing of the access token page to extract the token and the expiration<br /> &nbsp; &nbsp; &nbsp; &nbsp; String fbToken = null;<br /> &nbsp; &nbsp; &nbsp; &nbsp; String[] pairs = result.split(&quot;&amp;&quot;);<br /> &nbsp; &nbsp; &nbsp; &nbsp; for (String pair : pairs) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String[] kv = pair.split(&quot;=&quot;);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (kv.length != 2) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new RuntimeException(&quot;Unexpected auth response&quot;);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (kv[0].equals(&quot;access_token&quot;)) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fbToken = kv[1];<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br /> &nbsp; &nbsp; &nbsp; &nbsp; }<br /> &nbsp; &nbsp; &nbsp; &nbsp; return fbToken;<br /> &nbsp; &nbsp; }</p> <p>&nbsp; &nbsp; public String getAppId() {<br /> &nbsp; &nbsp; &nbsp; &nbsp; return appId;<br /> &nbsp; &nbsp; }</p> <p>&nbsp; &nbsp; // Invoke method<br /> &nbsp; &nbsp; @Override<br /> &nbsp; &nbsp; public void invoke(Object context, ValveContext valveContext) throws PipelineException {<br /> &nbsp; &nbsp; &nbsp; &nbsp; // Retrieve the context, the current request and the get parameter (code)<br /> &nbsp; &nbsp; &nbsp; &nbsp; AuthValveContext authContext = (AuthValveContext) context;<br /> &nbsp; &nbsp; &nbsp; &nbsp; HttpServletRequest request = authContext.getRequest();<br /> &nbsp; &nbsp; &nbsp; &nbsp; String fbCode = request.getParameter(&quot;code&quot;);</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; // If we have the code from Facebook, we can start to work<br /> &nbsp; &nbsp; &nbsp; &nbsp; if (fbCode != null) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JahiaUser jfu = null;</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String fbToken = getAccessToken(fbCode, request);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (fbToken != null) {<br /> // &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;JahiaUserManagerFacebookProvider provider = (JahiaUserManagerFacebookProvider) ServicesRegistry<br /> // &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.getInstance().getJahiaUserManagerService().getProvider(&quot;facebook&quot;);<br /> // &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;jfu = provider.lookupUserByAccessToken(fbToken);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (jfu != null) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; authContext.getSessionFactory().setCurrentUser(jfu);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; request.getSession().setAttribute(Constants.SESSION_USER, jfu);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new RuntimeException(&quot;Cannot retrieve user from access token&quot;);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception e) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Logger.getLogger(getClass()).warn(&quot;Error authenticating the user via Facebook&quot;, e);<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br /> &nbsp; &nbsp; &nbsp; &nbsp; }<br /> &nbsp; &nbsp; &nbsp; &nbsp; valveContext.invokeNext(context);<br /> &nbsp; &nbsp; }</p> <p>&nbsp; &nbsp; public void setAppId(String appId) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; this.appId = appId;<br /> &nbsp; &nbsp; }</p> <p>&nbsp; &nbsp; public void setAppSecret(String appSecret) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; this.appSecret = appSecret;<br /> &nbsp; &nbsp; }</p> <p>&nbsp; &nbsp; public void setHttpClientService(HttpClientService httpClientService) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; this.httpClientService = httpClientService;<br /> &nbsp; &nbsp; }<br /> &nbsp; &nbsp;&nbsp;<br /> &nbsp; &nbsp; private String readURL(URL url) throws IOException {</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; ByteArrayOutputStream baos = new ByteArrayOutputStream();<br /> &nbsp; &nbsp; &nbsp; &nbsp; InputStream is = url.openStream();<br /> &nbsp; &nbsp; &nbsp; &nbsp; int r;</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; while ((r = is.read()) != -1) {<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; baos.write(r);<br /> &nbsp; &nbsp; &nbsp; &nbsp; }</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; return new String(baos.toByteArray());<br /> &nbsp; &nbsp; }<br /> }</p> <p>----------------------------------------------</p> <p>This is the spring bean config</p> <p>&nbsp; &nbsp; &lt;bean id=&quot;FacebookAuthValve&quot; class=&quot;org.jahia.params.valves.FacebookAuthValveImpl&quot;&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;appId&quot; value=&quot;xxxxxxxxxxxxxxxxxxx&quot;/&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;appSecret&quot;&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;bean class=&quot;org.jahia.utils.EncryptionUtils$EncryptedPasswordFactoryBean&quot;&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;password&quot; value=&quot;xxxxxxxxxxxxxxxxxxxxxxxxx&quot; /&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/bean&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &lt;/property&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;httpClientService&quot; ref=&quot;HttpClientService&quot;/&gt;<br /> &nbsp; &nbsp; &lt;/bean&gt;</p> <p>&nbsp;</p> <p>Stack trace:<br /> -------------<br /> Cause level : 0 (level 0 is the most precise exception)<br /> java.lang.NullPointerException<br /> &nbsp;&nbsp; &nbsp;at org.jahia.params.valves.AutoRegisteredBaseAuthValve.afterPropertiesSet(AutoRegisteredBaseAuthValve.java:116)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)<br /> &nbsp;&nbsp; &nbsp;at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$301(AbstractDelegatedExecutionApplicationContext.java:60)<br /> &nbsp;&nbsp; &nbsp;at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$1.run(AbstractDelegatedExecutionApplicationContext.java:168)<br /> &nbsp;&nbsp; &nbsp;at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)<br /> &nbsp;&nbsp; &nbsp;at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.normalRefresh(AbstractDelegatedExecutionApplicationContext.java:164)<br /> &nbsp;&nbsp; &nbsp;at org.jahia.bundles.blueprint.extender.config.JahiaOsgiBundleXmlApplicationContext$JahiaOsgiApplicationContextExecutor.refresh(JahiaOsgiBundleXmlApplicationContext.java:107)<br /> &nbsp;&nbsp; &nbsp;at org.jahia.bundles.blueprint.extender.config.JahiaOsgiBundleXmlApplicationContext.refresh(JahiaOsgiBundleXmlApplicationContext.java:96)<br /> &nbsp;&nbsp; &nbsp;at org.jahia.bundles.extender.jahiamodules.Activator.start(Activator.java:640)<br /> &nbsp;&nbsp; &nbsp;at org.jahia.bundles.extender.jahiamodules.Activator.access$100(Activator.java:113)<br /> &nbsp;&nbsp; &nbsp;at org.jahia.bundles.extender.jahiamodules.Activator$4.bundleChanged(Activator.java:294)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:868)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:789)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:514)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4403)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.framework.Felix.startBundle(Felix.java:2092)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.fileinstall.internal.DirectoryWatcher.restartBundlesAfterUpdate(DirectoryWatcher.java:1193)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:513)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:294)<br /> Cause level : 1<br /> org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;FacebookAuthValve&#39; defined in URL [bundle://134.7:0/META-INF/spring/xxxxxxx.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)<br /> &nbsp;&nbsp; &nbsp;at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$301(AbstractDelegatedExecutionApplicationContext.java:60)<br /> &nbsp;&nbsp; &nbsp;at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$1.run(AbstractDelegatedExecutionApplicationContext.java:168)<br /> &nbsp;&nbsp; &nbsp;at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)<br /> &nbsp;&nbsp; &nbsp;at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.normalRefresh(AbstractDelegatedExecutionApplicationContext.java:164)<br /> &nbsp;&nbsp; &nbsp;at org.jahia.bundles.blueprint.extender.config.JahiaOsgiBundleXmlApplicationContext$JahiaOsgiApplicationContextExecutor.refresh(JahiaOsgiBundleXmlApplicationContext.java:107)<br /> &nbsp;&nbsp; &nbsp;at org.jahia.bundles.blueprint.extender.config.JahiaOsgiBundleXmlApplicationContext.refresh(JahiaOsgiBundleXmlApplicationContext.java:96)<br /> &nbsp;&nbsp; &nbsp;at org.jahia.bundles.extender.jahiamodules.Activator.start(Activator.java:640)<br /> &nbsp;&nbsp; &nbsp;at org.jahia.bundles.extender.jahiamodules.Activator.access$100(Activator.java:113)<br /> &nbsp;&nbsp; &nbsp;at org.jahia.bundles.extender.jahiamodules.Activator$4.bundleChanged(Activator.java:294)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:868)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:789)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:514)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4403)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.framework.Felix.startBundle(Felix.java:2092)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.fileinstall.internal.DirectoryWatcher.restartBundlesAfterUpdate(DirectoryWatcher.java:1193)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:513)<br /> &nbsp;&nbsp; &nbsp;at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:294)<br /> Caused by: java.lang.NullPointerException<br /> &nbsp;&nbsp; &nbsp;at org.jahia.params.valves.AutoRegisteredBaseAuthValve.afterPropertiesSet(AutoRegisteredBaseAuthValve.java:116)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)<br /> &nbsp;&nbsp; &nbsp;at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)<br /> &nbsp;&nbsp; &nbsp;... 27 more</p>

  • Number of messages  12
    Registration date Mar 16, 2015
    0 (0 Good)
    0 (0 Bad)

    Re: Jahia 7, NullPointerException loading AuthValve in Jahia

    by  Has solution been found? »  2015/06/23 12:17

    Hi,

    I am having the same problem after upgrading to Jahia 7. Did you find a solution?

    Thanks in advance

    Has solution been found?
    Number of messages  1
    Not registered
    0 (0 Good)
    0 (0 Bad)

    Re: Re: Jahia 7, NullPointerException loading AuthValve in Jahia

    by  mxlab »  2015/07/01 09:55

    Try to insert this spring configuration

        <bean id="FacebookAuthValve" class="org.jahia.params.valves.facebook.FacebookAuthValveImpl">
            <property name="id" value="FacebookAuthValve"/>
            <property name="appId" value="xxxxxxxxxxxxxxxxxxxxx"/>
            <property name="appSecret">
                <bean class="org.jahia.utils.EncryptionUtils$EncryptedPasswordFactoryBean">
                    <property name="password" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
                </bean>
            </property>
            <property name="httpClientService" ref="HttpClientService"/>
            <property name="authPipeline" ref="authPipeline"/>
        </bean>

  • Re: Re: Jahia 7, NullPointerException loading AuthValve in Jahia
    2015/07/01 09:55

    mxlab <p>Try to insert this spring configuration</p> <p>&nbsp; &nbsp; &lt;bean id=&quot;FacebookAuthValve&quot; class=&quot;org.jahia.params.valves.facebook.FacebookAuthValveImpl&quot;&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;id&quot; value=&quot;FacebookAuthValve&quot;/&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;appId&quot; value=&quot;xxxxxxxxxxxxxxxxxxxxx&quot;/&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;appSecret&quot;&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;bean class=&quot;org.jahia.utils.EncryptionUtils$EncryptedPasswordFactoryBean&quot;&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;password&quot; value=&quot;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&quot; /&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/bean&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &lt;/property&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;httpClientService&quot; ref=&quot;HttpClientService&quot;/&gt;<br /> &nbsp; &nbsp; &nbsp; &nbsp; <strong><span style="background-color:#00FF00;">&lt;property name=&quot;authPipeline&quot; ref=&quot;authPipeline&quot;/&gt;</span></strong><br /> &nbsp; &nbsp; &lt;/bean&gt;</p>

  • Number of messages  33
    Registration date Jul 1, 2015
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page