JASPIC configuration in Wildfly SWARM - wildfly

I need some assistance with configuring JASPIC authentication in Wildfly Swarm. The JASPIC configuration works perfectly in the normal Wildfly, but I somehow cannot get it to work with Wildfly Swarm. I always this error:
2017-07-07 11:15:08,819 ERROR [org.jboss.security] (default task-3) PBOX00374: Error getting ServerAuthContext for authContextId default-host /Tiles and security domain obbi-auth-id: javax.security.auth.message.AuthException
at org.jboss.security.auth.message.config.JBossServerAuthConfig.getAuthContext(JBossServerAuthConfig.java:169)
at org.jboss.security.plugins.auth.JASPIServerAuthenticationManager.isValid(JASPIServerAuthenticationManager.java:99)
at org.wildfly.extension.undertow.security.jaspi.JASPICAuthenticationMechanism.authenticate(JASPICAuthenticationMechanism.java:123)
at io.undertow.security.impl.SecurityContextImpl$AuthAttempter.tranTISion(SecurityContextImpl.java:245)
at io.undertow.security.impl.SecurityContextImpl$AuthAttempter.access$100(SecurityContextImpl.java:231)
at io.undertow.security.impl.SecurityContextImpl.attemptAuthentication(SecurityContextImpl.java:125)
at io.undertow.security.impl.SecurityContextImpl.authTranTISion(SecurityContextImpl.java:99)
at io.undertow.security.impl.SecurityContextImpl.authenticate(SecurityContextImpl.java:92)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:55)
at io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHandler.java:33)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
My Wildfly standalone configuration that works is
<security-domain name="obbi-auth-id">
<authentication-jaspi>
<login-module-stack name="authid-loginmodule-stack">
<login-module code="com.obbi.domain.security.loginmodule.jwt.JWTLoginModule" flag="sufficient" module="com.obbi.domain.security">
<module-option name="expectedIssuer" value="CN=DI TIS signer"/>
<module-option name="expectedAudience" value="obbi"/>
<module-option name="allowedClockSkewInSeconds" value="30"/>
<module-option name="validateTokenSignature" value="false"/>
<module-option name="maxFutureValidityInMinutes" value="525600"/>
<module-option name="keyStoreFilePath" value="C:/wildfly-10.1.0.Final/standalone/configuration/obbi-token-keystore.jks"/>
<module-option name="keyStorePassword" value="pass123"/>
<module-option name="validateCertificate" value="false"/>
<module-option name="loadSystemPrincipals" value="true"/>
<module-option name="loadSystemPrincipalsEndpoint" value="https://pu.obbi.co.za:4266/di/services/v1/auth-id?page=0&size=1000&username=%s"/>
<module-option name="skipAllValidators" value="true"/>
</login-module>
<login-module code="com.obbi.domain.security.loginmodule.obbi.obbiLoginModule" flag="sufficient" module="com.obbi.domain.security">
<module-option name="keyStoreFilePath" value="C:/wildfly-10.1.0.Final/standalone/configuration/obbi-token-keystore.jks"/>
<module-option name="keyStorePassword" value="pass123"/>
<module-option name="validateCertificate" value="false"/>
<module-option name="validateTokenExpiry" value="false"/>
<module-option name="validateTokenSignature" value="false"/>
<module-option name="loadSystemPrincipals" value="true"/>
<module-option name="loadSystemPrincipalsEndpoint" value="https://pu.obbi.co.za:4266/di/services/v1/auth-id?page=0&size=1000&username=%s"/>
</login-module>
</login-module-stack>
<auth-module code="com.obbi.domain.security.JASPICServerAuthModule" flag="required" login-module-stack-ref="authid-loginmodule-stack"/>
</authentication-jaspi>
</security-domain>
My Wildfly swarm configuration that attempts to mimic the above Wildfly standalone configuration is:
private static SecurityFraction getSecurityFraction1() {
return new SecurityFraction()
.securityDomain("obbi-auth-id", sd -> {
sd.jaspiAuthentication(jaspi -> {
jaspi.loginModuleStack("authid-loginmodule-stack", stack -> {
stack.loginModule("com.obbi.domain.security.loginmodule.jwt.JWTLoginModule", value -> {
value.code("com.obbi.domain.security.loginmodule.jwt.JWTLoginModule")
.flag(Flag.SUFFICIENT)
.module("com.obbi.domain.security")
.moduleOption("expectedIssuer", "CN=DI TIS signer")
.moduleOption("expectedAudience", "obbi")
.moduleOption("allowedClockSkewInSeconds", "30")
.moduleOption("validateTokenSignature", "false")
.moduleOption("maxFutureValidityInMinutes", "525600")
.moduleOption("keyStoreFilePath", "C:/wildfly-10.1.0.Final/standalone/configuration/obbi-token-keystore.jks")
.moduleOption("keyStorePassword", "pass123")
.moduleOption("validateCertificate", "false")
.moduleOption("loadSystemPrincipals", "true")
.moduleOption("loadSystemPrincipalsEndpoint", "https://pu.obbi.co.za:4266/di/services/v1/auth-id?page=0&size=1000&username=%s")
.moduleOption("skipAllValidators", "true");
stack.loginModule("com.obbi.domain.security.loginmodule.obbi.obbiLoginModule", value1 -> {
value1.code("com.obbi.domain.security.loginmodule.obbi.obbiLoginModule")
.flag(Flag.SUFFICIENT)
.module("com.obbi.domain.security")
.moduleOption("keyStoreFilePath", "C:/wildfly-10.1.0.Final/standalone/configuration/obbi-token-keystore.jks")
.moduleOption("keyStorePassword", "pass123")
.moduleOption("validateCertificate", "false")
.moduleOption("validateTokenExpiry", "false")
.moduleOption("validateTokenSignature", "false")
.moduleOption("loadSystemPrincipals", "true")
.moduleOption("loadSystemPrincipalsEndpoint", "https://pu.obbi.co.za:4266/di/services/v1/auth-id?page=0&size=1000&username=%s");
});
});
});
jaspi.authModule("com.obbi.domain.security.JASPICServerAuthModule", authModule -> {
authModule.code("com.obbi.domain.security.JASPICServerAuthModule")
.flag(Flag.SUFFICIENT)
.loginModuleStackRef("authid-loginmodule-stack");
});
});
});
}
On my POM I have added all dependencies that correspond to the module dependencies from the normal wildfly
<dependency>
<groupId>org.picketbox</groupId>
<artifactId>picketbox</artifactId>
<version>4.9.6.Final</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.picketbox</groupId>
<artifactId>picketbox-infinispan</artifactId>
<version>4.9.6.Final</version>
</dependency>
<dependency>
<groupId>org.picketbox</groupId>
<artifactId>picketbox-commons</artifactId>
<version>1.0.0.final</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.security.auth.message</groupId>
<artifactId>jboss-jaspi-api_1.1_spec</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.security</groupId>
<artifactId>jbossxacml</artifactId>
<version>2.0.8.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
<artifactId>jboss-servlet-api_3.1_spec</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>3.3.0.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.xml.bind</groupId>
<artifactId>jboss-jaxb-api_2.2_spec</artifactId>
<version>1.0.4.Final</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.security.jacc</groupId>
<artifactId>jboss-jacc-api_1.5_spec</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.resource</groupId>
<artifactId>jboss-connector-api_1.7_spec</artifactId>
<version>1.0.0.Final</version>
</dependency>
I also added the corresponding modules on src/main/resources/modules
But I still get
2017-07-07 11:15:08,819 ERROR [org.jboss.security] (default task-3) PBOX00374: Error getting ServerAuthContext for authContextId default-host /Tiles and security domain obbi-auth-id: javax.security.auth.message.AuthException

