I am learning about annotation processor. I have created a following test project.
Project structure:
annotation MessageManager:
package annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
#Target(ElementType.TYPE)
#Retention(RetentionPolicy.RUNTIME)
public #interface MessageManager {
public String messageBase() default "lang/res";
}
class MessageManagerProcessor:
package processor;
import annotation.MessageManager;
import com.google.auto.service.AutoService;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import java.io.File;
import java.io.IOException;
import java.util.*;
#AutoService(MessageManagerProcessor.class)
#SupportedSourceVersion(SourceVersion.RELEASE_8)
public class MessageManagerProcessor extends AbstractProcessor {
#Override
public Set<String> getSupportedAnnotationTypes() {
Set<String> annotations = new LinkedHashSet<>();
annotations.add(MessageManager.class.getCanonicalName());
System.out.println("im here");
return annotations;
}
#Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
for (Element element : roundEnv.getElementsAnnotatedWith(MessageManager.class)) {
System.out.println(element);
}
try {
File myObj = new File("filename.txt");
if (myObj.createNewFile()) {
System.out.println("File created: " + myObj.getName());
} else {
System.out.println("File already exists.");
}
} catch (IOException e) {
System.out.println("An error occurred.");
e.printStackTrace();
}
System.out.println("IM HEEEEEEERE");
return false;
}
}
MessageManagerImpl:
package test;
import annotation.MessageManager;
#MessageManager
public class MessageManagerImpl {
}
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>org.example</groupId>
<artifactId>SpringMessageManager</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<generatedSourcesDirectory>${project.build.directory}
/generated-sources/</generatedSourcesDirectory>
<annotationProcessors>
<annotationProcessor>
processor.MessageManagerProcessor
</annotationProcessor>
</annotationProcessors>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<compilerArgument>
-proc:none
</compilerArgument>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
<version>1.0-rc7</version>
</dependency>
</dependencies>
</project>
I am executing the project with mvn clean install but the annotation processor is not executed. Should I run the processor some other way? Also META-INF/services/javax.annotation.processing.Processor contains path to my processor processor.MessageManagerProcessor
Related
I am trying to do a POST to an API and I keep getting this error.
StandardWrapperValve[com.mycompany.timeedit.JAXRSConfiguration]: Servlet.service() for servlet com.mycompany.timeedit.JAXRSConfiguration threw exception
java.lang.NoSuchMethodError: org.glassfish.jersey.internal.LocalizationMessages.WARNING_PROPERTIES()Ljava/lang/String;
at org.glassfish.jersey.internal.config.SystemPropertiesConfigurationModel.getProperties(SystemPropertiesConfigurationModel.java:106)
at org.glassfish.jersey.internal.config.SystemPropertiesConfigurationProvider.getProperties(SystemPropertiesConfigurationProvider.java:29)
at org.glassfish.jersey.internal.config.ExternalPropertiesConfigurationFactory.readExternalPropertiesMap(ExternalPropertiesConfigurationFactory.java:55)
at org.glassfish.jersey.internal.config.ExternalPropertiesConfigurationFactory.configure(ExternalPropertiesConfigurationFactory.java:72)
at org.glassfish.jersey.internal.config.ExternalPropertiesConfigurationFeature.configure(ExternalPropertiesConfigurationFeature.java:26)
at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:677)
at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:611)
at org.glassfish.jersey.client.ClientConfig$State.configureMetaProviders(ClientConfig.java:387)
at org.glassfish.jersey.client.ClientConfig$State.initRuntime(ClientConfig.java:432)
at org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:317)
at org.glassfish.jersey.client.ClientConfig.getRuntime(ClientConfig.java:802)
at org.glassfish.jersey.client.ClientRequest.getConfiguration(ClientRequest.java:261)
at org.glassfish.jersey.client.JerseyInvocation.validateHttpMethodAndEntity(JerseyInvocation.java:119)
at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:88)
at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:84)
at org.glassfish.jersey.client.JerseyInvocation.<init>(JerseyInvocation.java:75)
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:421)
at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:327)
at TestAPI.Http_Connection.addToCanvas(Http_Connection.java:80)
at TestAPI.CanvasResource.getJson(CanvasResource.java:69)
at TestAPI.CanvasResource$Proxy$_$$_WeldClientProxy.getJson(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:469)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:391)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:80)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:253)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:232)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:679)
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:392)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:365)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:318)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1540)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:119)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:550)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:75)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:114)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:199)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:439)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:144)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:515)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
at java.lang.Thread.run(Thread.java:748)
Below is my webservice.
This service is accepting a string from a jquery-ajax method that I have made aswell. But that one seems to work fine so I am not going to paste it here.
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.lang.reflect.Type;
import java.net.ProtocolException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.Produces;
import javax.ws.rs.Consumes;
import javax.ws.rs.Path;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.POST;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
#Path("canvas")
#RequestScoped
public class CanvasResource {
#Context
private UriInfo context;
public CanvasResource() {
}
#POST
#Produces(MediaType.APPLICATION_JSON)
#Consumes(MediaType.APPLICATION_JSON)
public Response getJson(String schema ){
Gson g = new Gson();
Type userListType = new TypeToken<ArrayList<TimeEdit2>>(){}.getType();
ArrayList<TimeEdit2> userArray = g.fromJson(schema, userListType);
Http_Connection hc = new Http_Connection();//Http_Connection is the name of my class
try {
hc.addToCanvas(userArray);
}
catch (ProtocolException ex) {
System.out.println("1 !!"+ex);
Logger.getLogger(CanvasResource.class.getName()).log(Level.SEVERE, null, ex);
}
catch (IOException ex) {
System.out.println("2 !! "+ex);
Logger.getLogger(CanvasResource.class.getName()).log(Level.SEVERE, null, ex);
}
return Response
.ok("ping")
.build();
}
This is my class that I want to post to API.
I have tried to run the class just being a main-method and that works fine, but when I make it a method and send from my webservice to my class, that's when it breaks....
The program breaks on the "Response r = invocationB...."
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.ArrayList;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.glassfish.jersey.client.oauth2.OAuth2ClientSupport;
public class Http_Connection {
//public static void main(String[] args) throws MalformedURLException, ProtocolException, IOException
public void addToCanvas(ArrayList <TimeEdit2> timeEdit) throws MalformedURLException,
ProtocolException, IOException
{
String canvas_url = "https://ltu.instructure.com/api/v1/calendar_events.json";
String bearerToken = "<myToken>";
String context_code= "<myUser>";
URL url = new URL(canvas_url);
Form form = new Form();
form.param("calendar_event[context_code]", <myUser> );
form.param("calendar_event[title]", "testing");
form.param("calendar_event[start_at]", "2020-01-20T17:00:00Z");
form.param("calendar_event[end_at]", "2020-01-20T20:00:00Z");
form.param("calendar_event[description]","beskrivning");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
Client client = ClientBuilder.newClient().register(OAuth2ClientSupport.feature(bearerToken));
WebTarget target = client.target(canvas_url);
Invocation.Builder invocationB = target.request(MediaType.APPLICATION_JSON_TYPE);
Response r = invocationB.post(Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE));
This is my pom.
<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.mycompany</groupId>
<artifactId>TimeEdit</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>TimeEdit-1.0-SNAPSHOT</name>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
<jakartaee>8.0</jakartaee>
</properties>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>2.29.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.security</groupId>
<artifactId>oauth2-client</artifactId>
<version>2.29.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>${jakartaee}</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
My IDE is Apache Netbeans IDE 11.2
At the moment, Im using Glassfish 5.1 with Java EE 8 and JDK 1.8.
I have tried other version of glassfish, Java EE and JDK but nothing is working... Have had this error for a couple of weeks now...
This is my second try using Webservices and the first time that Im sending to API, so I really need help
We have created a karaf instance on which i am writing a sample bundle and successfully deployed.
I am getting Runtime Error which is not reproducible. Strange thing is after this error i am not able to login to karaf which is asking credentials to login to karaf. default password karaf is not working after this.
Caused by: java.lang.NoClassDefFoundError: Could not initialize class javax.xml.bind.DatatypeConverterImpl
at javax.xml.bind.DatatypeConverter.initConverter(DatatypeConverter.java:155)
at javax.xml.bind.DatatypeConverter.parseHexBinary(DatatypeConverter.java:371)
Env details: Karaf 4.1.4 OS RHEL 7.x
Code:
import java.util.Calendar;
import java.util.Map;
import javax.xml.bind.DatatypeConverter;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
#Component (name = "TestBinder", ds = true, immediate = true, metatype = false)
public class SampleBinder
{
private static final Logger LOG = LoggerFactory.getLogger(SampleBinder.class);
#Activate
public void activate(final Map<String, Object> properties)
{
// Testing DatatypeConverter.printHexBinary
String s2 = "Testing DatatypeConverter.printHexBinary";
String encodeds2 = DatatypeConverter.printHexBinary(s2.getBytes());
LOG.error(" >>>>>>> printHexBinary = " + encodeds2);
byte[] decodeds2 = DatatypeConverter.parseHexBinary(encodeds2);
LOG.error(" >>>>>>>> parseHexBinary - decodes2 = " + new String(decodeds2));
// Lexical representation of date time
LOG.error(DatatypeConverter.printDateTime(Calendar.getInstance()));
}
}
Pom.xml
<?xml version="1.0"?>
<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>
<parent>
<groupId>com.test.common</groupId>
<artifactId>compile</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../compile</relativePath>
</parent>
<artifactId>binder</artifactId>
<name>com.test.binder</name>
<packaging>bundle</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.Name}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Export-Package>com.test.java*</Export-Package>
<Import-Package>javax.xml.bind;version=!,
*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
I try to run project with mongodb but receive error:
Error creating bean with name 'IUserRepository': Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
Code of MongoConfig:
package MediaServerFacade.Public.Data.repository;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.core.MongoFactoryBean;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import com.mongodb.Mongo;
#Configuration
#EnableMongoRepositories
public class MongoConfig {
#Bean
public MongoFactoryBean mongo(){
MongoFactoryBean mongo = new MongoFactoryBean();
mongo.setHost("localhost");
return mongo;
}
#Bean
public MongoOperations mongoTemplate(Mongo mongo){
return new MongoTemplate(mongo, "LearnPlace");
}
}
Code of IUserRepository:
package MediaServerFacade.Public.Data.repository;
import java.util.UUID;
import org.springframework.data.mongodb.repository.MongoRepository;
import MediaServerFacade.Public.Data.User;
public interface IUserRepository extends MongoRepository<User, UUID>{
public User getById(UUID id);
public void update(User entity) ;
public void delete(UUID id) ;
public void insert(User entity) ;
public Iterable<User> getAll() ;
public long count();
}
User repository implementation:
package MediaServerFacade.Public.Data.repository;
import java.util.List;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import MediaServerFacade.Public.Data.User;
public class UserRepository implements IUserRepository{
#Autowired
private MongoOperations _mongoOperations;
#Override
public User getById(UUID id) {
return _mongoOperations.findById(id, User.class);
}
#Override
public void update(User entity) {
Update update = new Update();
_mongoOperations.updateFirst(Query.query(Criteria.where("_id").is(entity.getId())), update, User.class);
}
#Override
public void delete(UUID id) {
_mongoOperations.remove(Query.query(Criteria.where("_id").is(id)));
}
#Override
public void insert(User entity) {
_mongoOperations.insert(entity);
}
#Override
public Iterable<User> getAll() {
return _mongoOperations.findAll(User.class);
}
#Override
public long count() {
return _mongoOperations.getCollection("users").count();
}
#Override
public <S extends User> List<S> save(Iterable<S> entites) {
// TODO Auto-generated method stub
return null;
}
#Override
public List<User> findAll() {
// TODO Auto-generated method stub
return null;
}
#Override
public List<User> findAll(Sort sort) {
// TODO Auto-generated method stub
return null;
}
#Override
public Page<User> findAll(Pageable pageable) {
// TODO Auto-generated method stub
return null;
}
#Override
public <S extends User> S save(S entity) {
// TODO Auto-generated method stub
return null;
}
#Override
public User findOne(UUID id) {
// TODO Auto-generated method stub
return null;
}
#Override
public boolean exists(UUID id) {
// TODO Auto-generated method stub
return false;
}
#Override
public Iterable<User> findAll(Iterable<UUID> ids) {
// TODO Auto-generated method stub
return null;
}
#Override
public void delete(User entity) {
// TODO Auto-generated method stub
}
#Override
public void delete(Iterable<? extends User> entities) {
// TODO Auto-generated method stub
}
#Override
public void deleteAll() {
// TODO Auto-generated method stub
}
}
Content of 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>MediaServerFacade</groupId>
<artifactId>Public</artifactId>
<version>0.0.1-172186a1-66e2-4a96-acac-f35fa6fe587d</version>
<packaging>war</packaging>
<name>Public</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<version.spring.mongodb>1.4.0.RELEASE</version.spring.mongodb>
<demo.port>8083</demo.port>
<!-- Main class -->
<start-class>MediaServerFacade.Public.App</start-class>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.7.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.kurento</groupId>
<artifactId>kurento-client</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<tarLongFileMode>posix</tarLongFileMode>
<archive>
<manifest>
<mainClass>MediaServerFacade.Public.App</mainClass>
</manifest>
</archive>
<descriptor>src/assembly/bin.xml</descriptor>
<finalName>${project.artifactId}-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/mediaserver</path>
<update>true</update>
<ignorePackaging>true</ignorePackaging>
<url>http://localhost:8080/manager/text</url>
<username>admin</username>
<password>r06d0288</password>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>${start-class}</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptor>src/assembly/bin.xml</descriptor>
<finalName>${project.artifactId}-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<configuration>
<tasks>
<copy file="${project.build.directory}/target/${project.artifactId}-${project.version}-bin.zip" tofile="${project.build.directory}/target/${project.artifactId}-${project.version}.zip" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>${start-class}</mainClass>
<layout>ZIP</layout>
<classifier>exec</classifier>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>no-assembly</id>
</profile>
</profiles>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.4.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>4.3.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.kurento</groupId>
<artifactId>kurento-client</artifactId>
<version>6.6.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>1.4.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>0.32</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.4.0.RELEASE</version>
</dependency>
</dependencies>
</dependencyManagement>
<repositories>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>
And I try to use that repository as:
#Autowired
private IUserRepository repository;
My applicationContext.xml is empty. What else should I do to run project correctly?
I created a hello World Application in JavaFX and I will be using both QuitHandler and AboutHandler, I've noticed that 'About' and 'Preferences' menu Items are not shown in the menu :
How can I make it look like :
Also , QuitHandler is not executing the check save behaviour , here is the code of the javaFX Hello World.
package helloworld;
import com.apple.eawt.AppEvent;
import com.apple.eawt.QuitResponse;
import java.security.AccessControlException;
import java.util.Optional;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.SeparatorMenuItem;
import javafx.scene.control.TextArea;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
* Sample application.
* #author me
*/
public class HelloWorldApplication extends Application {
// constants --------------------------------------------------------------------------------
private static final Logger LOG = LogManager.getLogger();
/**
* Running on Mac platform.
*/
public static final boolean MAC;
static {
boolean mac = false;
try {
final String osName = System.getProperty("os.name");
LOG.debug("OS: {}", osName);
mac = osName != null && osName.toLowerCase().contains("mac");
} catch (AccessControlException ex) {
LOG.debug("Cannot determine OS");
}
MAC = mac;
}
// member variables -------------------------------------------------------------------------
private final Alert mAlert = new Alert(Alert.AlertType.CONFIRMATION);
// methods ----------------------------------------------------------------------------------
#Override
public void start(Stage pStage) {
final BorderPane root = new BorderPane();
final MenuBar menuBar = new MenuBar();
final Menu fileMenu = new Menu("_File");
menuBar.getMenus().add(fileMenu);
// Exit
boolean macQuitMenuItem = false;
if (MAC) {
final com.apple.eawt.Application application = com.apple.eawt.Application.getApplication();
try {
application.setQuitHandler(
(AppEvent.QuitEvent pEvt, QuitResponse pQuitResponse) -> Platform.runLater(
() -> exit(pQuitResponse::cancelQuit)
)
);
macQuitMenuItem = true;
// occurs when running as untrusted applet
} catch (AccessControlException ex) {
LOG.debug("Cannot listen for application quit");
}
}
if (!macQuitMenuItem) {
fileMenu.getItems().add(new SeparatorMenuItem());
final MenuItem exitMenuItem = new MenuItem("E_xit");
exitMenuItem.setOnAction(pEvt -> exit(() -> {}));
fileMenu.getItems().add(exitMenuItem);
}
root.setTop(menuBar);
root.setCenter(new TextArea("Hello, world!"));
final Scene scene = new Scene(root, 300, 250);
pStage.setTitle("Hello World!");
pStage.setScene(scene);
mAlert.initOwner(pStage);
mAlert.setTitle("Confirm Exit");
mAlert.setHeaderText("Look, a Confirmation Dialog");
mAlert.setContentText("Are you sure you want to exit?");
pStage.show();
}
public static void main(String[] pArgs) {launch(pArgs);}
public void exit() {exit(() -> {});}
public void exit(Runnable pAbortExitRunnable) {
LOG.info("Exit");
if (checkUnsavedChanges()) {
Platform.exit();
} else {
pAbortExitRunnable.run();
}
}
private boolean checkUnsavedChanges() {
final Optional<ButtonType> result = mAlert.showAndWait();
return result.isPresent() && result.get() == ButtonType.OK;
}
}
I want to know what is wrong with this code ?
Edit 1 : pom.xml to compile and test this code.
<?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>app</groupId>
<artifactId>helloworld</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.yuvimasory</groupId>
<artifactId>orange-extensions</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>initialize</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<index>true</index>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>helloworld.HelloWorldApplication</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Getting the OSX menu to work with a JavaFX application is tricky business. I can recommend you to have a look at https://github.com/codecentric/NSMenuFX
I've got an embeded OSGi framework (Felix).
I'm installing the basic bundles without problem, I can access the Felix webconsole.
But starting libra-commons-osgi-core-wsbundle-1.4.0.war gives me this error :
"org.osgi.framework.BundleException: Unable to resolve hu.libra.commnos.osgi.core.wsbundle [9](R 9.0): missing requirement [hu.libra.commnos.osgi.core.wsbundle [9](R 9.0)] osgi.wiring.package; (osgi.wiring.package=hu.libra.commnos.osgi.core.service) Unresolved requirements: [[hu.libra.commnos.osgi.core.wsbundle [9](R 9.0)] osgi.wiring.package; (osgi.wiring.package=hu.libra.commnos.osgi.core.service)]"
hu.libra.commnos.osgi.core.service bundle is installed and started (Felix webconsole shows bundle as Active and shows the registered service)
hu.libra.commnos.osgi.core.service\META-INF\MANIFEST.MF contains
Export-Package: hu.libra.commons.osgi.core.service;version="1.4.0";uses:="org.osgi.framework"
hu.libra.commnos.osgi.core.wsbundle\META-INF\MANIFEST.MF contains
Import-Package: org.osgi.framework;version="[1.8,2)",javax.servlet,jav
ax.servlet.http,hu.libra.commnos.osgi.core.service
What is the problem? Thank You!
My embeded Framework :
.java
package hu.libra.commons.osgi.core;
import static org.osgi.framework.Constants.FRAGMENT_HOST;
import static org.osgi.framework.Constants.FRAMEWORK_STORAGE_CLEAN;
import static org.osgi.framework.Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.ServiceLoader;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.launch.Framework;
import org.osgi.framework.launch.FrameworkFactory;
public class LibraOSGiCore {
//LOGGING
private static final Logger log = Logger.getLogger(LibraOSGiCore.class);
//FIELDS
private static final Framework framework;
private static final List<Bundle> bundleList = new LinkedList<>();
//CONSTRUCTORS
static {
try {
//log4j
PropertyConfigurator.configure("log4j.properties");
//config
Map<String, String> config = new HashMap<>();
config.put(FRAMEWORK_STORAGE_CLEAN, FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT);
setConfig(config);
//framework
FrameworkFactory frameworkFactory = ServiceLoader.load(FrameworkFactory.class).iterator().next();
framework = frameworkFactory.newFramework(config);
framework.start();
}
catch (RuntimeException | BundleException e) {
log.fatal(e, e);
throw new RuntimeException(e);
}
}
//MAIN
public static void main(
String[] args) {
try {
try {
installBundles();
startBundles();
}
catch (IOException | BundleException e) {
log.fatal(e, e);
throw new RuntimeException(e);
}
try {
framework.waitForStop(0);
}
catch (InterruptedException e) {
return;
}
}
finally {
System.exit(0);
}
}
//METHODS - private
private static void setConfig(
Map<String, String> config) {
//TODO use config.xml
config.put("org.osgi.service.http.port", "8181");
//config.put("felix.webconsole.username", "...");
//config.put("felix.webconsole.password", "...");
}
private static Bundle installBundle(
String name,
String postfix,
String ext)
throws IOException,
BundleException {
if (postfix != null) {
postfix = "-" + postfix;
}
else {
postfix = "";
}
String resourceName = name + postfix + "." + ext;
InputStream is;
File file = new File(resourceName);
if (file.exists()) {
is = new FileInputStream(file);
}
else {
is = LibraOSGiCore.class.getResourceAsStream(resourceName);
}
try(InputStream xis = is) {
Bundle bundle = framework.getBundleContext().installBundle("file:/" + name + "." + ext, is);
return bundle;
}
}
private static void installBundles()
throws IOException,
BundleException {
//Felix basic bundles
bundleList.add(installBundle("org.apache.felix.log", "1.0.1", "jar"));
bundleList.add(installBundle("org.apache.felix.configadmin", "1.8.12", "jar"));
bundleList.add(installBundle("org.apache.felix.eventadmin", "1.4.8", "jar"));
bundleList.add(installBundle("org.apache.felix.http.servlet-api", "1.1.2", "jar"));
bundleList.add(installBundle("org.apache.felix.http.api", "3.0.0", "jar"));
//Felix Jetty bundle
bundleList.add(installBundle("org.apache.felix.http.jetty", "3.4.0", "jar"));
//Felix Webconsole bundle
bundleList.add(installBundle("org.apache.felix.webconsole", "4.2.16-all", "jar"));
//Core bundles
bundleList.add(installBundle("libra-commons-osgi-core-service", "1.4.0", "jar"));
bundleList.add(installBundle("libra-commons-osgi-core-wsbundle", "1.4.0", "war"));
}
private static void startBundles()
throws BundleException {
for (Bundle bundle : bundleList) {
if (bundle.getHeaders().get(FRAGMENT_HOST) != null)
continue;
bundle.start();
}
}
}
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">
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modelVersion>4.0.0</modelVersion>
<groupId>hu.libra.commons</groupId>
<artifactId>libra-commons-osgi-core</artifactId>
<version>1.4.0</version>
<name>Libra Common OSGi Core</name>
<packaging>bundle</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<instructions>
<Bundle-SymbolicName>hu.libra.commnos.osgi.core</Bundle-SymbolicName>
</instructions>
</configuration>
</execution>
</executions>
<configuration>
<supportedProjectTypes>
<supportedProjectType>jar</supportedProjectType>
<supportedProjectType>bundle</supportedProjectType>
</supportedProjectTypes>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
<dependencies>
<!-- log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
<!-- OSGi -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>5.6.1</version>
</dependency>
</dependencies>
</project>
hu.libra.commnos.osgi.core.service 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">
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modelVersion>4.0.0</modelVersion>
<groupId>hu.libra.commons</groupId>
<artifactId>libra-commons-osgi-core-service</artifactId>
<version>1.4.0</version>
<name>Libra Common OSGi Core Service Bundle</name>
<packaging>bundle</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<supportedProjectTypes>
<supportedProjectType>jar</supportedProjectType>
<supportedProjectType>bundle</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Bundle-SymbolicName>hu.libra.commons.osgi.core.service</Bundle-SymbolicName>
<Bundle-Activator>hu.libra.commons.osgi.core.service.Activator</Bundle-Activator>
<Export-Package>hu.libra.commons.osgi.core.service</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- OSGi -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
hu.libra.commnos.osgi.core.wsbundle 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">
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modelVersion>4.0.0</modelVersion>
<groupId>hu.libra.commons</groupId>
<artifactId>libra-commons-osgi-core-wsbundle</artifactId>
<version>1.4.0</version>
<name>Libra Common OSGi Core Webservice Bundle</name>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<supportedProjectTypes>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Bundle-SymbolicName>hu.libra.commnos.osgi.core.wsbundle</Bundle-SymbolicName>
<Bundle-Activator>hu.libra.commons.osgi.core.wsbundle.Activator</Bundle-Activator>
<Private-Package>hu.libra.commons.osgi.core.wsbundle</Private-Package>
<Import-Package>
org.osgi.framework,
javax.servlet,
javax.servlet.http,
javax.servlet.*,
javax.servlet.jsp.*,
javax.servlet.jsp.jstl.*,
hu.libra.commnos.osgi.core.service
</Import-Package>
<DynamicImport-Package>
javax.*,
org.xml.sax,
org.xml.sax.*,
org.w3c.*
</DynamicImport-Package>
<Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath>
<Embed-Directory>WEB-INF/lib</Embed-Directory>
<Web-ContextPath>/libraosgicore</Web-ContextPath>
<Webapp-Context>/libraosgicore</Webapp-Context>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- OSGi -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<!-- Libra OSGi Core Service -->
<dependency>
<groupId>hu.libra.commons</groupId>
<artifactId>libra-commons-osgi-core-service</artifactId>
<version>1.4.0</version>
<scope>provided</scope>
</dependency>
<!-- WS -->
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.10</version>
</dependency>
</dependencies>
</project>