Betamax with Spring Boot throws Illegal use of nonvirtual function call - groovy

I'm trying to setup a simple test in Groovy with Spock using Betamax:
class BetaMaxSpockTest extends Specification {
#Rule
public Recorder recorder = new Recorder()
#Betamax(tape = "some_tape")
def 'You shall pass'() {
expect:
true
}
}
I'm also using Spring Boot so I have spring-boot-starter-parent as my parent in pom.xml:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.6.RELEASE</version>
</parent>
When I run above test I'm getting this error:
java.lang.VerifyError: (class: co/freeside/betamax/proxy/jetty/BetamaxProxy, method: super$3$getBean signature: (Ljava/lang/Class;)Ljava/lang/Object;) Illegal use of nonvirtual function call
at java.lang.Class.forName(Class.java:264)
at co.freeside.betamax.proxy.jetty.ProxyServer.start(ProxyServer.groovy:47)
at co.freeside.betamax.Recorder.startProxy(Recorder.groovy:198)
at co.freeside.betamax.Recorder.withTape(Recorder.groovy:167)
at co.freeside.betamax.Recorder$1.evaluate(Recorder.groovy:185)
at org.spockframework.runtime.extension.builtin.MethodRuleInterceptor.intercept(MethodRuleInterceptor.java:40)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:84)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:138)
at org.spockframework.util.ReflectionUtil.invokeMethod
Without Spring Boot on path it works fine. Looks like some versions problem. Anyone had similar issue?
My full pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.6.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
<!--plugins versions-->
<maven.compiler.plugin.version>3.3</maven.compiler.plugin.version>
<!--settings-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!--Spring Boot-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--Spock Testing-->
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<scope>test</scope>
</dependency>
<!--Groovy Testing-->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<scope>test</scope>
</dependency>
<!--Betamax Http Mocks-->
<dependency>
<groupId>co.freeside</groupId>
<artifactId>betamax</artifactId>
<version>1.1.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<--...-->
</pluginManagement>
</build>
</project>

There are a couple things you can do to fix this. The first is that you can make the code in question #CompileStatic (probably the Spec in your case) which often resolves the issue, but this is not always desireable (and does not always work).
The other thing you can do is add -Xverify:none to your java command line options (wherever you would specify them for your environment). This will turn off the verification, which is what is causing the error.
From what I have read about this issue when I originally ran into it, they are planning on turning off verification by default in the next Java version. This generally occurs with Groovy or other libraries that do a lot of bytecode manipulation under the covers (asm is another).

I have found the solution. The problem was in wrong versions of jetty and httpclient. BetaMax requires versions shown below, while Spring's parent pom declares much newer versions.
Adding this two lines to properties in my pom.xml solved the issue:
<jetty.version>7.3.1.v20110307</jetty.version>
<httpclient.version>4.2.1</httpclient.version>
Anyway, thanks for your help!

Related

Read an excel file using Apache Camel

I am trying to read an Excel file using Apache Camel. For that I have found that we can use the CSV component:
https://camel.apache.org/components/3.14.x/dataformats/csv-dataformat.html
For that I have created a simple route which reads a XLSX file from a folder. Then I am trying to print the content of of that Excel file and write to another folder, but the contents of the file are not getting printed. The route is as below:
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.dataformat.csv.CsvDataFormat;
import org.apache.commons.csv.CSVFormat;
import org.springframework.stereotype.Component;
#Component
public class MyRoute extends RouteBuilder {
public void configure() {
CsvDataFormat csv = new CsvDataFormat();
csv.setFormat(CSVFormat.EXCEL);
from("file://C://work//ei01//source")
.unmarshal(csv)
.log("Reached ${body}")
.marshal(csv)
.to("file://C://work//ei01//destination?fileName=test.xlsx");
}
}
The pom.xml is as below:
<?xml version="1.0" encoding="UTF-8"?>
<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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>sprng-boot-camel-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sprng-boot-camel-demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>3.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-csv-starter</artifactId>
<version>3.14.1</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Can you please suggest me what I am doing wrong here?
I suppose you try to read a real Excel file (.xlsx). That does not work with the CSV data format.
The CSVFormat.EXCEL format is to read CSV files (.csv) exported from Excel. Because the CSV format is done quite different from product to product, Camel supports multiple "well-known" CSV formats. One of them is CSVFormat.EXCEL.
To read the native Excel format (I think it is a ZIP file that contains XML files), you need a library like Apache POI.

