>  Class<? extends ApplicationEvent> eventType = entry.getKey();

I tested on Java7. The variable eventType is of type java.lang.Class. Thus
this line is never true:

                if (eventType.isAssignableFrom(event.getClass()))

I think its rooted in the Spring configuration:

  <bean
class="org.apache.jetspeed.components.ApplicationEventMethodsInvoker">
    <meta key="j2:cat" value="default" />
    <constructor-arg>
      <map>
        <entry>

<key><value>org.springframework.context.event.ContextStartedEvent</value></key>
<================= value becomes a plain class
          <list>
            <bean class="org.springframework.util.MethodInvoker">
              <meta key="j2:cat" value="default" />
              <property name="targetObject" ref="deploymentManager" />
              <property name="targetMethod" value="start" />
            </bean>
          </list>
        </entry>
      </map>
    </constructor-arg>
  </bean>

I rewrote the method, try this, seems to work better on Java7.

    private List<MethodInvoker> findMethodInvokersByEvent(final
ApplicationEvent event)
    {
        if (eventTypeMethodInvokersMap != null && event != null)
        {
            for (Map.Entry<Class<? extends ApplicationEvent>,
List<MethodInvoker>> entry : eventTypeMethodInvokersMap.entrySet())
            {
                String className = entry.getKey().getName();
                try {
                    //Class<? extends ApplicationEvent> eventType =
entry.getKey();
                    Class eventClass = Class.forName(className);
                    if (eventClass.isAssignableFrom(event.getClass())) {
                        return entry.getValue();
                    }
                }
                catch (Exception e) {
                    log.error("Failed to load application event for given
class: " + className);
                }
            }
        }

        return null;
    }


Let me know how it works for you. I'll check this into trunk. Thanks


On Tue, Jun 3, 2014 at 5:40 AM, Frank Otto <o...@delta-barth.de> wrote:

> I have found the incorrect code:
>
>
> java.lang.ClassCastException: java.lang.String cannot be cast to
> java.lang.Class
>     at org.apache.jetspeed.components.ApplicationEventMethodsInvoker
> .findMethodInvokersByEvent(ApplicationEventMethodsInvoker.java:132)
>
> private List<MethodInvoker> findMethodInvokersByEvent(final
> ApplicationEvent event)
>     {
>         if (eventTypeMethodInvokersMap != null && event != null)
>         {
>             for (Map.Entry<Class<? extends ApplicationEvent>,
> List<MethodInvoker>> entry : eventTypeMethodInvokersMap.entrySet())
>             {
> *Class<? extends ApplicationEvent> eventType = entry.getKey();*
>
>                 if (eventType.isAssignableFrom(event.getClass()))
>                 {
>                     return entry.getValue();
>                 }
>             }
>         }
>
>         return null;
>     }
>
> I have no idea, whats wrong... Please help!
>
> Frank
>
> Am 03.06.2014 14:16, schrieb Frank Otto:
>
>  Hi,
>>
>> I want to start jetspeed 2 on java 8. On starting I get following
>> exception:
>>
>> ERROR 2014-06-03 13:46:31,865 - Request error encountered while
>> processing portal request: Failed to initalize jetspeed.
>> org.apache.jetspeed.exception.JetspeedException: Jetspeed Initialization
>> exception!
>> javax.servlet.ServletException: Failed to initalize jetspeed.
>> org.apache.jetspeed.exception.JetspeedException: Jetspeed Initialization
>> exception!
>>     at org.apache.jetspeed.engine.JetspeedServlet.invoke(
>> JetspeedServlet.java:295)
>>     at org.apache.jetspeed.engine.JetspeedServlet.service(
>> JetspeedServlet.java:330)
>>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>> ApplicationFilterChain.java:290)
>>     at org.apache.catalina.core.ApplicationFilterChain.doFilter(
>> ApplicationFilterChain.java:206)
>>     at org.apache.jetspeed.container.session.
>> PortalSessionValidationFilter.doFilter(PortalSessionValidationFilter.
>> java:92)
>>     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>> ApplicationFilterChain.java:235)
>>     at org.apache.catalina.core.ApplicationFilterChain.doFilter(
>> ApplicationFilterChain.java:206)
>>     at org.apache.jetspeed.engine.servlet.XXSUrlAttackFilter.
>> doFilter(XXSUrlAttackFilter.java:52)
>>     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>> ApplicationFilterChain.java:235)
>>     at org.apache.catalina.core.ApplicationFilterChain.doFilter(
>> ApplicationFilterChain.java:206)
>>     at org.apache.jetspeed.util.ServletRequestCleanupService.doFilter(
>> ServletRequestCleanupService.java:90)
>>     at org.apache.jetspeed.util.ServletRequestCleanupFilter.doFilter(
>> ServletRequestCleanupFilter.java:52)
>>     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>> ApplicationFilterChain.java:235)
>>     at org.apache.catalina.core.ApplicationFilterChain.doFilter(
>> ApplicationFilterChain.java:206)
>>     at org.apache.catalina.core.StandardWrapperValve.invoke(
>> StandardWrapperValve.java:233)
>>     at org.apache.catalina.core.StandardContextValve.invoke(
>> StandardContextValve.java:191)
>>     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
>> AuthenticatorBase.java:470)
>>     at org.apache.catalina.core.StandardHostValve.invoke(
>> StandardHostValve.java:127)
>>     at org.apache.catalina.valves.ErrorReportValve.invoke(
>> ErrorReportValve.java:102)
>>     at org.apache.catalina.core.StandardEngineValve.invoke(
>> StandardEngineValve.java:109)
>>     at org.apache.catalina.connector.CoyoteAdapter.service(
>> CoyoteAdapter.java:298)
>>     at org.apache.coyote.http11.Http11Processor.process(
>> Http11Processor.java:857)
>>     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.
>> process(Http11Protocol.java:588)
>>     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(
>> JIoEndpoint.java:489)
>>     at java.lang.Thread.run(Unknown Source)
>> Caused by: org.apache.jetspeed.exception.JetspeedException: Jetspeed
>> Initialization exception!
>>     at org.apache.jetspeed.engine.JetspeedEngine.start(
>> JetspeedEngine.java:142)
>>     at org.apache.jetspeed.engine.JetspeedServlet.init(
>> JetspeedServlet.java:202)
>>     at org.apache.catalina.core.StandardWrapper.loadServlet(
>> StandardWrapper.java:1173)
>>     at org.apache.catalina.core.StandardWrapper.load(
>> StandardWrapper.java:993)
>>     at org.apache.catalina.core.StandardContext.loadOnStartup(
>> StandardContext.java:4350)
>>     at org.apache.catalina.core.StandardContext.start(
>> StandardContext.java:4659)
>>     at org.apache.catalina.core.ContainerBase.addChildInternal(
>> ContainerBase.java:791)
>>     at org.apache.catalina.core.ContainerBase.addChild(
>> ContainerBase.java:771)
>>     at org.apache.catalina.core.StandardHost.addChild(
>> StandardHost.java:546)
>>     at org.apache.catalina.startup.HostConfig.deployDescriptor(
>> HostConfig.java:637)
>>     at org.apache.catalina.startup.HostConfig.deployDescriptors(
>> HostConfig.java:563)
>>     at org.apache.catalina.startup.HostConfig.deployApps(
>> HostConfig.java:498)
>>     at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
>>     at org.apache.catalina.startup.HostConfig.lifecycleEvent(
>> HostConfig.java:321)
>>     at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
>> LifecycleSupport.java:119)
>>     at org.apache.catalina.core.ContainerBase.start(
>> ContainerBase.java:1053)
>>     at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
>>     at org.apache.catalina.core.ContainerBase.start(
>> ContainerBase.java:1045)
>>     at org.apache.catalina.core.StandardEngine.start(
>> StandardEngine.java:445)
>>     at org.apache.catalina.core.StandardService.start(
>> StandardService.java:519)
>>     at org.apache.catalina.core.StandardServer.start(
>> StandardServer.java:710)
>>     at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>     at java.lang.reflect.Method.invoke(Unknown Source)
>>     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
>>     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
>> Caused by: java.lang.ClassCastException: java.lang.String cannot be cast
>> to java.lang.Class
>>     at org.apache.jetspeed.components.ApplicationEventMethodsInvoker
>> .findMethodInvokersByEvent(ApplicationEventMethodsInvoker.java:132)
>>     at org.apache.jetspeed.components.ApplicationEventMethodsInvoker
>> .onApplicationEvent(ApplicationEventMethodsInvoker.java:96)
>>     at org.springframework.context.event.SimpleApplicationEventMulticas
>> ter$1.run(SimpleApplicationEventMulticaster.java:78)
>>     at org.springframework.core.task.SyncTaskExecutor.execute(
>> SyncTaskExecutor.java:49)
>>     at org.springframework.context.event.SimpleApplicationEventMulticas
>> ter.multicastEvent(SimpleApplicationEventMulticaster.java:76)
>>     at org.springframework.context.support.AbstractApplicationContext.
>> publishEvent(AbstractApplicationContext.java:274)
>>     at org.springframework.context.support.AbstractApplicationContext.
>> finishRefresh(AbstractApplicationContext.java:736)
>>     at org.springframework.context.support.AbstractApplicationContext.
>> refresh(AbstractApplicationContext.java:383)
>>     at org.apache.jetspeed.components.SpringComponentManager.start(
>> SpringComponentManager.java:313)
>>     at org.apache.jetspeed.engine.JetspeedEngine.start(
>> JetspeedEngine.java:119)
>>     ... 27 more
>>
>> With Java 7 it works. Has someone an idea?
>>
>>
>> kind regards,
>>
>> Frank
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jetspeed-user-unsubscr...@portals.apache.org
>> For additional commands, e-mail: jetspeed-user-h...@portals.apache.org
>>
>>
> --
> Mit freundlichen Grüßen
>
> Dipl.-Wirtschaftsinf. (BA) Frank Otto
> Entwicklung DELECO, Projektleiter
>
> DELTA BARTH Systemhaus GmbH
> Fon: +49 (0) 3722/ 7170-0
> Fax: +49 (0) 3722/ 7170-11
> Mail: o...@delta-barth.de
> Web: http://www.debas.de/
>
> DELECO -- Software für den Mittelstand
> Ausgezeichnet mit dem Gütesiegel "Software Made in Germany"
> ________________________________________________________
> Pflichtangaben gemäß § 125a HGB:
>
> DELTA BARTH Systemhaus GmbH
> Ludwig-Richter-Str. 3
> 09212 Limbach-Oberfrohna
>
> Registergericht: Amtsgericht Chemnitz
> Handelsregisternummer: HRB 4886
> Geschäftsführer: Dipl.-Ing.(FH) Andreas Barth, Dipl.-Wi.Jur.(FH) Annett
> Barth
>
>

Reply via email to