[英]Vaadin/OSGi : ScssStylesheet class not found
I use vaadin and OSGi to create a modular application. 我使用vaadin和OSGi来创建模块化应用程序。 After a long fight, I was able to deploy successfully the application.
经过长时间的斗争,我能够成功部署应用程序。 However, I can't load the style.
但是,我无法加载样式。 When I try to access to
http://localhost:8080/myapp/VAADIN/themes/myTheme/styles.css
I got the following exception: 当我尝试访问
http://localhost:8080/myapp/VAADIN/themes/myTheme/styles.css
我遇到以下异常:
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoClassDefFoundError: com/vaadin/sass/internal/ScssStylesheet
com.vaadin.server.VaadinServlet.serveOnTheFlyCompiledScss(VaadinServlet.java:957)
com.vaadin.server.VaadinServlet.serveStaticResourcesInVAADIN(VaadinServlet.java:790)
com.vaadin.server.VaadinServlet.serveStaticResources(VaadinServlet.java:760)
com.vaadin.server.VaadinServlet.service(VaadinServlet.java:257)
com.vaadin.server.VaadinServlet.service(VaadinServlet.java:201)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.ClassNotFoundException: com.vaadin.sass.internal.ScssStylesheet
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
java.lang.ClassLoader.loadClass(ClassLoader.java:356)
com.vaadin.server.VaadinServlet.serveOnTheFlyCompiledScss(VaadinServlet.java:957)
com.vaadin.server.VaadinServlet.serveStaticResourcesInVAADIN(VaadinServlet.java:790)
com.vaadin.server.VaadinServlet.serveStaticResources(VaadinServlet.java:760)
com.vaadin.server.VaadinServlet.service(VaadinServlet.java:257)
com.vaadin.server.VaadinServlet.service(VaadinServlet.java:201)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)[/code]
com.vaadin.sass.internal.ScssStylesheet
class is offered by vaadin-theme-compiler-7.xxjar but the server doesn't import this package. com.vaadin.sass.internal.ScssStylesheet
类由vaadin-theme-compiler-7.xxjar提供,但服务器不导入此包。 Then, I "hacked" the vaadin server bundle by adding DynamicImport-Package: *
in vaadin server's MANIFEST. 然后,我通过在vaadin服务器的MANIFEST中添加
DynamicImport-Package: *
来“破解”vaadin服务器软件包。 The previous exception does not appear but I got the same for org.w3c.css.sac.CSSException
. 之前的异常没有出现,但我对
org.w3c.css.sac.CSSException
也有同样的org.w3c.css.sac.CSSException
。
Note that by deploying the application .war file on tomcat, I had no error and the app looks like I expected (because all libraries are added under WEB-INF/lib and tomcat add them on the class loader). 请注意,通过在tomcat上部署应用程序.war文件,我没有错误,应用程序看起来像我预期的那样(因为所有库都添加在WEB-INF / lib下,tomcat将它们添加到类加载器上)。 So, the problem is pure OSGi.
所以,问题是纯OSGi。
based on the Vaadin 7.1.3 bundles, the following changes need to be made: 基于Vaadin 7.1.3软件包,需要进行以下更改:
This sounds like a packaging bug in Vaadin which should be reported to the authors. 这听起来像Vaadin中的包装错误,应该向作者报告。 If the core Vaadin bundle needs to access classes from the package
com.vaadin.sass.internal
then it should include that in its Import-Package
header. 如果核心Vaadin包需要从
com.vaadin.sass.internal
包中访问类,那么它应该在其Import-Package
头中包含它。
With respect to org.w3c.css.sac
, you don't specify which bundle throws an error but it sounds like the same kind of problem. 对于
org.w3c.css.sac
,您没有指定哪个包引发错误,但它听起来像是同一类问题。 Whichever bundle uses that package should import it via Import-Package. 无论哪个包使用该包,都应通过Import-Package导入它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.