Unable to resolve class com.atlassian.jira.component.ComponentAccessor

I am trying to run a Groovy script on IntelliJ IDEA, the Groovy script I am trying to run is called UsersCount.groovy, it looks like this
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserManager
def userManager = ComponentAccessor.getUserManager() as UserManager
def message = "My instance contains ${userManager.totalUserCount} user(s)."
log.warn(message)
When I run this code, I get the following error message
"C:\Program Files\Zulu\zulu-8\bin\java.exe" "-Dtools.jar=C:\Program Files\Zulu\zulu-8\lib\tools.jar" -Dgroovy.home=C:\Users\mouh\.m2\repository\org\codehaus\groovy\groovy-all\2.4.6 "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\lib\idea_rt.jar=59917:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\mouh\.m2\repository\org\codehaus\groovy\groovy-all\2.4.6\groovy-all-2.4.6.jar org.codehaus.groovy.tools.GroovyStarter --main groovy.ui.GroovyMain --classpath .;C:\Users\mouh\IdeaProjects\scriptrunner-samples\jira\target\classes --encoding=UTF-8 C:\Users\mouh\IdeaProjects\scriptrunner-samples\jira\src\main\resources\UsersCount.groovy
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
C:\Users\mouh\IdeaProjects\scriptrunner-samples\jira\src\main\resources\UsersCount.groovy: 2: unable to resolve class com.atlassian.jira.user.util.UserManager
# line 2, column 1.
import com.atlassian.jira.user.util.UserManager
^
C:\Users\mouh\IdeaProjects\scriptrunner-samples\jira\src\main\resources\UsersCount.groovy: 1: unable to resolve class com.atlassian.jira.component.ComponentAccessor
# line 1, column 1.
import com.atlassian.jira.component.ComponentAccessor
^
2 errors
How can I fix this error and make sure that the imports are resolved? I made sure to include the dependency for com.atlassian.jira in my pom.xml file. My pom.xml file looks like this
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- I added the parent pom.xml, which does all the magic. I took this pom.xml from the ScriptRunner sample plugin -->
<parent>
<groupId>com.adaptavist.pom</groupId>
<artifactId>scriptrunner-jira-standard</artifactId>
<version>10</version>
<relativePath/>
</parent>
<groupId>ru.matveev.alexey.scriptrunner</groupId>
<artifactId>scriptrunner-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>scriptrunner-plugin</name>
<description>This is the ru.matveev.alexey.scriptrunner:scriptrunner-plugin plugin for Atlassian JIRA.</description>
<packaging>atlassian-plugin</packaging>
<dependencies>
<!-- I excluded a couple of dependencies from the dependency below, because the plugin did not want to start for ScriptRunner versions higher than 5.3.0 -->
<dependency>
<groupId>com.onresolve.jira.groovy</groupId>
<artifactId>groovyrunner</artifactId>
<version>${scriptrunner.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>com.onresolve.scriptrunner.platform</groupId>
<artifactId>scriptrunner-test-libraries-jira</artifactId>
</exclusion>
<exclusion>
<groupId>jndi</groupId>
<artifactId>jndi</artifactId>
</exclusion>
<exclusion>
<groupId>jta</groupId>
<artifactId>jta</artifactId>
</exclusion>
<exclusion>
<groupId>is.origo.jira</groupId>
<artifactId>tempo-plugin</artifactId>
</exclusion>
<exclusion>
<groupId>com.tempoplugin</groupId>
<artifactId>tempo-core</artifactId>
</exclusion>
<exclusion>
<groupId>groovyrunner</groupId>
<artifactId>test</artifactId>
</exclusion>
<exclusion>
<groupId>com.atlassian.plugin.automation</groupId>
<artifactId>automation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>8.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<!-- I increased JVM memory, because Jira 7.9.0 does not want to run with the default settings -->
<jvmArgs>-Xms512M -Xmx1g</jvmArgs>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<applications>
<!-- I added Jira Software to the plugin because I want Jira Software to start on the atlas-run command. -->
<application>
<applicationKey>jira-software</applicationKey>
<version>${jira.version}</version>
</application>
<!-- I added Jira Service Desk to the plugin because I want Jira Service Desk to start on the atlas-run command. -->
<application>
<applicationKey>jira-servicedesk</applicationKey>
<version>${jira.servicedesk.application.version}</version>
</application>
</applications>
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<Export-Package>
ru.matveev.alexey.scriptrunner.api,
</Export-Package>
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*
</Import-Package>
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>7.9.0</jira.version>
<jira.servicedesk.application.version>3.12.0</jira.servicedesk.application.version>
<scriptrunner.version>5.3.9</scriptrunner.version>
<amps.version>6.3.6</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>2.0.0</atlassian.spring.scanner.version>
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<testkit.version>6.3.11</testkit.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<!-- This is required to find the parent pom and ScriptRunner dependencies -->
<repository>
<id>adaptavist-external</id>
<url>https://nexus.adaptavist.com/content/repositories/external</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</releases>
</repository>
</repositories>
</project>
You should specify the path to the Atlassian SDK maven:
Go to Settings (Alt+Ctrl+S) -> Build, Execution, Deployment -> Build -> Maven
In the "Maven home path" set the path to the location where your installed Atlassian SDK is and its direct child maven sub-folder.
In the User settings file checkbox the Override option and menu below specify the path to the "settings.xml" file inside the maven sub-folder of the path above
Click Save to save the changes of the IDEA settings
As your local Maven is not configured to see Atlassian repos.

JSF 2.0 and Richfaces configuration

I'm new in Richfaces framework. In this time I'm trying to add this to my engineering project. Unfortunately have a lot of problem with making this framework running with JSF 2.0 . I've tried to download a lot of maven archetypes but most of them aren't working. Could you point me the place where I can find something like JSF 2.0 + Richfaces 4 blank and configured project? It can be maven as well. I've spend all day today to make it running but things are so complex for me in this time.
You do not need much. You probably need the reposity for the dependencies, the plugin to build the war file, a JSF version (I assume that your container supplies a JSF api+implementation, thus provided), and RichFaces API + implementation.
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.your.package</groupId>
<artifactId>your.project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<project.build.version>0.0.1-SNAPSHOT</project.build.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>jboss</id>
<name>JBoss repository</name>
<!-- <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url> -->
<url>http://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.22</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.22</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-api</artifactId>
<version>4.3.3.Final</version>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
<version>4.3.3.Final</version>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<webXml>src\main\webapp\WEB-INF\web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
</project>

RestEasy / CDI on TomEE 1.5.2

I'm trying to get a ResteasyApplication running. My major problem is to implement CDI which should be not too hard.
So here is my prob. I'm using #Named on my Service class and #Inject at my RestService class
#Path("/patient")
#Produces({ MediaType.APPLICATION_XML, MediaType.TEXT_XML, MediaType.APPLICATION_JSON
})
#Consumes
#Stateless
public class PatientREST {
#Inject
PatientService patientService;...
#Named
public class PatientService {
// Resteasy demands a no-arg constructor
public PatientService() {
}
public Patient getPatient(String patientNumber) {...
My beans.xml looks like this
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>
All over I tried to use it like several TomEE- HowTos describes.
When I'm trying to deploy this on my TomEE (1.5.2) I'm getting this in the stacktrace.
uses #Inject but CDI is not enabled. Maybe youd need to add a beans.xml file.
javax.enterprise.inject.UnsatisfiedResolutionException: Api type [de.klinikum.service.PatientService] is not found with the qualifiers
Qualifiers: [#javax.enterprise.inject.Default()]
for injection into Field Injection Point, field name : patientService, Bean Owner : [PatientREST, Name:null, WebBeans Type:ENTERPRISE, API Types:[java.lang.Object,de.klinikum.communication.PatientREST,java.io.Serializable], Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]]
Any Idea?
I was trying a bit more .. and now... deployment works. But I still get an HTTP500 Failure caused by an null pointer
type Exception report
message java.lang.NullPointerException
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365)
org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233)
org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209)
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause
java.lang.NullPointerException
de.klinikum.communication.PatientREST.getPatient(PatientREST.java:48)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
note The full stack trace of the root cause is available in the Apache Tomcat (TomEE)/7.0.37 logs.
Seems like the container is not able to provide the patientService bean... but why ?
.------------------
Still get the same Failure.. Maybe I need some special dependencys ? ...
Here is my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.klinikumlmu.server</groupId>
<artifactId>KlinikumServer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>KlinikumServer</name>
<properties>
<sesame.version>
2.7.0
</sesame.version>
</properties>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<webXml>WebContent\WEB-INF\web.xml</webXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.openejb.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>1.5.2</version>
<configuration>
<tomeeVersion>1.5.2</tomeeVersion>
<!-- <tomeeClassifier>plus</tomeeClassifier> -->
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0-4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-runtime</artifactId>
<version>${sesame.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>catalina</artifactId>
<version>6.0.26</version>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>cdi-tomee</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.3.6.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>2.3.6.Final</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
</plugin>
</plugins>
</reporting>
</project>
I'm geeting deeper an deeper into it.
I've tried to place the beans.xml in the WEB-INF Folder and in the META-INF Folder to...
we got the answer^^..
to use CDI with Resteasy and TomEE you have to include special resteasy cdi dependency. Since we use this everything works find...
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-cdi</artifactId>
<version>${resteasy.version}</version>
<exclusions>
<exclusion>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
</exclusion>
</exclusions>
</dependency>
Thanks for our help...
Your REST end point needs to have #RequestScoped on it to enable CDI injection. Also, your injection point should be
#Inject
#Named("PatientService")
PatientService patientService;
Since you have a #Named on the service.
An aside, there is no such thing as TomEE 7. There is TomEE 1.5.x and Tomcat 7.0. I'm assuming you're using TomEE 1.5.x

ActionBarSherlock maven dependency

I have been trying to add the ActionbarSherlock maven dependency to my project using the
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>library</artifactId>
<version>4.2.0</version>
</dependency>
in my pom.xml file. Now this works except for my styles.xml file, where it does not seem to the abs styles, but everything else works fine ? What am i doing wrong. Below is the full pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xyz</groupId>
<artifactId>abc</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>abc Android Application</name>
<dependencies>
<dependency>
<groupId>org.springframework.android</groupId>
<artifactId>spring-android-rest-template</artifactId>
<version>1.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.8</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.0.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<sdk>
<platform>16</platform>
</sdk>
</configuration>
</plugin>
</plugins>
</build>
</project>
ActionBarSherlock is a library project which means you need to add a <type>apklib</type> to the Maven dependency declaration.
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>actionbarsherlock</artifactId>
<version>4.2.0</version>
<type>apklib</type>
</dependency>
(Note that I've also changed the artifactId to 'actionbarsherlock')
In order to do this, you need to have the android-maven-plugin referenced with <extensions>true</extensions>. It looks you have this requirement completed already from your pasted pom.xml.

Resources