I wrote a simple JAX-RS REST service (which is working as expected) and I'm trying to generate the OpenAPI documentation using microprofile. Therefore I added the following dependency to my pom.xml:
<dependency>
<groupId>org.eclipse.microprofile.openapi</groupId>
<artifactId>microprofile-openapi-api</artifactId>
<version>2.0</version>
</dependency>
When I deploy the application on TomEE 9.0.0 M7 Microprofil everything works as expected and the OpenAPI schema is reachable under http://localhost:8080/openapi. But when I deploy the same artifact to TomEE 9.0.0. M7 Plume/Webprofile/Plus the schema / endpoint is not available. What am I missing here? Is this a configuration issue? According to https://www.tomitribe.com/blog/tomee-webprofile-vs-tomee-microprofile-vs-tomee-vs-tomee-plume/ MicroProfile should be part of the other distributions of TomEE too...
Thanks a lot!
Yes! MP implementation is available on the others TOMEE Profiles, but you will need to add a flag.
-Dtomee.mp.scan=all
if you are running it trough maven plugin you should put the flag like this.
<plugin>
<groupId>org.apache.tomee.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>${tomee.version}</version>
<configuration>
<context>ROOT</context>
<args>-Dtomee.mp.scan=all</args>
<tomeeVersion>${tomee.version}</tomeeVersion>
<tomeeClassifier>plus</tomeeClassifier>
</configuration>
</plugin>
Related
I have a jar file that i received from other team and need to use in AEM. I can not use jar directly in AEM so i converted the Jar into bundle with help of the link "https://helpx.adobe.com/experience-manager/kb/ConvertAJarIntoOsgiBundle.html" , Now my bundle is ready and uploaded into AEM through felix console. Bundle is active. Now i need use the classe which are there in bundle to my java classes. How to use that bunlde in java classes . do i need to added the bundle in POM.xml? if so then how i can use that bundle into POM.xml so that my code can complile.
Now my bundle is ready and uploaded into AEM through felix console
That is not a good idea. Yes, you can install bundles from the Felix console but bundles installations in AEM ideally should be managed by the Sling OSGi Installer which can scan the JCR repository for bundles.
As said in the other response, you should put your bundle in a folder named "install" below the /apps folder.
My recommendation would be to use the Maven Content Package Plugin that is used to generate AEM comments to embedd your bundle in your AEM package:
<build>
<plugins>
<plugin>
<groupId>com.day.jcr.vault</groupId>
<artifactId>content-package-maven-plugin</artifactId>
<configuration>
<failOnMissingEmbed>true</failOnMissingEmbed>
<filterSource>src/main/META-INF/vault/filter.xml</filterSource>
<filters combine.self="override" />
<embeddeds>
<embedded>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.models.validation-impl</artifactId>
<target>/apps/example/install</target>
</embedded>
</embeddeds>
</configuration>
</plugin>
</plugins>
</build>
Also, dont forget to add /apps/example/install to your filter.xml.
More information on the content package plugin
You can put your lib into src/main/jcr_root/apps/your_app/libs/install folder(path depends on your project structure). Now it will be installed to AEM using maven.
To import necessary classes use provided scope, we have the following configuration for Jedis lib:
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.jedis</artifactId>
<version>2.7.3_1</version>
<scope>provided</scope>
</dependency>
Does jetty server in gwt 2.8 support websocket now? As I know it did not support before. If there is a positive answer, then how to make it work? Stripping out jetty-8 and replaceing it with jetty-9 is not a good idea I think.
then how to make it work?
I want to elaborate a bit on this after the GWT 2.8.0 release. The only thing required for using javax.websocket is the knowledge of the Jetty version packaged with GWT and the following set of Maven dependencies (see also the Jetty WebSocket examples on GitHub):
<project>
<properties>
<sdm.jetty.version>9.2.14.v20151106</sdm.jetty.version>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId>
<version>${sdm.jetty.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>javax-websocket-server-impl</artifactId>
<version>${sdm.jetty.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
</depencies>
</project>
Make doubly sure that the scope is provided - for the former two this will mean they are not packaged into the final app - you will be requiring those only when running the SuperDev-Mode (SDM). Ifjava.websocket-apiwas on your classpath probably the annotation-based configuration will not work at all (at least in embedded Tomcat and Jetty) due to the annotations being picked up by the wrong class loader (see also related question WebSocket 404 error for more info on this topic).
GWT 2.8 has switched to Jetty 9.2, and now supports Servlets 3.1 servlets container initializers, which I think are being used to setup WebSockets.
I haven't tried it but I suppose that you can now have WebSockets in DevMode, provided you add the required dependencies to the classpath.
You can also simply use a separate server rather than the one embedded into DevMode.
I'm working on a java RESTful client using Apache CXF's Proxy-based API, deploying to JBoss 5.1.
Here's my dependency in POM:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>3.0.1</version>
</dependency>
I've written a test and it works just fine, but it doesn't work in application after deployment to JBoss. It fails with NPE after application start because #SessionContext was not injected for some reason and is null.
I suppose that there are some conflicts between dependencies, because when I change above POM to:
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>3.0.1</version>
<exclusions>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</exclusion>
</exclusions>
</dependency>
the application works fine (!) until it creates a proxy:
authenticationProxy = JAXRSClientFactory.create(
myServiceUrl,
IAuthenticationResource.class,
Collections.singletonList(jsonProvider));
At this point it hangs and fails by timeout.
I've tried to use Resteasy instead of CXF and had the same problem.
I've tried to detect conflicts in my POM using maven plugins, but it gave nothing.
I think that the problem is in JBoss. Does JBoss 5.1 support JAX-RS 2.0? Is there a default implementation of it within JBoss? Can I use Apache CXF 3.x.x in JBoss 5.1? Please advise
JAX-RS 2.0 is part of Java EE 7 Web Profile and JAX-RS 1.1 is part of Java EE 6 Web Profile.
JBoss AS 7.1 uses RESTEasy with JAX-RS 1.1, see JBoss AS 7.1 - JAX-RS Reference Guide.
JBoss AS 6 uses RESTEasy , see RESTEasy JAX-RS.
JBoss AS 5 has no implementation of JAX-RS, see RESTEasy JAX-RS, but some issues:
Resteasy has no special integration with JBoss Application Server so it must be configured and installed like any other container. There are some issues though. You must make sure that there is not a copy of servlet-api-xxx.jar in your WEB-INF/lib directory as this may cause problems. Also, if you are running with JDK 6, make sure to filter out the JAXB jars as they come with JDK 6.
If you use JBoss EAP 5.1 you find versions of JBoss AS, RESTEasy and Apache CXF at JBoss Enterprise Application Platform 5.
I am developing a webapp in Eclipse Juno as a Maven multi-module project using Spring MVC and the Jetty Maven plugin version 8.1.7.v20120910 with HSQL as in-memory DB during development. I want to start Jetty from within the IDE using the jetty:run goal. The problem is that I cannot see any log outputs from Spring, but I suspect the context is indeed being loaded since console log outputs stop briefly - just as long as it would take to load my yet so small Spring context - before throwing an NPE on an Autowired bean. So my suspicion is that something went wrong while starting up the Spring context.
This is the log output just before it "stops" briefly:
[INFO] web.xml file = file:/F:/projects/matching/template/template-app/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = F:\projects\matching\template\template-app\src\main\webapp
2013-01-26 11:09:18.130:INFO:oejs.Server:jetty-8.1.7.v20120910
2013-01-26 11:09:20.704:INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one.
Which after the pause is followed by:
2013-01-26 11:09:35.884:INFO:/:No Spring WebApplicationInitializer types detected on classpath
2013-01-26 11:09:36.742:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,file:/F:/projects/matching/template/template-app/src/main/webapp/},file:/F:/projects/matching/template/template-app/src/main/webapp/
2013-01-26 11:09:36.742:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,file:/F:/projects/matching/template/template-app/src/main/webapp/},file:/F:/projects/matching/template/template-app/src/main/webapp/
2013-01-26 11:09:36.742:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,file:/F:/projects/matching/template/template-app/src/main/webapp/},file:/F:/projects/matching/template/template-app/src/main/webapp/
2013-01-26 11:09:36.743:WARN:oejw.WebAppContext:Failed startup of context o.m.j.p.JettyWebAppContext{/,file:/F:/projects/matching/template/template-app/src/main/webapp/},file:/F:/projects/matching/template/template-app/src/main/webapp/
java.lang.NullPointerException
Now I am confident that I will be able to fix whatever is causing the NPE, but for that I need to see what is happening to my Spring context. I used to work on the same constellation of tools last year, when a colleague had set it up with what I believe was the same configuration as I am using now.
I have searched the web all morning and couldn't find anything useful about it, only the vague suggestion to run Jetty externally and assemble the war and deploy the app, which is exactly not what I want.
This is my pom's build configuration:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>src\main\webapp\WEB-INF\web.xml</webXml>
<warName>template</warName>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<webXml>src\main\webapp\WEB-INF\web.xml</webXml>
<webApp>
<jettyEnvXml>${jettyEnvXml-file}</jettyEnvXml>
</webApp>
<contextPath>template</contextPath>
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
<value>file:jetty/log4j-jetty.properties</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
And this is my log4j configuration for Jetty:
log4j.debug=true
log4j.threshold=ALL
log4j.rootLogger=DEBUG, consoleLogger
log4j.appender.consoleLogger=org.apache.log4j.ConsoleAppender
log4j.appender.consoleLogger.layout=org.apache.log4j.PatternLayout
log4j.appender.consoleLogger.layout.ConversionPattern=%-5p [%t]: %m%n
log4j.appender.consoleLogger.Threshold=TRACE
Could it have to do with this line at the beginning of my log?
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
But as far as I know it's just an m2e bug that can be ignored. I have slf4j in my classpath though.
When I run my unit tests with HSQL in the SpringJPA module, it works nicely, so I suspect it's a Jetty issue or something with my log4j configuration is just bogus.
Any ideas, hints, helps are greatly appreciated.
You have slf4j in your classpath, then Jetty will use slf4j.
Make sure you setup/configure for slf4j.
You can even setup slf4j to have its log events route to log4j for actual writing to disk or presenting to your console.
I'm using Tomcat 6 and I have a web application that uses a SOAP web service. I generated the client classes to use using cxf-codegen-plugin in maven, my dependencies are :
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-api</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>2.6.1</version>
</dependency>
Everything works until I redeploy my war on tomcat (or even doing a simple touch on it: no code modification at all). Using the same url to access my page that makes the SOAP service call I have this weird NPE:
java.lang.NullPointerException
at com.ctc.wstx.util.SymbolTable.findSymbol(SymbolTable.java:385)
at com.ctc.wstx.sr.StreamScanner.parseLocalName(StreamScanner.java:1831)
at com.ctc.wstx.sr.BasicStreamReader.handleNsAttrs(BasicStreamReader.java:2997)
at com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:2941)
at com.ctc.wstx.sr.BasicStreamReader.handleRootElem(BasicStreamReader.java:2078)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2058)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1117)
at com.sun.xml.internal.ws.util.xml.XMLStreamReaderFilter.next(XMLStreamReaderFilter.java:81)
at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.next(XMLStreamReaderUtil.java:78)
at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.nextContent(XMLStreamReaderUtil.java:99)
at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.nextElementContent(XMLStreamReaderUtil.java:89)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.hasWSDLDefinitions(RuntimeWSDLParser.java:209)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:119)
at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:254)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:217)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:165)
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:93)
at javax.xml.ws.Service.<init>(Service.java:56)
at some.package.flightinfo.model.flightstatsv2.soap.AirportsV1SoapService.<init>(AirportsV1SoapService.java:48)
at some.package.flightinfo.adapter.FlightStatsV2ContentAdapter.getAirportsByGPSCoordinate(FlightStatsV2ContentAdapter.java:107)
The only way I can get my web application working again is to restart tomcat which is no option at all.
I am totally clueless on what's going on, has anyone ever experienced this problem before?
Cheers.
Well, you are missing the cxf-rt-frontend-jaxws dependency. Thus, you are ending up using the JAX-WS reference impl built into the JDK, not CXF. If you add the CXF dependencies, does that fix it? Could be a bug in the RI or something.