Related

setting arquillian on Wildfly Preview 25: NoClassDefFoundError: org/jboss/threads/AsyncFuture

I am trying to run this test on Arquillian:
#ExtendWith(ArquillianExtension.class)
class ArquillianTest {
#Deployment
public static WebArchive createDeployment() {
return ShrinkWrap.create(WebArchive.class, "arquillian-test.war");
}
#Test
void execTest() {
fail("Always fails");
}
}
but it gets ignored and the whole execution just fails with:
INFO: JBoss Threads version 3.1.0.Final
Test ignored.
java.lang.NoClassDefFoundError: org/jboss/threads/AsyncFuture
at org.jboss.as.controller.client.ModelControllerClient$Factory.create(ModelControllerClient.java:609)
at org.jboss.as.arquillian.container.CommonDeployableContainer.start(CommonDeployableContainer.java:121)
at org.jboss.arquillian.container.impl.ContainerImpl.start(ContainerImpl.java:179)
I do not think I am missing anything in my deployment method, since there are no classes involved in this simple test, but I am new to Arquillian.
I found a bug report of the same error, but it was in 2014 and apparently resolved: https://lists.jboss.org/pipermail/jboss-jira/2014-April/256446.html
This is my pom.xml (relevant parts):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.7.0.Alpha10</version>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-container</artifactId>
<version>1.7.0.Alpha10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet-jakarta</artifactId>
<version>1.7.0.Alpha10</version>
</dependency>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<version>5.0.0.Alpha2</version>
<scope>test</scope>
</dependency>
and this is my arquillian.xml:
<arquillian
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://jboss.org/schema/arquillian"
xsi:schemaLocation="http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<defaultProtocol type="Servlet 5.0"/>
<container qualifier="wildfly" default="true">
<configuration>
<property name="jbossHome">C:\Users\sotan\Software\wildfly-preview-25.0.1.Final</property>
<property name="javaVmArguments">-Djboss.socket.binding.port-offset=100</property>
<property name="managementPort">10090</property>
</configuration>
</container>
</arquillian>

