Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Load-time weaving of servlets?

Thanks for the input!

I am executing jetty with run-forked in the pre-integration-test phase. How can I configure logging, so I can see the results? I tried redirecting the output to a file:

<New id="ServerLog" class="java.io.PrintStream">
        <Arg>
            <New class="org.eclipse.jetty.util.RolloverFileOutputStream">
                <Arg>target/yyyy_mm_dd.jetty-server.log</Arg>
                <Arg type="boolean">false</Arg>
                <Get id="ServerLogName" name="datedFilename"/>
            </New>
        </Arg>
    </New>
     <Call class="java.lang.System" name="setErr"><Arg><Ref refid="ServerLog"/></Arg></Call>
    <Call class="java.lang.System" name="setOut"><Arg><Ref refid="ServerLog"/></Arg></Call>

And this makes the maven pluging hang:


Name: main
State: RUNNABLE
Total blocked: 20  Total waited: 21

Stack trace:
java.io.FileInputStream.readBytes(Native Method)
java.io.FileInputStream.read(FileInputStream.java:272)
java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
java.io.BufferedInputStream.read(BufferedInputStream.java:334)
   - locked java.lang.UNIXProcess$ProcessPipeInputStream@1e28a31b
sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
   - locked java.io.InputStreamReader@25bf38a2
java.io.InputStreamReader.read(InputStreamReader.java:184)
java.io.BufferedReader.fill(BufferedReader.java:154)
java.io.BufferedReader.readLine(BufferedReader.java:317)
   - locked java.io.InputStreamReader@25bf38a2
java.io.LineNumberReader.readLine(LineNumberReader.java:199)
   - locked java.io.InputStreamReader@25bf38a2
org.eclipse.jetty.maven.plugin.JettyRunForkedMojo.startJettyRunner(JettyRunForkedMojo.java:769)
org.eclipse.jetty.maven.plugin.JettyRunForkedMojo.execute(JettyRunForkedMojo.java:372)
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

On 7.07.2014 21:18, Joakim Erdfelt wrote:
On Wed, Jun 4, 2014 at 12:03 AM, Dimitar Georgiev <dimitar.georgiev.bg@xxxxxxxxx> wrote:
Hello Jetty experts,

I am trying to implement integration testing (testing serlets/services through apache HTTP) and code coverage using Jetty, Maven/Failsafe and JaCoCo.
Here is the minimalistic example I am trying to get running.
My coverage does not work - JaCoCo complains that the classes (specificaly Servlets) compiled by javac/maven-compiler-plugin and ones executed at runtime differ. My example only has a dependency on servlet-api and uses no frameworks.

While there are workarounds to this problem in JaCoCo, which I am going to pursue,
- Does jetty modify classes when loading them; if yes, what is the reason?

Jetty itself does not modify classes.
However, there are a plethora of 3rd party libraries that do bytecode manipulation.
 
- Is there any way to prevent this?

Thanks for your time.

Best Regards, Dimitar

You should also be aware of the temp directories that Jetty uses to manage webapps that are deployed.
It is possible that you are decorating the wrong location/classes for your coverage.

Try a server dump, it will show you what classes jetty is using. (it might not be what you assume)

To set this up with the jetty-maven-plugin

Create a jetty-dump.xml (or whatever name you want)

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
  <Set name="dumpAfterStart">true</Set> 
</Configure>

Then configure the plugin to use it ...

<plugin>
  <groupId>org.eclipse.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <configuration>
    <jettyXml>jetty-dump.xml</jettyXml>
  </configuration>
</plugin>

The STDERR / STDOUT should have a lot of extra information in it now.

--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts




_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top