Giter Site home page Giter Site logo

Comments (41)

SteveSchafer-Innovent avatar SteveSchafer-Innovent commented on August 21, 2024 1

I've been looking at this and have narrowed it down a little bit. The 404 error is caused by org.eclipse.jetty.servlet.ServletHandler.Default404Servlet. When the request comes in, Jetty looks in a list of servlets and the Default404Servlet is the only thing in that list. Servlets can only be added to that list in ServletHandler.setServletMappings() and that method is never called by the ViewerPlugin or anywhere other than to add the 404 servlet. I don't really know where it should be called, so I'm going to see what an older version of BIRT looks like, where the viewer used to work. Maybe Jetty was different or maybe the ViewerPlugin was different. We'll see.

from birt.

hvbtup avatar hvbtup commented on August 21, 2024

Hmm, it seems like Jasper is using the Jasper JSP compiler (which sounds somewhat silly btw, because we are running BIRT, not JasperReports).
Do we need JSP at all for BIRT?
It seems like this can be disabled or configured, see https://www.eclipse.org/jetty/documentation/jetty-9/index.html#configuring-jsp
But I'm a complete noob in this regard.
Maybe we need some help from the experts of the Jetty project...

from birt.

wimjongman avatar wimjongman commented on August 21, 2024

I see in the build that we indeed have a step where jsp's are being compiled. I think that the webviewer is using jsp.

I don't know why but I have a feeling that this issue might be related.

from birt.

hvbtup avatar hvbtup commented on August 21, 2024

from birt.

SteveSchafer-Innovent avatar SteveSchafer-Innovent commented on August 21, 2024

There are 34 jsp files in the generated webapp. It would not be possible to replace them with html files. They are in viewer/org.eclipse.birt.report.viewer/birt/webcontent/birt.

from birt.

hvbargen avatar hvbargen commented on August 21, 2024

I see.

At this time this (the viewer not working) is the most annoying bug in BIRT - I'd call it a showstopper.

I really think you should ask for help in the jetty-dev mailing list.

from birt.

wimjongman avatar wimjongman commented on August 21, 2024

Please feel free to step in.

from birt.

hvbtup avatar hvbtup commented on August 21, 2024

I would if I had any idea of the build process. But I never worked with Maven, Tycho, Eclipse, P2, M2 and so on - I really don't understand it. So I'm afraid I cannot help.

from birt.

wimjongman avatar wimjongman commented on August 21, 2024

This was exactly my situation before I decided to dig in ;)

from birt.

hvbargen avatar hvbargen commented on August 21, 2024

I looked at the comments on bug 453379 and this is intimidating - seems like Jetty is causing trouble for years.

However, in that bug, it was said that one reason for doing the things that way, was some conflict with the "help system".

I don't care about the help system as long as the BIRT IDE is unusable (I don't see why a help system needs JSP at all).
So, is it an option to add org.apache.jasper (not org.apache.jasper.glassfish) as a dependency somehow?

from birt.

hvbtup avatar hvbtup commented on August 21, 2024

Maybe Jetty was different or maybe the ViewerPlugin was different.

AFAIK Jetty was different and included support for JSP, which now requires additional libraries. IOW the newer releases of Jetty no longer have "batteries included" (in Python speech).

from birt.

hvbtup avatar hvbtup commented on August 21, 2024