Unable To Read Messages From Kafka Topic Using Spark Streaming Kafka

The following code is meant to read messages from Kafka using Spark Submit.
The code executes and terminates without errors but reads no messages(The output file is empty and the log inside rdd.foreachPartition does not print).Please indicate what i am missing.
package hive;
import java.net.URI;
import java.util.*;
import org.apache.spark.SparkConf;
import org.apache.spark.TaskContext;
import org.apache.spark.api.java.*;
import org.apache.spark.api.java.function.*;
import org.apache.spark.streaming.Duration;
import org.apache.spark.streaming.Durations;
import org.apache.spark.streaming.StreamingContext;
import org.apache.spark.streaming.api.java.*;
import org.apache.spark.streaming.kafka010.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hadoop.fs.FileSystem;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.serialization.StringDeserializer;
import scala.Tuple2;
public class SparkKafka1 {
private static final Logger logger = LoggerFactory.getLogger(SparkKafka1.class);
public static void main(String[] args) {
Map<String, Object> kafkaParams = new HashMap<>();
kafkaParams.put("bootstrap.servers", "http://192.168.1.214:9092,http://192.168.1.214:9093");
kafkaParams.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
kafkaParams.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
//kafkaParams.put("group.id", "StreamingGroup");
kafkaParams.put("auto.offset.reset", "smallest");
kafkaParams.put("enable.auto.commit", false);
String user = "ankit";
String password = "noida#123";
Collection<String> topics = Arrays.asList("StreamingTopic");
SparkConf conf = new SparkConf().setMaster("spark://192.168.1.214:7077")
.set("spark.deploy.mode", "cluster").set("user",user)
.set("password",password).set("spark.driver.memory", "1g").set("fs.defaultFS", "hdfs://192.168.1.214:9000")
.setAppName("NetworkWordCount");
JavaStreamingContext streamingContext = new JavaStreamingContext(conf,new Duration(500));
JavaInputDStream<ConsumerRecord<String, String>> stream =
KafkaUtils.createDirectStream(
streamingContext,
LocationStrategies.PreferConsistent(),
ConsumerStrategies.<String, String>Subscribe(topics, kafkaParams)
);
stream.mapToPair(record -> new Tuple2<>(record.key(), record.value()));
stream.foreachRDD(rdd ->{
rdd.foreachPartition(item ->{
while (item.hasNext()) {
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>"+item.next());
logger.info("next item="+item.next());
}
});
});
logger.info("demo log="+stream.count());
stream.foreachRDD(rdd -> {
OffsetRange[] offsetRanges = ((HasOffsetRanges) rdd.rdd()).offsetRanges();
rdd.foreachPartition(consumerRecords -> {
OffsetRange o = offsetRanges[TaskContext.get().partitionId()];
System.out.println(
o.topic() + " " + o.partition() + " " + o.fromOffset() + " " + o.untilOffset());
rdd.saveAsTextFile("/home/ankit/work/warehouse/Manish.txt");
logger.info("tokenizing inside processElement method");
});
});
}
}
The following is the pom.xml:
<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>SparkTest</groupId>
<artifactId>SparkTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>SparkTest</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.scala-lang/scala-library -->
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.1.0</version>
<scope>provided </scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.1.0</version>
<scope>provided </scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-hive_2.11</artifactId>
<version>2.1.0</version>
<scope>provided </scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.11</artifactId>
<version>2.1.0</version>
<scope>provided </scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming-flume_2.11</artifactId>
<version>2.1.0</version>
<scope>provided </scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming-kafka-0-10_2.11</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-jdbc</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-auth</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<!-- or whatever version you use -->
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/LICENSE</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
<filter>
<artifact>org.apache.spark:spark-streaming-kafka-0-10_2.11</artifact>
<includes> <include>org/apache/spark/streaming/kafka010/**</include>
</includes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
The following command submits the job:
./spark-submit --class hive.SparkKafka1 --master spark://192.168.1.214:6066 --deploy-mode cluster --supervise --executor-memory 2G --total-executor-cores 4 hdfs://192.168.1.214:9000/input/SparkTest-0.0.1-SNAPSHOT.jar
i haven't run this program to see but it seems you are using kafka 0.10.2 and smallest is deprecated please use earliest instead.
You need add this two commands;
streamingContext.start();//start this app.
streamingContext.awaitTermination();//prevent this app close.
And I see you use http* value for bootstrap.servers. Delete the http prefix.
By the way, if you set spark conf in the code. It's useless set the same value in the command line.
Just check it. If the error exist as before. please let me know.

java.lang.NoSuchMethodError: scala.reflect.api.JavaUniverse.runtimeMirror

java.lang.NoSuchMethodError: scala.reflect.api.JavaUniverse.runtimeMirror(Ljava/lang/ClassLoader;)Lscala/reflect/api/JavaMirrors$JavaMirror;
at org.elasticsearch.spark.serialization.ReflectionUtils$.org$elasticsearch$spark$serialization$ReflectionUtils$$checkCaseClass(ReflectionUtils.scala:42)
at org.elasticsearch.spark.serialization.ReflectionUtils$$anonfun$checkCaseClassCache$1.apply(ReflectionUtils.scala:84)
it is seems scala version uncompatible,but i see the document of spark ,spark 2.10 and scala 2.11.8 is ok.
that is my pom.xml and that is just a test for spark to write to elasticsearch with es-hadoop,i have no idea how to solve this exception. `
<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>cn.jhTian</groupId>
<artifactId>sparkLink</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>My wonderfull scala app</description>
<inceptionYear>2015</inceptionYear>
<licenses>
<license>
<name>My License</name>
<url>http://....</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<encoding>UTF-8</encoding>
<scala.version>2.11.8</scala.version>
<scala.compat.version>2.11</scala.compat.version>
</properties>
<repositories>
<repository>
<id>ainemo</id>
<name>xylink</name>
<url>http://10.170.209.180:8081/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.6.4</version><!-- 2.64 -->
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.scala-lang</groupId>-->
<!--<artifactId>scala-compiler</artifactId>-->
<!--<version>${scala.version}</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-reflect</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<version>2.6.4</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.11</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming-kafka-0-8_2.11</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch-hadoop</artifactId>
<version>5.3.0 </version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.specs2</groupId>
<artifactId>specs2-core_${scala.compat.version}</artifactId>
<version>2.4.16</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.compat.version}</artifactId>
<version>2.2.4</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>'
this is my code
import org.apache.spark.{SparkConf, SparkContext}
import org.elasticsearch.spark._
/**
* Created by jhTian on 2017/4/19.
*/
object EsWrite {
def main(args: Array[String]) {
val sparkConf = new SparkConf()
.set("es.nodes", "1.1.1.1")
.set("es.port", "9200")
.set("es.index.auto.create", "true")
.setAppName("es-spark-demo")
val sc = new SparkContext(sparkConf)
val job1 = Job("C开发工程师","http://job.c.com","c公司","10000")
val job2 = Job("C++开发工程师","http://job.c++.com","c++公司","10000")
val job3 = Job("C#开发工程师","http://job.c#.com","c#公司","10000")
val job4 = Job("Java开发工程师","http://job.java.com","java公司","10000")
val job5 = Job("Scala开发工程师","http://job.scala.com","java公司","10000")
// val numbers = Map("one" -> 1, "two" -> 2, "three" -> 3)
// val airports = Map("arrival" -> "Otopeni", "SFO" -> "San Fran")
// val rdd=sc.makeRDD(Seq(numbers,airports))
val rdd=sc.makeRDD(Seq(job1,job2,job3,job4,job5))
rdd.saveToEs("job/info")
sc.stop()
}
}
case class Job(jobName:String, jobUrl:String, companyName:String, salary:String)'
Generally NoSuchMethodError implies the caller was compiled with a different version than was found on the classpath at runtime (or you have multiple versions on the CP).
In your case, I'd guess that es-hadoop is built against a different version of Scala I've not used maven in a little while but I think the command you need to get some useful into is mvn depdencyTree. Use the output to see which version of Scala es-hadoop is built with and then configure your project to use the same Scala version.
To get stable/reproducible builds I'd recommend using something like the maven-enforcer-plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<dependencyConvergence />
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
it can be annoying initially but once you have all your dependencies sorted you shouldn't get issues like this anymore.
use dependency like this
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch-spark-20_2.11</artifactId>
<version>5.2.2</version>
</dependency>
for spark 2.0 and scala 2.11

