Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Custom SessionHandler in Jetty

It needs to be a dependency of the _plugin_ not the project

<plugin>
  <artifactId>jetty-maven-plugin</artifactId>
  <dependencies>
    <dependency>
      ...your stuff

etc...

cheers,
jesse

--
jesse mcconnell
jesse.mcconnell@xxxxxxxxx



On Thu, Jul 7, 2011 at 03:42, Christian Thum <Christian2M@xxxxxx> wrote:
> Thank you for the quick response. Your guessing right, the session handler is located within the project.
>
> I followed your advice and exported the custom sessionhandler to a jar file ("jar -cf myhandler-0.1-jar [Class]"). Then I manually installed the jar to my local repository and added it as a dependency to the project. I verfied that the dependency was found and loaded by turning on the maven debug options. Still, I'm getting the same error. Here's the full stacke trace:
>
>
> Failed to execute goal org.mortbay.jetty:jetty-maven-plugin:7.3.1.v20110307:run-exploded (default-cli) on project : Unable to parse configuration of mojo org.mortbay.jetty:jetty-maven-plugin:7.3.1.v20110307:run-exploded for parameter sessionHandler: ClassNotFoundException: Class name which was explicitly given in configuration using 'implementation' attribute: 'net.synchronite.jetty.SessionHandler' cannot be loaded -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.mortbay.jetty:jetty-maven-plugin:7.3.1.v20110307:run-exploded (default-cli) on project : Unable to parse configuration of mojo org.mortbay.jetty:jetty-maven-plugin:7.3.1.v20110307:run-exploded for parameter sessionHandler: ClassNotFoundException: Class name which was explicitly given in configuration using 'implementation' attribute: 'net.synchronite.jetty.SessionHandler' cannot be loaded
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:221)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>     at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
>     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
>     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>     at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> Caused by: org.apache.maven.plugin.PluginConfigurationException: Unable to parse configuration of mojo org.mortbay.jetty:jetty-maven-plugin:7.3.1.v20110307:run-exploded for parameter sessionHandler: ClassNotFoundException: Class name which was explicitly given in configuration using 'implementation' attribute: 'net.synchronite.jetty.SessionHandler' cannot be loaded
>     at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:597)
>     at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:529)
>     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>     ... 19 more
> Caused by: org.codehaus.plexus.component.configurator.ComponentConfigurationException: ClassNotFoundException: Class name which was explicitly given in configuration using 'implementation' attribute: 'net.synchronite.jetty.SessionHandler' cannot be loaded
>     at org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter.getClassForImplementationHint(AbstractConfigurationConverter.java:70)
>     at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.fromConfiguration(ObjectWithFieldsConverter.java:80)
>     at org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:278)
>     at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:151)
>     at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.fromConfiguration(ObjectWithFieldsConverter.java:89)
>     at org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:331)
>     at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:151)
>     at org.codehaus.plexus.component.configurator.BasicComponentConfigurator.configureComponent(BasicComponentConfigurator.java:56)
>     at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:567)
>     ... 22 more
> Caused by: java.lang.ClassNotFoundException: net.synchronite.jetty.SessionHandler
>     at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
>     at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
>     at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
>     at org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter.getClassForImplementationHint(AbstractConfigurationConverter.java:61)
>     ... 30 more
>
>
>
> The relevant secrtion in the pom looks like this:
>
> <webAppConfig>
>     <contextPath>/</contextPath>
>     <extraClasspath>D:\myhandler-0.1.jar</extraClasspath>
>     <sessionHandler implementation="net.synchronite.jetty.SessionHandler">
>         <sessionManager implementation="net.synchronite.jetty.SessionManager">
>         </sessionManager>
>      </sessionHandler>
>  </webAppConfig>
>
>
> Is there any other way of registering my own session handler in Jetty 7.3.1? Maybe using a context listener?
>
> Thanks for your help!
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: "Jesse McConnell" <jesse.mcconnell@xxxxxxxxx>
> Gesendet: 06.07.2011 22:43:53
> An: "JETTY user mailing list" <jetty-users@xxxxxxxxxxx>
> Betreff: Re: [jetty-users] Custom SessionHandler in Jetty
>
>>Where is the session handler located? I suspect you need to register
>>it as a dependency of the jetty-maven-plugin (since that looks to be
>>your usage scenario here). That would involve using <dependency> tags
>>in the plugin decl.
>>
>>But this is likely a pretty typical classloader issue. I suspect your
>>trying to use a class that is in the project itself that your loading
>>up the jetty-maven-plugin from and its just not exposed to the plugin
>>classloader like that.
>>
>>cheers,
>>jesse
>>
>>--
>>jesse mcconnell
>>jesse.mcconnell@xxxxxxxxx
>>
>>
>>
>>On Wed, Jul 6, 2011 at 15:28, Christian2M <Christian2M@xxxxxx> wrote:
>>> I'm having a problem trying to register a self-implemented SessionHandler
>>> for my Web Application. I have tried adding the session handler two ways
>>> without success:
>>>
>>> 1) Modifying the pom.xml
>>>
>>> <extraClasspath>${basedir}/target/mywebapp/WEB-INF/classes/</extraClasspath>
>>> <sessionHandler implementation="com.example.session.MySessionHandler">
>>>     <sessionManager implementation="com.example.session.MySessionManager">
>>>     </sessionManager>
>>> </sessionHandler>
>>>
>>> 2) Modifying the jetty.xml
>>>
>>> <Set name="extraClasspath">WEB-INF/classes/</Set>
>>> <Set name="setSessionHandler">
>>>     <New class="org.eclipse.jetty.server.session.SessionHandler">
>>>         <Arg>
>>>              <New class="net.synchronite.proxy.SynchroniteSessionManager"
>>> />
>>>          </Arg>
>>>      </New>
>>>  </Set>
>>>
>>> In both cases I get a ClassNotFoundException (see below). What am I missing?
>>>
>>> ...
>>> Caused by: java.lang.ClassNotFoundException:
>>> net.synchronite.proxy.SynchroniteSessionHandler
>>>        at
>>> org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFir
>>> stStrategy.java:50)
>>>        at
>>> org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:2
>>> 44)
>>>        at
>>> org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:2
>>> 30)
>>>        at
>>> org.codehaus.plexus.component.configurator.converters.AbstractConfigurationC
>>> onverter.getClassForImplementationHint(AbstractConfigurationConverter.java:6
>>> 1)
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> jetty-users mailing list
>>> jetty-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>
>>_______________________________________________
>>jetty-users mailing list
>>jetty-users@xxxxxxxxxxx
>>https://dev.eclipse.org/mailman/listinfo/jetty-users
>
>
> ___________________________________________________________
> Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
> Toolbar eingebaut! http://produkte.web.de/go/toolbar
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>


Back to the top