Meanwhile I was trying to make Jetty log messages again (I'm pretty sure that would help us debugging this issue), but without success so far.
Jetty now uses SLF4J for logging. SLF4J ist more or less just an API for logging. It needs a binding to another library which actually performs the logging, such as java.util.logging, logback oder log4j. Without such a binding, it will log only exactly one message to tell you that it won't log any messages (using a no-op binding).
There are some of these bindings in Orbit, but I don't know how to make this work.
Perhaps someone with a bit more OSGI know-how could take a look at this.

from birt.

hvbtup avatar hvbtup commented on August 21, 2024

I showed the SLF4J problem to a colleague who knows a bit more about Eclipse than I do, but we couldn't solve it.
If I understand the SLFJ documentation correctly, it should work, because slf4j-simple is available (and shows as active in the OSGI console).

from birt.

hvbtup avatar hvbtup commented on August 21, 2024

I guess that the SLF4J problem hides the root problem. In the stacktrace (see log.txt from the OP), which was produced by Jetty 9, the error message was:

java.lang.ClassNotFoundException: org.apache.jasper.runtime.JspSourceImports cannot be found by org.eclipse.jetty.osgi.boot_9.4.37.v20210219

I guess that the situation is still the same with Jetty 10, but now it is hidden by the SLF4J problem, because Jetty just cannot log the error.

from birt.

hvbtup avatar hvbtup commented on August 21, 2024

We still didn't get the SLF4J logger to work, but I found the following exception which is ignored (!?) in javax.servlet.jsp.JspFactory.class:

org.apache.jasper.runtime.JspFactoryImpl cannot be found by javax.servlet.jsp_2.2.0.v201112011158

So I think this is a project setup problem, we need to have the JSP implementation library available somehow - similar to the problem with Jetty 9.

from birt.

wimjongman avatar wimjongman commented on August 21, 2024

For the logger to work, I have a theoretical idea.

SLF4j requires an implementation at runtime. This means that jetty needs a dependency on a logging implementation otherwise OSGi will not allow jetty to see anything, no matter how many implementation bundles are active.

You can try to create a fragment that has the jetty bundle as a master and which depends on an slf4j implementation. Master plugins are able to see all dependencies from their fragments.

from birt.

wimjongman avatar wimjongman commented on August 21, 2024

org.apache.jasper.runtime.JspFactoryImpl cannot be found by javax.servlet.jsp_2.2.0.v201112011158

This issue is caused by the ViewerPlugin class. If you examine it you will see the setupJSPFactory method. This fails silently. I have been able to fix this by adding that package to the dependencies.

from birt.

hvbtup avatar hvbtup commented on August 21, 2024

Yes, that's where I found the bug.
So does the Run > View as PDF now work for you? And what exactly did you do?

from birt.

wimjongman avatar wimjongman commented on August 21, 2024

No, it doesn't make any difference. I will push my intermediate changes to a branch.

from birt.

hvbtup avatar hvbtup commented on August 21, 2024

I added org.apache.jasper.glassfish (2.2.2) to the target platform and the plugin dependencies of org.eclipse.birt.report.viewer.
Stepping through in the debugger, I can see that the first attempt to load JspFactoryImpl fails (in JspFactory.getDefaultFactory()), but then the second attempt in ViewerPlugin setupJspFactory succeeds.

Unfortunately this still does not help. Probably something else is missing.

I found http://www.descher.at/descher-vu/category/eclipse/jetty/ where someone explains how he managed to get JSP up and running with Jetty 9. This may be a helpful resource, but I don't really understand it.

from birt.

hvbtup avatar hvbtup commented on August 21, 2024

For those who can help with the SLF4J problem:
I think this can be narrowed down by debugging and adding a breakpoint at slf4j-api-2.0.0-alpha1-sources.jar\org\slf4j\LoggerFactory.java at the beginning of private static List findServiceProviders(). This is where the magic happens.

from birt.

adiinfo-77 avatar adiinfo-77 commented on August 21, 2024

Hello

regarding https://github.com/eclipse/birt/blob/master/viewer/org.eclipse.birt.report.viewer/pom.xml:

i compared your POM with mine (Report viewer works in my setup).
Are you sure that you don't need to declare the dependencies in the plugin section? I would suspect that the required jar files are missing otherwise in the final deployment.

at the end you find my plugin section for org.eclipse.jetty.
i remember that originally jspc compiler was set to glassfish but you can also use tomcat.
In my setup, glassfish is commented out and tomcat jspc is the one that is used.

I hope this helps.
Andrej

		<plugin>
			<groupId>org.eclipse.jetty</groupId>
            <!--<artifactId>jetty-jspc-adi-maven-plugin</artifactId>-->
            <!--<version>9.0.7.v20131107</version>-->
            <!--<artifactId>jetty-jspc-adi-edge-maven-plugin</artifactId>-->
            <artifactId>jetty-jspc-maven-plugin</artifactId>
            <version>${jetty.version}</version>
			<executions>
				<execution>
                    <id>pre-compile-jsp</id>
                    <phase>process-classes</phase>
					<goals>
						<goal>jspc</goal>
					</goals>
					<configuration>
						<webAppSourceDirectory>${project.basedir}/birt</webAppSourceDirectory>
						<webXml>${project.basedir}/birt/WEB-INF/web-viewer.xml</webXml>
						<generatedClasses>${project.build.directory}/jsp/classes</generatedClasses>
						<useProvidedScope>true</useProvidedScope>
						<keepSources>true</keepSources>
						<classesDirectory>${project.build.directory}/birt/WEB-INF/lib/viewservlets.jar-classes</classesDirectory>                            
						<sourceVersion>1.8</sourceVersion>
						<targetVersion>1.8</targetVersion>
                        <!--<ignoreJspFragmentErrors>true</ignoreJspFragmentErrors>-->
					</configuration>
				</execution>
			</executions>
            <dependencies>
                <dependency>
                    <groupId>org.eclipse.jetty</groupId>
                    <artifactId>jetty-util</artifactId>
                    <version>${jetty.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.mortbay.jasper</groupId>
                    <artifactId>apache-jsp</artifactId>
                    <version>8.5.35.1</version>
                </dependency>
                <dependency>
                    <groupId>org.mortbay.jasper</groupId>
                    <artifactId>apache-el</artifactId>
                    <version>8.5.35.1</version>
                </dependency>                    
                <dependency>
                    <groupId>org.apache.ant</groupId>
                    <artifactId>ant</artifactId>
                    <version>1.10.9</version>
                </dependency>
                <dependency>
                    <groupId>javax.servlet</groupId>
                    <artifactId>javax.servlet-api</artifactId>
                    <version>3.1.0</version>
                </dependency>
                <!--<dependency>
                    <groupId>org.eclipse.jetty.orbit</groupId>
                    <artifactId>org.apache.jasper.glassfish</artifactId>
                    <version>2.2.2.v201112011158</version>
                </dependency>
                <dependency>
                    <groupId>org.eclipse.jetty.orbit</groupId>
                    <artifactId>javax.el</artifactId>
                    <version>2.2.0.v201303151357</version>
                </dependency>                    
                <dependency>
                    <groupId>org.eclipse.jetty.orbit</groupId>
                    <artifactId>com.sun.el</artifactId>
                    <version>2.2.0.v201303151357</version>
                </dependency>
                <dependency>
                    <groupId>org.eclipse.jetty.orbit</groupId>
                    <artifactId>org.apache.taglibs.standard.glassfish</artifactId>
                    <version>1.2.0.v201112081803</version>
                </dependency>                    
                <dependency>
                    <groupId>org.eclipse.jdt</groupId>
                    <artifactId>org.eclipse.jdt.core</artifactId>
                    <version>3.24.0</version>
                </dependency>-->
                <dependency>
                    <groupId>org.eclipse.jetty.orbit</groupId>
                    <artifactId>org.eclipse.jdt.core</artifactId>
                    <version>3.8.2.v20130121</version>
                </dependency>
            </dependencies>                
		</plugin>

from birt.

ruspl-afed avatar ruspl-afed commented on August 21, 2024

at the end you find my plugin section for org.eclipse.jetty. i remember that originally jspc compiler was set to glassfish but you can also use tomcat. In my setup, glassfish is commented out and tomcat jspc is the one that is used.

Hi Andrej @adiinfo-77 ,

Could you please propose a PR based on your setup?

Thanks in advance,
AF

from birt.

adiinfo-77 avatar adiinfo-77 commented on August 21, 2024

Hi Alexander

i made the pull request.

I also had a look at the automatically generated maven build. are you aware of the fact that:

  • you work simultaneously working with Jetty 10.0.6 and Jetty 9.4.4? Is this intended?
  • the slf4j Logger Class is not loaded
    if Jetty 10 and Jetty 9 use different versions of slf4j (and i think this is likely), than you will have most likely classloader-problems there. Apart from other side effects when using jar's from Jetty 9 and Jetty 10.

i made a copy of the maven messages in question at the end of this comment.

Thank you
Andrej

[INFO] default instructions = {Export-Package=;version="${version}";-noimport:=true, Bundle-SymbolicName=wrapped.${mvnGroupId}.${mvnArtifactId}, g.slf4j.spi.SLF4JServiceProvider)"=, Bundle-Version=${version}, Bundle-Name=Bundle derived from maven artifact ${mvnGroupId}:${mvnArtifactId}:${mvnVersion}, DynamicImport-Package=, version=${version_cleanup;${mvnVersion}}, Import-Package=*;resolution:=optional, loader.processor)",osgi.serviceloader;filter=="(osgi.serviceloader=or, Require-Capability=osgi.extender;filter:="(osgi.extender=osgi.service}
[INFO] Resolving MavenDependencyRoots = [GroupId = org.apache.xmlgraphics, ArtifactId = fop, Version = 2.6, ArtifactType = jar, IncludeDependencyScope = ], IncludeDependencyScope = null, MissingManifestStrategy = GENERATE, IncludeSource = true...
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

[INFO] Resolving MavenDependencyRoots = [GroupId = org.eclipse.jetty, ArtifactId = jetty-continuation, Version = 9.4.44.v20210927, ArtifactType = jar, IncludeDependencyScope = ], IncludeDependencyScope = compile, MissingManifestStrategy = GENERATE, IncludeSource = true...

[INFO] Resolving MavenDependencyRoots = [GroupId = org.eclipse.jetty, ArtifactId = jetty-xml, Version = 10.0.6, ArtifactType = jar, IncludeDependencyScope = ], IncludeDependencyScope = compile, MissingManifestStrategy = GENERATE, IncludeSource = true...

from birt.

claesrosell avatar claesrosell commented on August 21, 2024

I finally got the logging to work.
Since Jetty can use slf4j1.7.3, I :

  • added the slf4j simple logger to the target platform (from the Orbit p2 repo).
  • removed the slf4j 2.0.0 alpha 1 bundles from the debug configuration
  • added slf4j 1.7.3 bundles to the debug configuration

image

On another note:
I really tried to get it to work with slf4j 2.0.0 alpha1. It should be possible, according to this post: https://www.mail-archive.com/[email protected]/msg00878.html .

This may be easier to solve with jetty 10.0.7 , which is using slf4j 2.0.0 alpha5, which in turn has the missing "Require-Capability" header in alpha1, but it does not seam like the simple logger (alpha5), has the corresponding "Provides-Capability". Some more info here: https://jira.qos.ch/browse/SLF4J-457

from birt.

adiinfo-77 avatar adiinfo-77 commented on August 21, 2024

Hello

i had to close (delete) my pull request.

On double checking, it turned out that while the RCP Report Designer does start, the Jetty Http-Server does not.

The only working configuration i have is as described here: https://www.optimaw.ch/change-to-jdk11-lts/ (Point 5)
This configuration works only with Jetty 9.4.15 and a modified jetty-jspc-maven-plugin from the 9.0.x branch. And furthermore, only with the (very old) Glassfish JSPC-Compiler.

Sorry for the inconvenience
Andrej

from birt.

ruspl-afed avatar ruspl-afed commented on August 21, 2024

Thank you for sharing your knowledge @adiinfo-77 !

We are looking forward to see more comments and PRs from your side.

from birt.

adiinfo-77 avatar adiinfo-77 commented on August 21, 2024

Hi Alexander

when i did my work on updating BIRT, i struggled most of the time with the precompilation of the JSP files in the report viewer. I did never understand, why the precompilation was done a all! To my knowledge, JSP-Files must be copied to WEB-INF\src for automatic precompilation. But the BIRT build-process copies the jsp-files to WEB-INF\classes.
When i tried to switch from Glassfish to Tomcat Precompiler, Tomcat did obviously not precompile the JSP-files as these were not in WEB-INF\src.

Also, even if i got Tomcat to precompile these files by manual measures, the classpath in the resulting viewer.jar was wrong. With Glassfish precompiler, it was org.eclipse.birt (correct), with Tomcat the classpath was diffrent (i do not remember what it was, probably org.apache).

That's why i changed the source code of the old jetty-jspc-maven-plugin so that it could be used with Java 6 source code level. And that's why i have still to use Glassfish JSP Precompiler.

Maybe this helps a bit.
Andrej

from birt.

claesrosell avatar claesrosell commented on August 21, 2024

I got the viewer working and have tried to make a clean "step by step" commit pull request for this. It was tricky so please try it out, if it passes build, that is, because I have only tested to run this from the PDE. :-)

from birt.

hvbtup avatar hvbtup commented on August 21, 2024

Could not wait until Monday to try this out...
@claesrosell :

Yeah, this is great! The preview is actually working!

I tested this from within Exclipse only, not yet with the Maven build.
The SLF4J still not working. Did you commit the changes to make it work as well?

And there are some errors logged in the BIRT IDE, but this is a huge step forward.

grafik

from birt.

claesrosell avatar claesrosell commented on August 21, 2024

I excluded the "fix" of the logging in this PR since I wanted to keep it as clean as possible.

from birt.

hvbtup avatar hvbtup commented on August 21, 2024

I tried to build with mvn, but this failed. Maybe something is wrong with my environment... I'll create a separate issue for that.

from birt.

patric-r avatar patric-r commented on August 21, 2024

Thanks!
I pulled the recent changes, but I'm now getting java compilation errors:

image

from birt.

claesrosell avatar claesrosell commented on August 21, 2024

Those dependencies should have been added to the target platform and since the CI build was successful I think that they were.
Try to open your .target file (org.eclipse.birt.target.target) and press "Reload target platform".
Hopefully that will solve the issue.

from birt.

patric-r avatar patric-r commented on August 21, 2024

Thanks, this fixed the issue!
Is there a way to do this automatically whenever the target platform definition changes?

from birt.

claesrosell avatar claesrosell commented on August 21, 2024

You mean something like this ?: https://bugs.eclipse.org/bugs/show_bug.cgi?id=576844

from birt.

hvbtup avatar hvbtup commented on August 21, 2024

I was able to generate the all-in-one-designer with mvn from within the Eclipse IDE.
The report viewer (inside the all-in-one-designer) is working here.
I tested with a quite complex PDF report, and at first glance everything is looking fine.

Great work!

However I noticed that starting the all-in-one-designer takes 2-3 minutes on my machine (Core i5, 8GB RAM, SSD) with high cpu. This is before the progress bar shows. The 4.2.1 all-in-one-designer only takes a few seconds to start.

Is this to be expected?

from birt.

claesrosell avatar claesrosell commented on August 21, 2024

No, that is not expected. I guess that we need to investigate that.
Please file a new issue for that problem, we will need to profile the startup, to see what causes the increase in time. The start of jetty (used by the web viewer) does not happen until it is first used so it is not directly caused by that.

from birt.

wimjongman avatar wimjongman commented on August 21, 2024

Is it also slow on the second launch?

from birt.

wimjongman avatar wimjongman commented on August 21, 2024

Henning, can you also try if report parameters work?

from birt.

hvbtup avatar hvbtup commented on August 21, 2024

Yes, report parameters work.
In my test case, I have two linked parameters. One of them is hidden and uses default values, the second one uses the first one to show a LOV. Not too complicated, but not trivial OTOH.

from birt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.