OSGI : CXF exception with Karaf JAX-RS: No resource methods have been found for resource

I am getting an exception while creating a simple CXF web service with OSGI and Karaf.
Would really appreciate any comments/suggestions for fix.
Here is the description of my project and steps I followed:
Downloaded the Apache Karaf-4.0.7
Run the “mvn clean install” in the command line with the path to my project
Started Karaf console, and run the following commands
feature:repo-add cxf 3.1.8
feature:install cxf/3.1.8
Interface:
public interface MyRestService {
String pingMe(String echo);
}
Implementation:
#Path("/")
public class MyRestServiceImpl implements MyRestService {
#GET
#Path("/{echo}")
#Produces(MediaType.APPLICATION_XML)
public String pingMe(#PathParam("echo") String echo) {
return "Knock Knock: " + echo + " !!";
}
}
OSGI blueprint.xml:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xmlns:cxf="http://cxf.apache.org/blueprint/core" xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://www.osgi.org/xmlns/blueprint-ext/v1.1.0 https://svn.apache.org/repos/asf/aries/tags/blueprint-0.3.1/blueprint-core/src/main/resources/org/apache/aries/blueprint/ext/blueprint-ext.xsd
http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd
http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
">
<cxf:bus id=”myBusId”>
<cxf:features>
<cxf:logging></cxf:logging>
</cxf:features>
</cxf:bus>
<jaxrs:server id="myRestService" address="/RestProject/SimpleRestCall">
<jaxrs:serviceBeans>
<ref component-id="myRestImpl" />
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="myRestImpl" class="com.rest.api.impl.MyRestServiceImpl" />
</blueprint>
Features.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"
name="restAPI">
<repository>mvn:org.apache.cxf.karaf/apache-cxf/3.1.8/xml/features</repository>
<feature name="test" description="simple test" version="1.0.0-SNAPSHOT">
<details>A Rest server</details>
<!-- CXF and depdendencies -->
<feature version="3.1.8">cxf-jaxrs</feature>
<!-- Jackson and dependencies -->
<bundle>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jsr339-api-2.0/2.6.0</bundle>
<bundle>mvn:com.github.fge/jackson-coreutils/1.8</bundle>
<bundle>mvn:com.fasterxml.jackson.core/jackson-core/2.7.4</bundle>
<bundle>mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/2.7.4</bundle>
<bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/2.7.4</bundle>
<bundle>mvn:com.fasterxml.jackson.core/jackson-databind/2.7.4</bundle>
<bundle>mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.7.4</bundle>
<bundle>mvn:com.github.fge/msg-simple/1.1</bundle>
<bundle>mvn:com.google.guava/guava/16.0.1</bundle>
<bundle>mvn:com.github.fge/btf/1.2</bundle>
<bundle>wrap:mvn:com.google.code.findbugs/jsr305/2.0.1</bundle>
<!-- The myRest Server -->
<bundle>mvn:com.rest.ebb.test/myRest/1.0.0-SNAPSHOT</bundle>
</feature>
</features>
Pom.xml:
<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>
<parent>
<groupId>com.rest.ebb.test</groupId>
<artifactId>myRest-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.rest.ebb.test</groupId>
<artifactId>myRest</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>MyRestServer</name>
<description>A server for test</description>
<url>.example.com</url>
<properties>
<cxf.version>3.1.8</cxf.version>
<skipTests>true</skipTests>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Activator>com.ebb.rest.Activator</Bundle-Activator>
<Embed-Dependency>!org.osgi.core,*</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Import-Package>
!com.google.protobuf,!com.google.protobuf.*,
!com.jcraft.*,
!com.ning.*,
!groovy.lang,
!javassist,
!lzma.*,
!net.jpountz.*,
!org.apache.*,
!org.bouncycastle.*,
!org.codehaus.*,
!org.eclipse.*,
!org.jboss.*,
!rx,
!sun.security.*,
!net.bytebuddy.*,
!org.HdrHistogram,
!org.slf4j.event,
!org.xerial.*,
!sun.reflect,
!sun.misc,
!sun.util.calendar,
!com.sun.jdi.*,
!jersey.repackaged.com.google.common.*,
!javax.servlet,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.24</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
<version>2.24</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
<type>bundle</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-multibindings</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf.version}</version>
</dependency>
</dependencies>
</project>
Errors:
Am not able to deploy osgi bundles in Karaf, and getting the following errors:
2017-01-06 11:00:39,340 | WARN | pool-9-thread-1 | ResourceUtils | 141 - org.apache.cxf.cxf-rt-frontend-jaxrs - 3.1.8 | No resource methods have been found for reso
class com.rest.api.impl.MyRestServiceImpl
2017-01-06 11:00:39,373 | ERROR | pool-9-thread-1 | AbstractJAXRSFactoryBean | 141 - org.apache.cxf.cxf-rt-frontend-jaxrs - 3.1.8 | No resource classes found
2017-01-06 11:00:39,375 | WARN | pool-9-thread-1 | BeanRecipe | 33 - org.apache.aries.blueprint.core - 1.6.2 | Object to be destroyed is not an instance of Unwra
edBeanHolder, type: null
2017-01-06 11:00:39,385 | ERROR | pool-9-thread-1 | BlueprintContainerImpl | 33 - org.apache.aries.blueprint.core - 1.6.2 | Unable to start blueprint container for bundle mvn:com.abb.ecc.my/myRest/1.0.0-SNAPSHOT
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to initialize bean myRestService
at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:738)[33:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:848)[33:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811)[33:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[33:org.apache.aries.blueprint.core:1.6.2]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_51]
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[33:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:255)[33:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:186)[33:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:724)[33:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:411)[33:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:276)[33:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:300)[33:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:269)[33:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:265)[33:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:255)[33:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[43:org.apache.aries.util:1.1.1]
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[43:org.apache.aries.util:1.1.1]
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[43:org.apache.aries.util:1.1.1]
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[43:org.apache.aries.util:1.1.1]
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[43:org.apache.aries.util:1.1.1]
at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:731)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:486)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4541)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2172)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1286)[10:org.apache.karaf.features.core:4.0.7]
at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:846)[10:org.apache.karaf.features.core:4.0.7]
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1176)[10:org.apache.karaf.features.core:4.0.7]
at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1074)[10:org.apache.karaf.features.core:4.0.7]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_51]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_51]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_51]
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:219)
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.init(JAXRSServerFactoryBean.java:142)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_51]
at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_51]
at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:299)[33:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:980)[33:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:736)[33:org.apache.aries.blueprint.core:1.6.2]
... 34 more
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: No resource classes found
at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:317)
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:159)
... 42 more
Try to put the jax-rs annotations on the service interface.
Another possible cause is that the annotation package is not imported. You block a lot of imports in your pom. Can you check without these definitions.
On my side your code works but I had to change the following things:
Remove the cxf:bus from the blueprint
Remove the #Path on the implementation class
Change the import section in the pom.xml
Implementation:
package com.mycompany.testcxf;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
public class MyRestServiceImpl implements MyRestService {
#Override
#GET
#Path("/{echo}")
#Produces(MediaType.APPLICATION_XML)
public String pingMe(#PathParam("echo") String echo) {
return "Knock Knock: " + echo + " !!";
}
}
pom.xml:
<osgi.export.package>{local-packages}</osgi.export.package>
<osgi.import.package>
com.mycompany.testcxf*,
*
</osgi.import.package>
and I only import the dependency:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>2.7.13</version>
</dependency>
Note I cannot test the CXF version 3 as you because my OSGI container is bound to this version. However this setup works perfectly for me, then it could be an issue with the CXF version and some incompatibilities with the embedded http server (Jetty?).
My setup is ServiceMix 5.1.4 with:
Version 2.3.9 of Apache Karaf
Version 2.13.3 of Camel
Version 2.7.13 of CXF

