What I want to do is to init the KieSession in Spring when the tomcat start. And The KieSession will dynamicly change when the rules are changed and redeployed as jar in the kie-workbench.
I downloaded the kie-drools-wb-6.3.0.Final-tomcat7.war and deployed it in a linux machine.I can use the following code to test:
public class TestScanMaven {
public static void main(String[] args) {
KieServices kieServices = KieServices.Factory.get();
try {
ReleaseId releaseId = kieServices.newReleaseId("com.test","epay-risk2", "LATEST");
KieContainer kieContainer = kieServices.newKieContainer(releaseId);
KieScanner kieScanner = kieServices.newKieScanner(kieContainer);
kieScanner.start(20000L);
Scanner scanner = new Scanner(System.in);
while (true) {
runRule(kieContainer);
System.out.println("Press enter in order to run the test again....");
scanner.nextLine();
}
} catch (Exception e) {
System.out
.println("Exception thrown while constructing InputStream");
System.out.println(e.getMessage());
}
}
private static void runRule(KieContainer kieContainer) {
KieSession kSession = kieContainer.newKieSession("defaultKieSession");
// go !
Message message = new Message();
message.setMessage("Hello World");
message.setStatus(Message.HELLO);
kSession.insert(message);
kSession.fireAllRules();
}
}
this code work quite well。
But when I change to use the following code in spring,It throw exception
#PostConstruct
public void init(){
KieServices kieServices = KieServices.Factory.get();
ReleaseId releaseId = kieServices.newReleaseId("com.test","epay-risk2", "LATEST");
KieContainer kieContainer = kieServices.newKieContainer(releaseId);
kSession = kieContainer.newKieSession("defaultKieSession");
kSession.setGlobal("riskRecordService", riskRecordService);
KieScanner kieScanner = kieServices.newKieScanner(kieContainer);
kieScanner.start(20000L);
}
the Exception thrown:
Caused by: java.lang.NoSuchMethodError: com.google.inject.Binder.bindListener(Lcom/google/inject/matcher/Matcher;[Lcom/google/inject/spi/ProvisionListener;)V
at org.eclipse.sisu.plexus.PlexusBindingModule.configure(PlexusBindingModule.java:75)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
at com.google.inject.spi.Elements.getElements(Elements.java:101)
at com.google.inject.spi.Elements.getElements(Elements.java:92)
at org.eclipse.sisu.wire.WireModule.configure(WireModule.java:75)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
at com.google.inject.spi.Elements.getElements(Elements.java:101)
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
at com.google.inject.Guice.createInjector(Guice.java:95)
at com.google.inject.Guice.createInjector(Guice.java:72)
at com.google.inject.Guice.createInjector(Guice.java:62)
at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:477)
at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:203)
at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:167)
at org.kie.scanner.embedder.MavenEmbedderUtils.buildPlexusContainer(MavenEmbedderUtils.java:166)
at org.kie.scanner.embedder.MavenEmbedderUtils.buildPlexusContainer(MavenEmbedderUtils.java:140)
at org.kie.scanner.embedder.PlexusComponentProvider.<init>(PlexusComponentProvider.java:37)
at org.kie.scanner.embedder.MavenEmbedderUtils.buildComponentProvider(MavenEmbedderUtils.java:56)
at org.kie.scanner.embedder.MavenEmbedder.<init>(MavenEmbedder.java:75)
at org.kie.scanner.embedder.MavenEmbedder.<init>(MavenEmbedder.java:69)
at org.kie.scanner.embedder.MavenProjectLoader.parseMavenPom(MavenProjectLoader.java:55)
at org.kie.scanner.embedder.MavenProjectLoader.parseMavenPom(MavenProjectLoader.java:49)
at org.kie.scanner.MavenPomModelGenerator.parse(MavenPomModelGenerator.java:36)
at org.drools.compiler.kproject.xml.PomModel$Parser.parse(PomModel.java:89)
at org.drools.compiler.kie.builder.impl.AbstractKieModule.getPomModel(AbstractKieModule.java:395)
at org.drools.compiler.kie.builder.impl.AbstractKieModule.getJarDependencies(AbstractKieModule.java:126)
at org.kie.scanner.MavenClassLoaderResolver.getClassLoader(MavenClassLoaderResolver.java:64)
at org.drools.compiler.kie.builder.impl.KieModuleKieProject.<init>(KieModuleKieProject.java:68)
at org.drools.compiler.kie.builder.impl.KieModuleKieProject.<init>(KieModuleKieProject.java:56)
at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieModule(KieBuilderImpl.java:221)
at org.kie.scanner.KieRepositoryScannerImpl.build(KieRepositoryScannerImpl.java:220)
at org.kie.scanner.KieRepositoryScannerImpl.buildArtifact(KieRepositoryScannerImpl.java:170)
at org.kie.scanner.KieRepositoryScannerImpl.loadArtifact(KieRepositoryScannerImpl.java:126)
at org.kie.scanner.KieRepositoryScannerImpl.loadArtifact(KieRepositoryScannerImpl.java:121)
at org.drools.compiler.kie.builder.impl.KieRepositoryImpl.loadKieModuleFromMavenRepo(KieRepositoryImpl.java:129)
at org.drools.compiler.kie.builder.impl.KieRepositoryImpl.getKieModule(KieRepositoryImpl.java:115)
at org.drools.compiler.kie.builder.impl.KieRepositoryImpl.getKieModule(KieRepositoryImpl.java:92)
at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:115)
at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:111)
at com.test.risk.service.risk.epay.rule.impl.RiskKieServiceImpl.init(RiskKieServiceImpl.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:344)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:295)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:130)
The settings in my maven home is:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>guvnor-m2-repo</id>
<username>drools_tomcat</username>
<password>XXXXXX</password>
<configuration>
<wagonProvider>httpclient</wagonProvider>
<httpConfiguration>
<all>
<usePreemptive>true</usePreemptive>
</all>
</httpConfiguration>
</configuration>
</server>
</servers>
<profiles>
<profile>
<id>guvnor-m2-repo</id>
<repositories>
<repository>
<id>guvnor-m2-repo</id>
<name>BRMS Repository</name>
<url>http://xxx.xxx.xxx.xxx:8082/guvnor/maven2/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>guvnor-m2-repo</activeProfile>
</activeProfiles>
</settings>
Related
I have that error when i execute my getCustomers() method in Postman. The problem is that for some reason executes the method getOrder() isntead of just getCustomers(), if i let it uncommented. I have searched about this issue but i was not able to find anything that worked in my case. Any help will be very apreciate.
Error:
org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization.
[[FATAL] A HTTP GET method, public java.lang.String com.something.JerseyProjectConnectionToDB.App.getOrder(java.lang.String), should not consume any form parameter.; source='ResourceMethod{httpMethod=GET, consumedTypes=[], producedTypes=[application/json], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=class com.something.JerseyProjectConnectionToDB.App, handlerConstructors=[org.glassfish.jersey.server.model.HandlerConstructor#3ea75b05]}, definitionMethod=public java.lang.String com.something.JerseyProjectConnectionToDB.App.getOrder(java.lang.String), parameters=[Parameter [type=class java.lang.String, source=date, defaultValue=null]], responseType=class java.lang.String}, nameBindings=[]}']
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:371)
at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:293)
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.processWithException(Errors.java:232)
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:292)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:259)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:311)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:154)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:346)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1134)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1089)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:983)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4902)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5206)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:843)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:772)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:342)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)
App.java
#Path("/app")
public class App {
#GET
#Path("/getCustomers")
#Produces(MediaType.APPLICATION_JSON)
public List<CustomerPOJO> getCustomers() {
return CustomerDAO.getAllCustomers();
}
/*
#GET
#Path("/getOrder")
#Produces(MediaType.APPLICATION_JSON)
public String getOrder(#FormParam("date") String date){
return CustomerDAO.getOrder(date);
}
*/
}
CustomerDAO.java
public class CustomerDAO {
public static List<CustomerPOJO> getAllCustomers(){
List<CustomerPOJO> customerList = new ArrayList<CustomerPOJO>();
CustomerPOJO customer = null;
try(Connection conn = DBConnection.createNewDBconnection()){
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("Select * from customer");
while(rs.next()) {
customer = new CustomerPOJO();
customer.setCustomer_code(rs.getInt(1));
customer.setCustomer_name(rs.getString(2));
customer.setCustomer_adress(rs.getString(3));
customer.setCustomer_age(rs.getInt(4));
customerList.add(customer);
}
rs.close();
stmt.close();
} catch (SQLException e) {
logger.error(e);
}
return customerList;
}
public static String getOrder(String pattern){
List<OrderShipmentPOJO> orderList = new ArrayList<OrderShipmentPOJO>();
OrderShipmentPOJO order = null;
ObjectMapper objectMapper = new ObjectMapper();
String orderListToString = null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat ("yyyy-MM-dd");
Date date = null;
try(Connection conn = DBConnection.createNewDBconnection()){
date = simpleDateFormat.parse(pattern);
logger.info(date);
if(CheckDate.execute(date)) {
String query = "select customer.customer_name, product.product_title, order_shipment.order_date\r\n"
+ "from customer, product, order_shipment, order_shipment_has_product\r\n"
+ "where order_shipment.order_code = order_shipment_has_product.order_code \r\n"
+ "and (order_shipment_has_product.product_code = product.product_code\r\n"
+ "and (order_shipment.customer_code = customer.customer_code\r\n"
+ "and (date(order_shipment.order_date) = '?')))";
PreparedStatement ps = conn.prepareStatement(query);
ps.setDate(1, (java.sql.Date) date);
ResultSet rs = ps.executeQuery();
while(rs.next()) {
order = new OrderShipmentPOJO();
order.setCustomer_name(rs.getString(1));
order.setProduct_title(rs.getString(2));
order.setOrder_date(rs.getDate(3));
orderList.add(order);
}
rs.close();
} else {
return "You have inserted a date that dont exist, try again";
}
orderListToString = objectMapper.writeValueAsString(orderList);
} catch (SQLException e) {
logger.error(e);
} catch (ParseException e) {
logger.error(e);
return "Unparseable using " + date + ". Use a format like this one: 2020-11-30";
} catch (JsonProcessingException e) {
logger.error(e);
}
return orderListToString;
}
}
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- This web.xml file is not required when using Servlet 3.0 container,
see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html -->
<web-app version="2.5" 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_2_5.xsd">
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.something.JerseyProjectConnectionToDB</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
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>
<groupId>com.something</groupId>
<artifactId>JerseyProjectConnectionToDB</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>JerseyProjectConnectionToDB</name>
<build>
<finalName>JerseyProjectConnectionToDB</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.24</version>
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.29.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>2.29.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.29.1</version>
</dependency>
</dependencies>
</project>
I have found that the problem was the method getOrder(), so i commented it and now works. My problem now is that when i let that method uncommented and i call to other methods, the code executes the method getOrder() instead of the method i called, what could be the problem?
Thank you for your help and time ^^
I have found the solution to this problem. The method #GET dont accept #FormParam, you just need to use #QueryParam or #PathParam. More info: https://stackoverflow.com/a/29789846/15633133
I have setup a project trying to run standard "ExclamationTopology" on the in-memory version of the storm, triggered from the IntelliJ IDE. There goes my POM.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>storm</groupId>
<artifactId>sample</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hbase.version>0.98.4-hadoop2</hbase.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-client</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-server</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>central</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>clojars</id>
<url>https://clojars.org/repo/</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>test.ExclamationTopology</mainClass>
<arguments>-local</arguments>
</configuration>
</plugin>
</plugins>
</build>
</project>
Along with the sample source code of my topology:
public class ExclamationTopology extends ConfigurableTopology {
public static class ExclamationBolt extends BaseRichBolt {
OutputCollector _collector;
#Override
public void prepare(Map<String, Object> conf, TopologyContext context, OutputCollector collector) {
_collector = collector;
}
#Override
public void execute(Tuple tuple) {
_collector.emit(tuple, new Values(tuple.getString(0) + "!!!"));
_collector.ack(tuple);
}
#Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
declarer.declare(new Fields("word"));
}
}
public static void main(String[] args) throws Exception {
ConfigurableTopology.start(new ExclamationTopology(), args);
}
protected int run(String[] args) {
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("word", new TestWordSpout(), 10);
builder.setBolt("exclaim1", new ExclamationBolt(), 3).shuffleGrouping("word");
builder.setBolt("exclaim2", new ExclamationBolt(), 2).shuffleGrouping("exclaim1");
conf.setDebug(true);
String topologyName = "test";
conf.setNumWorkers(3);
if (args != null && args.length > 0) {
topologyName = args[0];
}
return submit(topologyName, conf, builder);
}
}
In order to be able to run the topology locally from within my IDE via Maven I included exec maven plugin. Then I use the following mvn command to run the application:
exec:java -Dexec.args=-local
However, I do get the following exception:
java.lang.RuntimeException: java.lang.RuntimeException: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused: connect
at org.apache.storm.security.auth.ThriftClient.reconnect(ThriftClient.java:110) ~[storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.security.auth.ThriftClient.<init>(ThriftClient.java:70) ~[storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.utils.NimbusClient.<init>(NimbusClient.java:158) ~[storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.utils.NimbusClient.getConfiguredClientAs(NimbusClient.java:113) [storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.utils.NimbusClient.getConfiguredClient(NimbusClient.java:83) [storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.blobstore.NimbusBlobStore.prepare(NimbusBlobStore.java:268) [storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.StormSubmitter.getListOfKeysFromBlobStore(StormSubmitter.java:599) [storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.StormSubmitter.validateConfs(StormSubmitter.java:565) [storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.StormSubmitter.submitTopologyAs(StormSubmitter.java:211) [storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.StormSubmitter.submitTopology(StormSubmitter.java:391) [storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.StormSubmitter.submitTopology(StormSubmitter.java:163) [storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.topology.ConfigurableTopology.submit(ConfigurableTopology.java:94) [storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at test.ExclamationTopology.run(ExclamationTopology.java:69) [classes/:?]
at org.apache.storm.topology.ConfigurableTopology.start(ConfigurableTopology.java:70) [storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at test.ExclamationTopology.main(ExclamationTopology.java:47) [classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112]
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297) [exec-maven-plugin-1.2.1.jar:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_112]
Caused by: java.lang.RuntimeException: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused: connect
at org.apache.storm.security.auth.TBackoffConnect.retryNext(TBackoffConnect.java:64) ~[storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.security.auth.TBackoffConnect.doConnectWithRetry(TBackoffConnect.java:56) ~[storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.security.auth.ThriftClient.reconnect(ThriftClient.java:102) ~[storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
... 20 more
Caused by: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused: connect
at org.apache.thrift.transport.TSocket.open(TSocket.java:226) ~[libthrift-0.9.3.jar:0.9.3]
at org.apache.thrift.transport.TFramedTransport.open(TFramedTransport.java:81) ~[libthrift-0.9.3.jar:0.9.3]
at org.apache.storm.security.auth.SimpleTransportPlugin.connect(SimpleTransportPlugin.java:105) ~[storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.security.auth.TBackoffConnect.doConnectWithRetry(TBackoffConnect.java:53) ~[storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.security.auth.ThriftClient.reconnect(ThriftClient.java:102) ~[storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
... 20 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method) ~[?:1.8.0_112]
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) ~[?:1.8.0_112]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:1.8.0_112]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:1.8.0_112]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:1.8.0_112]
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[?:1.8.0_112]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:1.8.0_112]
at java.net.Socket.connect(Socket.java:589) ~[?:1.8.0_112]
at org.apache.thrift.transport.TSocket.open(TSocket.java:221) ~[libthrift-0.9.3.jar:0.9.3]
at org.apache.thrift.transport.TFramedTransport.open(TFramedTransport.java:81) ~[libthrift-0.9.3.jar:0.9.3]
at org.apache.storm.security.auth.SimpleTransportPlugin.connect(SimpleTransportPlugin.java:105) ~[storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.security.auth.TBackoffConnect.doConnectWithRetry(TBackoffConnect.java:53) ~[storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.storm.security.auth.ThriftClient.reconnect(ThriftClient.java:102) ~[storm-client-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
... 20 more
org.apache.storm.utils.NimbusLeaderNotFoundException: Could not find leader nimbus from seed hosts [localhost]. Did you specify a valid list of nimbus hosts for config nimbus.seeds?
at org.apache.storm.utils.NimbusClient.getConfiguredClientAs(NimbusClient.java:141)
at org.apache.storm.utils.NimbusClient.getConfiguredClient(NimbusClient.java:83)
at org.apache.storm.blobstore.NimbusBlobStore.prepare(NimbusBlobStore.java:268)
at org.apache.storm.StormSubmitter.getListOfKeysFromBlobStore(StormSubmitter.java:599)
at org.apache.storm.StormSubmitter.validateConfs(StormSubmitter.java:565)
The README for storm-starter is out of date. The examples don't run locally anymore, because ConfigurableTopology was changed to not support this here https://github.com/apache/storm/commit/b254ede46a25466749cd48ebd4bcb56dd791ec4a#diff-de7eab133732a8b5b97be6aa7328e392R92.
If you want to run it locally, you can use https://github.com/apache/storm/blob/master/storm-server/src/main/java/org/apache/storm/LocalCluster.java, which should replace the call to submit in your topology code. Otherwise you'll have to set up a local Storm instance to run the topology (which is very easy, see https://storm.apache.org/releases/2.0.0-SNAPSHOT/Setting-up-a-Storm-cluster.html. The storm-starter README tells you how to submit to an installed cluster).
Edit:
If you want to run it locally, another option would probably be to use the "storm local" command.
PS E:\apache-storm-2.0.0-SNAPSHOT\bin> ./storm help local
Syntax: [storm local topology-jar-path class ...]
Runs the main method of class with the specified arguments but pointing to a local cluster
The storm jars and configs in ~/.storm are put on the classpath.
The process is configured so that StormSubmitter
(http://storm.apache.org/releases/current/javadocs/org/apache/storm/StormSubmitter.html)
and others will interact with a local cluster instead of the one configured by default.
Most options should work just like with the storm jar command.
local also adds in the option --local-ttl which sets the number of seconds the
local cluster will run for before it shuts down.
--java-debug lets you turn on java debugging and set the parameters passed to -agentlib:jdwp on the JDK
--java-debug transport=dt_socket,address=localhost:8000
will open up a debugging server on port 8000.
The documentation for local mode has been updated in the Storm repo, but hasn't yet made it to the website. See https://github.com/apache/storm/blob/master/docs/Local-mode.md for the new docs.
Just created a quick and simple 'sandbox' application to test out Spring-boot.
I'm getting the following error when attempting to run it -regardless of the versioning (tried to drop down to 1.4.7.RELEASE as well).
Also, almost all of the answers I've read on other posts seems to indicate that there's a mismatch in the versions somewhere -but how is that possible in this case? I was attempting to use the parent to avoid versioning conflicts to begin with.
POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sandbox.springboot</groupId>
<artifactId>SpringBootSandbox</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SpringBootSandbox</name>
<packaging>war</packaging>
<properties>
<java.version>1.8</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
ApplicationRunner
#SpringBootApplication//(scanBasePackages = "com.sandbox")
#ComponentScan("com.sandbox")
public class ApplicationRunner extends SpringBootServletInitializer {
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(ApplicationRunner.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(ApplicationRunner.class, args);
}
}
Exception
2017-10-20 10:48:42.483 WARN 8828 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Around
2017-10-20 10:48:42.485 ERROR 8828 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor' threw an exception
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2805c96b: startup date [Fri Oct 20 10:48:42 EDT 2017]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:414) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:556) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:372) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1187) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1176) [spring-boot-1.4.7.RELEASE.jar:1.4.7.RELEASE]
at com.sandbox.configuration.ApplicationRunner.main(ApplicationRunner.java:31) [classes/:na]
After some playing around... and checking other Spring boot setups, I adjusted my ApplicationRunner as follows, and it seems to run without error now. I'm still looking into what the difference is between these approaches and why this one works.
#SpringBootApplication
#ComponentScan("com.sandbox")
public class BootApplicationRunner implements ApplicationRunner {
public static void main(String[] args) throws Exception {
SpringApplication.run(BootApplicationRunner.class, args);
}
public void run(ApplicationArguments args) throws Exception {
}
}
I have built a project with spring boot and mybatis, it run in eclipse successfully, but when I mvn clean package and execute java -jar yishi-service.war it occured a Exception:
[http-nio-8080-exec-1] ERROR c.j.yishi.service.PageViewService - Invalid bound statement (not found): com.jiajian.yishi.mybatis.mapper.PageViewMapper.insertSelective
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.jiajian.yishi.mybatis.mapper.PageViewMapper.insertSelective
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:214)
at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:48)
at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:59)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
at com.sun.proxy.$Proxy61.insertSelective(Unknown Source)
at com.jiajian.yishi.service.PageViewService.add(PageViewService.java:35)
at com.jiajian.yishi.service.PageViewService$$FastClassBySpringCGLIB$$f6c85bb1.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
at com.jiajian.yishi.service.PageViewService$$EnhancerBySpringCGLIB$$a64c8127.add(<generated>)
at com.jiajian.yishi.common.pv.PageViewContainerRequestFilter.filter(PageViewContainerRequestFilter.java:60)
at org.glassfish.jersey.server.ContainerFilteringStage.apply(ContainerFilteringStage.java:132)
at org.glassfish.jersey.server.ContainerFilteringStage.apply(ContainerFilteringStage.java:68)
at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:318)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
My SessionFactory is:
#Configuration
#EnableTransactionManagement
#MapperScan(value = "com.mybatis.mapper", sqlSessionFactoryRef = "sqlSessionFactory")
public class SessionFactoryConfig implements TransactionManagementConfigurer{
private static String MYBATIS_CONFIG = "mybatis-config.xml";
#Autowired
private DataSource dataSource;
#Autowired
private ResourceLoader resourceLoader;
private String typeAliasPackage = "com.mybati.model";
#Bean(name = "sqlSessionFactory")
public SqlSessionFactoryBean createSqlSessionFactoryBean() throws Exception {
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
sqlSessionFactoryBean.setConfigLocation(new ClassPathResource(MYBATIS_CONFIG));
sqlSessionFactoryBean.setDataSource(dataSource); sqlSessionFactoryBean.setMapperLocations(ResourcePatternUtils.getResourcePatternResolver(resourceLoader).
getResources("classpath:com/mybatis/mapper/*.xml")); sqlSessionFactoryBean.setTypeAliasesPackage(typeAliasPackage);
return sqlSessionFactoryBean;
}
#Bean
public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
#Bean
#Override
public PlatformTransactionManager annotationDrivenTransactionManager() {
return new DataSourceTransactionManager(dataSource);
}
}
I am sure that my mapper and xml is correct, because it run successfully in my eclipse, and I get the data.
When I sleep, I think this exception is strange, and I doubted maybe maven plugin package omit my xml file which under src/main/java folder. Now, I make sure the exception is cause by that reason. The spring boot maven resource default not include the xml file which under src/main/java, I changed my pom.xml and it started successfully. The pom.xml add this:
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/application*.yml</include>
<include>**/application*.properties</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<excludes>
<exclude>**/application*.yml</exclude>
<exclude>**/application*.properties</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
Employee.java
#Entity
#Table(name="EMPLOYEE",
uniqueConstraints = { #UniqueConstraint(columnNames={"EMPNO"}) })
public class Employee implements Serializable {
#Id
#Column(name="EMPNO")
private String empNo;
#Column(name="FIRSTNAME")
private String firstName;
#Column(name="midInit")
private char midInit;
#Column(name="LASTNAME")
private String lastName;
#OneToMany(fetch=FetchType.LAZY, mappedBy = "id.employee")
Set<EmployeeSchedule> schedules;
.....
Schedule.java
#Entity
#Table(name="SCHEDULE_SLOT", uniqueConstraints = { #UniqueConstraint
(columnNames= {"SLOTNO"})})
public class ScheduleSlot implements Serializable{
#Id #Column(name="SLOTNO")
private String slotNo;
#Column(name="SLOTSTART")
private Date slotStart;
#Column(name="SLOTEND")
private Date slotEnd;
#OneToMany(fetch=FetchType.LAZY, mappedBy="id.schedule")
private Set<Employee> employees ;//= new HashSet<Employee>() ;
....
EmployeeSchedule.java
#Entity
#Table(name="EMPLOYEE_SCHEDULE")
#AssociationOverrides(
{ #AssociationOverride
( name = "id.employee",
joinColumns = #JoinColumn(name = "empNo")),
#AssociationOverride
( name = "id.schedule",
joinColumns = #JoinColumn(name = "slotNo"))
})
public class EmployeeSchedule {
#EmbeddedId
EmployeeSchedulePK id;
#Column(name="available")
private boolean available;
#Column(name="UPDATEDON")
private Date updatedOn;
#Column(name="UPDATEDBY")
#ManyToOne(fetch=FetchType.LAZY)
#JoinColumn(name="updatedBy")
private String updatedBy;
public EmployeeSchedule() {}
public EmployeeSchedule(EmployeeSchedulePK id) {
this.id = id;
}
......
EmployeeSchedulePK .java
#Embeddable
public class EmployeeSchedulePK implements Serializable {
#ManyToOne
private Employee employee;
#ManyToOne
private ScheduleSlot schedule;
public EmployeeSchedulePK() {
}
...
When doing maven install I get the following error. Please advice.. thanks
DataNucleus Enhancer (version 3.1.0.release) : Enhancement of classes
Class "com.co.dsp.iwork.entity.EmployeeSchedule" has MetaData yet the class cant be found. Please check your CLASSPATH specifications.
DataNucleus Enhancer completed with an error. Please review the enhancer log for full details. Some classes may have been enhanced but some caused errors
the dataneucleaus log shows: -
Class "com.co.dsp.iwork.entity.EmployeeSchedule" : Populating Meta-Data
13:22:59,059 (main) DEBUG [DataNucleus.MetaData] - Class "com.co.dsp.iwork.entity.EmployeeSchedule" field "employee" : adding Meta-Data for field embedded in class "com.co.dsp.iwork.entity.EmployeeSchedulePK" since it didnt appear in the Meta-Data definition.
13:22:59,059 (main) DEBUG [DataNucleus.MetaData] - Class "com.co.dsp.iwork.entity.EmployeeSchedule" field "schedule" : adding Meta-Data for field embedded in class "com.co.dsp.iwork.entity.EmployeeSchedulePK" since it didnt appear in the Meta-Data definition.
13:22:59,060 (main) ERROR [DataNucleus.MetaData] - *Class "com.co.dsp.iwork.entity.#UNKNOWN.id" has MetaData yet the class cant be found. Please check your CLASSPATH specifications.*
13:22:59,061 (main) DEBUG [DataNucleus.MetaData] - org.datanucleus.metadata.InvalidClassMetaDataException: Class "com.co.dsp.iwork.entity.EmployeeSchedule" has MetaData yet the class cant be found. Please check your CLASSPATH specifications.
13:22:59,063 (main) ERROR [DataNucleus.Enhancer] - DataNucleus Enhancer completed with an error. Please review the enhancer log for full details. Some classes may have been enhanced but some caused errors
Class "com.co.dsp.iwork.entity.EmployeeSchedule" has MetaData yet the class cant be found. Please check your CLASSPATH specifications.
org.datanucleus.metadata.InvalidClassMetaDataException: Class "com.co.dsp.iwork.entity.EmployeeSchedule" has MetaData yet the class cant be found. Please check your CLASSPATH specifications.
at org.datanucleus.metadata.ClassMetaData.populateMemberMetaData(ClassMetaData.java:464)
at org.datanucleus.metadata.ClassMetaData.populate(ClassMetaData.java:210)
at org.datanucleus.metadata.MetaDataManager$1.run(MetaDataManager.java:2699)
at java.security.AccessController.doPrivileged(Native Method)
at org.datanucleus.metadata.MetaDataManager.populateAbstractClassMetaData(MetaDataManager.java:2693)
at org.datanucleus.metadata.MetaDataManager.populateFileMetaData(MetaDataManager.java:2516)
at org.datanucleus.metadata.MetaDataManager.initialiseFileMetaDataForUse(MetaDataManager.java:1123)
at org.datanucleus.metadata.MetaDataManager.loadPersistenceUnit(MetaDataManager.java:986)
at org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput(DataNucleusEnhancer.java:793)
at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:525)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1258)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.datanucleus.maven.AbstractDataNucleusMojo.executeInJvm(AbstractDataNucleusMojo.java:333)
at org.datanucleus.maven.AbstractEnhancerMojo.enhance(AbstractEnhancerMojo.java:249)
at org.datanucleus.maven.AbstractEnhancerMojo.executeDataNucleusTool(AbstractEnhancerMojo.java:72)
at org.datanucleus.maven.AbstractDataNucleusMojo.execute(AbstractDataNucleusMojo.java:126)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
POM.xml :-
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.co.dsp</groupId>
<artifactId>dsp.dsp-iwork</artifactId>
<version>0.6.0-SNAPSHOT</version>
<name>DSP-iWork</name>
<packaging>jar</packaging>
<properties>
<maven.test.skip>true</maven.test.skip>
<dsp.version>0.6.0-SNAPSHOT</dsp.version>
<equinox.ver>3.7.0.v20110613</equinox.ver>
<spring.maven.artifact.version>3.0.5.RELEASE</spring.maven.artifact.version>
<slf4j.version>1.6.1</slf4j.version>
<spring.osgi.version>1.2.1</spring.osgi.version>
</properties>
<dependencies>
<dependency><groupId>com.co.dsp</groupId>
<artifactId>dsp.kernel</artifactId>
<version>${dsp.version}</version>
</dependency>
<dependency><groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.1.1</version>
<scope>runtime</scope>
</dependency><dependency><groupId>com.co.dsp</groupId>
<artifactId>dsp.dsi.das.dbconnection</artifactId>
<version>${dsp.version}</version>
</dependency><dependency>
<groupId>com.co.dsp</groupId>
<artifactId>dsp.dsi.das.core</artifactId>
<version>${dsp.version}</version>
</dependency>
<dependency><groupId>com.co.dsp</groupId>
<artifactId>dsp.dsi.das.api</artifactId>
<version>${dsp.version}</version>
</dependency>
<dependency><groupId>com.co.dsp</groupId>
<artifactId>dsp.dsi.dups.core</artifactId>
<version>${dsp.version}</version>
</dependency><dependency>
<groupId>com.co.dsp</groupId>
<artifactId>dsp.dsi.dups.api</artifactId>
<version>${dsp.version}</version>
</dependency><dependency>
<groupId>com.co.dsp</groupId>
<artifactId>dsp.dsi.scheduler</artifactId>
<version>${dsp.version}</version>
</dependency><dependency>
<groupId>com.co.dsp</groupId>
<artifactId>das-maven-plugin</artifactId>
<version>${dsp.version}</version>
</dependency>
</dependencies>
<repositories>
<repository><id>nexus</id>
<url>http://sjc1ssadsp01.crd.co.com:8081/nexus/content/groups/public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<url>http://sjc1ssadsp01.crd.co.com:8081/nexus/content/groups/public</url>
</pluginRepository>
<pluginRepository>
<id>maven-repo</id>
<name>maven repo</name>
<url>http://repo.maven.apache.org/maven2/</url>
</pluginRepository>
<pluginRepository>
<id>com.springsource.repository.bundles.milestone</id>
<name> SpringSource Enterprise Bundle Repository - SpringSource Milestone
Releases</name>
<url>http://repository.springsource.com/maven/bundles/milestone</url>
</pluginRepository>
</pluginRepositories>
<build><plugins><plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<fork>false</fork>
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
<verbose>true</verbose>
<enhancerName>ASM</enhancerName>
<persistenceUnitName>WorkPersistenceUnit</persistenceUnitName>
</configuration><executions><execution>
<phase>compile</phase><goals><goal>enhance</goal></goals></execution></executions>
</plugin><plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>false</extensions><executions> <execution>
<id>bundle</id> <phase>package</phase><goals>
<goal>bundle</goal></goals></execution></executions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>DSP iWork Integration</Bundle-Name>
<Bundle-Version>${dsp.version}</Bundle-Version>
<Bundle-Classpath>.</Bundle-Classpath>
<Import-Package>javax.persistence,com.co.dsp.dsi.scheduler,org.apache.log4j,
com.co.dsp.kernel.spi;version="0.3",com.co.dsp.kernel.util;version="0.3",
com.co.dsp.dsi.dups.api;version="0.3",com.co.dsp.dsi.dups.constants;version="0.3",
com.co.dsp.dsi.dups.exception,com.co.dsp.dsi.config,org.springframework.beans.factory,
org.springframework.osgi.context,org.springframework.osgi.util,
org.osgi.framework;version="1.5",com.co.dsp.dsi.das.api,javax.jdo,
javax.jdo.identity, javax.jdo.spi</Import-Package></instructions></configuration>
</plugin></plugins>
</build>
</project>
updating partial message after executing: mvn clean process-classes -X
[DEBUG]Writing resolution tracking file C:\Users\502128830\.m2
\repository\asm\asm\resolver-status.properties
[DEBUG]Could not find metadata asm:asm/maven-metadata.xml in
com.springsource.repository.bundles.milestone
(http://repository.springsource.com/maven/bundles/milestone)
[DEBUG]Could not find metadata asm:asm/maven-metadata.xml in DN_M2_Repo
(http://www.datanucleus.org/downloads/maven2/)
[WARNING]Could not transfer metadata asm:asm/maven-metadata.xml from/to
local.repository (file:../../local.repository/trunk): No connector available to access
repository local.repository (file:../../local.repository/trunk) of type leg
acy using the available factories WagonRepositoryConnectorFactory
org.sonatype.aether.transfer.MetadataTransferException: Could not transfer metadata
asm:asm/maven-metadata.xml from/to local.repository
(file:../../local.repository/trunk): No connector available to access repository
local.repository (
file:../../local.repository/trunk) of type legacy using the available factories
WagonRepositoryConnectorFactory
at org.sonatype.aether.impl.internal.DefaultMetadataResolver$ResolveTask.run
(DefaultMetadataResolver.java:588)
at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run
(RunnableErrorForwarder.java:60)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask
(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.sonatype.aether.transfer.NoRepositoryConnectorException: No connector
available to access repository local.repository (file:../../local.repository/trunk)
of type legacy using the available factories WagonRepositoryConnec
torFactory
at
org.sonatype.aether.impl.internal.DefaultRemoteRepositoryManager.getRepositoryConnector
(DefaultRemoteRepositoryManager.java:400)
at org.sonatype.aether.impl.internal.DefaultMetadataResolver$ResolveTask.run
(DefaultMetadataResolver.java:559)
... 4 more
[DEBUG]Could not find metadata asm:asm/maven-metadata.xml in local (C:\Users\502128830
\.m2\repository)
[INFO]--- maven-datanucleus-plugin:3.0.1:enhance (default) # dsp.dsp-iwork ---
[DEBUG]Could not find metadata org.datanucleus:datanucleus-core/maven-metadata.xml in
local (C:\Users\502128830\.m2\repository)
[WARNING]Could not transfer metadata asm:asm/maven-metadata.xml from/to
local.repository (file:../../local.repository/trunk): No connector available to access
repository
local.repository (file:../../local.repository/trunk) of type leg
acy using the available factories WagonRepositoryConnectorFactory
org.sonatype.aether.transfer.MetadataTransferException: Could not transfer metadata
asm:asm/maven-metadata.xml from/to local.repository
(file:../../local.repository/trunk): No connector available to access repository
local.repository (
file:../../local.repository/trunk) of type legacy using the available factories
WagonRepositoryConnectorFactory
at org.sonatype.aether.impl.internal.DefaultMetadataResolver$ResolveTask.run
(DefaultMetadataResolver.java:588)
at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run
(RunnableErrorForwarder.java:60)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.sonatype.aether.transfer.NoRepositoryConnectorException: No connector
available to access repository local.repository (file:../../local.repository/trunk)
of type legacy using the available factories WagonRepositoryConnec
torFactory
at
org.sonatype.aether.impl.internal.DefaultRemoteRepositoryManager.getRepositoryConnector
(DefaultRemoteRepositoryManager.java:400)
at org.sonatype.aether.impl.internal.DefaultMetadataResolver$ResolveTask.run
(DefaultMetadataResolver.java:559)
... 4 more
Could you post your pom ?
You want to work on bytecode with DataNucleus Enhancer.
Your plugin is bound to compile phase, which is wrong, as it works on compiled classes.
You should bind it to process-classes instead.