Java Vaadin使用错误的资源路径作为OSGiServlet
如前所述,我已经在ApacheKaraf中部署了一个简单的Vaadin应用程序。现在,当检查Java Vaadin使用错误的资源路径作为OSGiServlet,java,maven,osgi,vaadin,apache-karaf,Java,Maven,Osgi,Vaadin,Apache Karaf,如前所述,我已经在ApacheKaraf中部署了一个简单的Vaadin应用程序。现在,当检查http:list时,可以使用资源servlet和我自己的servlet: ID | Servlet | Servlet-Name | State | Alias | Url ----+------------------
http:list
时,可以使用资源servlet和我自己的servlet:
ID | Servlet | Servlet-Name | State | Alias | Url
----+-----------------------+-------------------------------------------+-------------+--------------------------------------------------+---------------------------------------------------
52 | ResourceServlet | /VAADIN/themes/valo/*:/VAADIN/themes/valo | Deployed | /VAADIN/themes/valo/* | [/VAADIN/themes/valo/*]
52 | ResourceServlet | gz | Deployed | /VAADIN/vaadinBootstrap.js.gz | [/VAADIN/vaadinBootstrap.js.gz/*]
52 | ResourceServlet | js | Deployed | /VAADIN/vaadinBootstrap.js | [/VAADIN/vaadinBootstrap.js/*]
52 | ResourceServlet | DefaultWidgetSet | Deployed | /VAADIN/widgetsets/com.vaadin.DefaultWidgetSet/* | [/VAADIN/widgetsets/com.vaadin.DefaultWidgetSet/*]
115 | MyVaadinServlet | ServletModel-8 | Deployed | | [/*]
在http://localhost:8181/
我收到这条消息:
Failed to load the bootstrap javascript: /vaadin-8.11.2/VAADIN/vaadinBootstrap.js?v=8.11.2
此资源确实不可访问,但资源http://localhost:8181/VAADIN/vaadinBootstrap.js?v=8.11.2
可用。因此,似乎部署的服务中缺少版本前缀/vaadin-8.11.2
,或者servlet错误地尝试访问它们
MyVaadinServlet
与文档页面上的描述相同。我在pom.xml中使用maven bundle插件而不是bnd,它看起来是这样的:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.myapplication</groupId>
<artifactId>myapplication-parent</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>myapplication-frontend</artifactId>
<packaging>bundle</packaging>
<properties>
<vaadin.version>8.11.2</vaadin.version>
</properties>
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>${vaadin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-osgi-integration</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.cmpn</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.annotation</artifactId>
<version>${osgi.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Specify compiler settings -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<maxmem>256M</maxmem>
</configuration>
</plugin>
<!-- Generate bundle manifest -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven-bundle-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Export-Package>
de.myapplication.frontend*;version=${project.version}
</Export-Package>
<Import-Package>
*
</Import-Package>
</instructions>
</configuration>
</plugin>
<!-- Include bundle manifest in JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- Vaadin pre-release repositories -->
<id>vaadin-prerelease</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<repositories>
<repository>
<id>vaadin-prereleases</id>
<url>http://maven.vaadin.com/vaadin-prereleases</url>
</repository>
<repository>
<id>vaadin-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>vaadin-prereleases</id>
<url>http://maven.vaadin.com/vaadin-prereleases</url>
</pluginRepository>
<pluginRepository>
<id>vaadin-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</project>
4.0.0
de.myapplication
myapplication父级
1.0.0
myapplication前端
捆
8.11.2
瓦丁插件
http://maven.vaadin.com/vaadin-addons
com.vaadin
瓦丁波姆
${vaadin.version}
聚甲醛
进口
com.vaadin
瓦丁服务器
假如
com.vaadin
瓦丁推
假如
com.vaadin
瓦丁客户机
假如
com.vaadin
瓦丁主题
假如
com.vaadin
vaadin-osgi积分
${vaadin.version}
假如
org.osgi
osgi.cmpn
假如
org.osgi
osgi.annotation
${osgi.version}
假如
org.apache.maven.plugins
maven编译器插件
${maven编译器plugin.version}
1.8
1.8
256M
org.apache.felix
maven捆绑插件
${maven bundle plugin.version}
真的
${project.artifactId}
${project.version}
de.myapplication.frontend*;版本=${project.version}
*
org.apache.maven.plugins
maven jar插件
2.6
${project.build.outputDirectory}/META-INF/MANIFEST.MF
瓦丁预释放
假的
瓦丁预释放
http://maven.vaadin.com/vaadin-prereleases
瓦丁快照
https://oss.sonatype.org/content/repositories/vaadin-snapshots/
假的
真的
瓦丁预释放
http://maven.vaadin.com/vaadin-prereleases
瓦丁快照
https://oss.sonatype.org/content/repositories/vaadin-snapshots/
假的
真的
我是否需要配置其他东西才能使其正常工作