access a #SessionScoped bean from #WebService annotated EJB

One of my partners needs a SOAP interface and so I thought: lets move to an Application server. I chose Glassfish and it works great out of the box. There is just one thing I can not make it do: inject a #SessionScoped ManagedBean into the #Webservice annotated EJB.
The only way I can acces the EJB is over JNDI. I read about it here
My question is: is there a bug in Glassfish and it will work in a future version or should it work and I did something wrong.
I would like to be able to inject the property DataAccess session with the #EJB annotation but it does not work.
Below are all the files in the test project
Here is my WebService class:
#LocalBean
#Stateless
#WebService()
public class MySOAP implements Serializable {
private DataAccess session;
#WebMethod
public String getUsername() {
javax.naming.Context ctx = null;
try {
ctx = new javax.naming.InitialContext();
session = ( DataAccess ) ctx.lookup( "java:comp/env/DataAccess" );
return "user is " + session.getData();
} catch ( NamingException e ) {
e.printStackTrace();
}
return "exception occured";
}
}
The EJB I would like to inject:
public abstract class AbstractDataBean {
#Inject /* this just returns some text*/
private MySessionBean session;
public MySessionBean getSession() {
return session;
}
}
#LocalBean
#Stateless
public class DataAccess extends AbstractDataBean implements Serializable {
public String getData() {
return " data " + getSession();
}
#Override
public String toString() {
return getData();
}
}
#Named
#SessionScoped
public class MySessionBean implements Serializable {
static private int classCounter = 0;
private String user;
#PostConstruct
public void initMySessionBean( ) {
user = "Micha " + (++classCounter) ; //to check how many times it was called
}
public String getUser() {
return user;
}
public void setUser( String user ) {
this.user = user;
}
#Override
public String toString() {
return user;
}
}
I have a web.xml to define the JNDI:
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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/web-app_3_0.xsd"
version="3.0">
<session-config>
<session-timeout>1</session-timeout>
</session-config>
<ejb-local-ref>
<ejb-ref-name>DataAccess</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>ch.sertal.server.services.ejb.DataAccess</local>
</ejb-local-ref>
</web-app>
a sun-jaxws.xml to define the SOAP WebService:
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime' version='2.0'>
<endpoint
name='Mysoap'
implementation='ch.sertal.server.services.MySOAP'
url-pattern='/soap/Mysoap '/>
</endpoints>
and an empty beans.xml in order to have CDI functioning:
<?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>
and finally the pom.xml It is very long because I copied it from the existing project. But there should be nothing missing.
<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>ch.sertal</groupId>
<artifactId>VisionWeb</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>VisionWeb Jersey Webapp</name>
<build>
<finalName>VisionWeb</finalName>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<targetPath>META-INF</targetPath>
<includes>
<include>*.xml</include>
</includes>
</resource>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<targetPath>.</targetPath>
<includes>
<include>*.properties</include>
</includes>
</resource>
<resource>
<filtering>true</filtering>
<directory>src/main/resources/i18n</directory>
<targetPath>.</targetPath>
<includes>
<include>*.properties</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
<configuration>
<glassfishDirectory>/Development/glassfish3</glassfishDirectory>
<user>admin</user>
<adminPassword>U36c9AqVf5Ppk4DX</adminPassword>
<autoCreate>true</autoCreate>
<debug>true</debug>
<echo>false</echo>
<terse>true</terse>
<skip>false</skip>
<domain>
<host>${glassfish.host}</host>>
<name>domain1</name>
<adminPort>4848</adminPort>
<httpPort>9080</httpPort>
<httpsPort>8181</httpsPort>
<iiopPort>3700</iiopPort>
<jmsPort>7676</jmsPort>
</domain>
<components>
<component>
<name>VisionWeb</name>
<artifact>${project.build.directory}/${project.build.finalName}.war</artifact>
</component>
</components>
</configuration>
</plugin>
<!--surefire-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<configuration>
<parallel>test</parallel>
<threadCount>1</threadCount>
<groups>${test.groups}</groups>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-api</artifactId>
<version>1.1.Final</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
</dependency>
<!--jersey for RESTful services-->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>${jersey-version}</version>
</dependency>
<!--GlassFish libraries-->
<dependency>
<groupId>org.glassfish.distributions</groupId>
<artifactId>web-all</artifactId>
<version>10.0-build-20080430</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.embedded</groupId>
<artifactId>gf-embedded-api</artifactId>
<version>1.0-alpha-4</version>
<scope>test</scope>
</dependency>
<!--peristence & database-->
<!-- hsqldb -->
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.2.6</version>
</dependency>
<!-- persistence -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>${eclipselink.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>${eclipselink.jpa.version}</version>
<scope>compile</scope>
</dependency>
<!--SHIRO Authentication-->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>1.1.0</version>
</dependency>
<!--POI components-->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
</dependency>
<!--PDF Box-->
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>1.6.0</version>
</dependency>
<!--XML processing-->
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<!--testing-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<!--properties-->
<properties>
<jersey-version>1.8</jersey-version>
<jpa.unit>hsqldb.server</jpa.unit>
<test.jpa.unit>hsqldb.testr</test.jpa.unit>
<eclipselink.version>2.3.0</eclipselink.version>
<eclipselink.jpa.version>2.0.3</eclipselink.jpa.version>
</properties>
<!--profiles-->
<profiles>
<profile>
<id>mode.alpha.dev</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>environment</name>
<value>server</value>
</property>
</activation>
<properties>
<delete.files>true</delete.files>
<log.level>FINER</log.level>
<jersey.log.level>WARNING</jersey.log.level>
<jpa.log.level>INFO</jpa.log.level>
<test.groups>server-tests</test.groups>
<db.server.name>localhost</db.server.name>
<img-basedir>/opt/sertal/data</img-basedir>
<!--the url for tomcat 7 has changed. this is why /html has been appended to the below URL-->
<tomcat.manager>http://dev.sertal.net:7070/manager/html</tomcat.manager>
<tomcat.username>sertaladmin</tomcat.username>
<tomcat.password>29VeK0Ul</tomcat.password>
<tomcat.context>/VisionWeb</tomcat.context>
<test.groups>none</test.groups>
<!-- the date at the end marks the version of the data model -->
<hsqldb.data.path>/opt/sertal/data/hsqldb-dev-20110813</hsqldb.data.path>
</properties>
</profile>
</profiles>
<!--repositories and plugin repos-->
<repositories>
<!--glass fish-->
<repository>
<id>glassfish.java.net</id>
<name>GlassFish Maven Repository</name>
<url>http://download.java.net/maven/glassfish</url>
<layout>default</layout>
</repository>
<repository>
<id>m2.java.net</id>
<name>Java.net Maven 2 Repository</name>
<url>http://download.java.net/maven/2</url>
<layout>default</layout>
</repository>
<!--eclipse link-->
<repository>
<id>eclipselink.repo</id>
<name>eclipselink maven repository</name>
<url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>m2.java.net</id>
<name>Java.net Maven 2 Repository</name>
<url>http://download.java.net/maven/2</url>
<layout>default</layout>
</pluginRepository>
<pluginRepository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
Spare yourself the advice, I will not switch to JBoss :-)
The Session Scope isn't active for web derives per section 6.7.2 of JSR 299, it's not a bug. If you think about it, there isn't much point as the session doesn't really follow from one web service request to the next.
Also, you said you won't switch to JBoss, out of curiosity, what are your reasons?