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.
Related
Environment:
Java 11
JBoss 7.2
Maven 3.5
I have a project with many maven modules and a common for all. Depend on the scope of dependency compile or provided I am getting WELD-001414: Bean name is ambiguous or java.lang.ClassNotFoundException.
How to solve these two errors to once?
When pom.xml (app-back) has dependency app-commons
When app-commons is scope provided
ERROR java.lang.ClassNotFoundException: net.sf.jasperreports.engine.JRException
When app-commons is scope compiled
ERROR WELD-001414: Bean name is ambiguous. Name version resolves to beans: [Managed Bean [class es.caib.app.commons.utils.Version] with qualifiers [#Default #Any #Named], Managed Bean [class es.caib.app.commons.utils.Version] with qualifiers [#Default #Any #Named]]"}}
Modules:
app (pom)
app-ear
app-back (dependency to app-commons)
app-front (dependency to app-commons)
app-commons (jasperreport dependency)
...
app-commons have ReportManager.java that needs jasper dependency and Version.java of type #ApplicationScope
pom.xml app-commons
<?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">
<parent>
<groupId>es.caib.accfor</groupId>
<artifactId>app</artifactId>
<version>8.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>app-commons</artifactId>
<packaging>jar</packaging>
<name>app-commons</name>
...
<dependencies>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.15.0</version>
</dependency>
</dependencies>
...
Version.java (app-commons)
...
#Named
#ApplicationScoped
public class Version {
private String version;
private String buildTime;
private String scmRevision;
private String jdkVersion;
private String projectName;
...
ReportManager.java (app-commons)
public class ReportManager {
...
public static void addParam(Map<String, Object> params, String nom, byte[] compiledReport) throws ReportException {
try {
params.put(nom, SerializationUtils.deserialize(compiledReport));
} catch (Exception e) {
throw new ReportException("Error deserialize compiledReport.");
}
}
...
In app-back module I call ReportManager.addParam()
SessionScoped.java (app-back)
#Named
#SessionScoped
public class SessionBean implements Serializable {
#Inject
private Version version;
...
StartupListener.java (app-back)
#WebListener
public class StartupListener implements ServletContextListener {
private static final Logger LOG = LoggerFactory.getLogger(StartupListener.class);
#Inject
private Version version;
...
Because of transitive dependencies are not included when dependency is provided, so I had to restructure the modules this way.
Modules:
app (pom)
app-ear
jasperreports (compiled) MOVED FROM APP-COMMONS
app-back
app-commons (provided)
app-front
app-commons (provided)
app-commons
...
I was not able to change app-commons dependency to compiled because it is dependent of app-front and app-back. In app-commons as compiled I have an #ApplicationScope class that it would produce ambiguous Beans pointing to the class in app-commons because of jakartaee context management.
UPDATE:
Maybe it is better if I rephrase the question: How to tell Jlink to put the java.sql or derby into the runtime?
Meantime I tried it with a 'jlinkVerbose' option in the pom file and as a result I can see this after a 'mvn clean javafx:jlink':
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building AdventureGameEngine 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # AdventureGameEngine ---
[INFO] Deleting /home/sysadmin/NetBeansProjects/AdventureGameEngine/target
[INFO]
[INFO] --- javafx-maven-plugin:0.0.3:jlink (default-cli) # AdventureGameEngine ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 45 resources
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to /home/sysadmin/NetBeansProjects/AdventureGameEngine/target/classes
[INFO] /home/sysadmin/NetBeansProjects/AdventureGameEngine/src/main/java/com/mycompany/adventuregameengine/FXMLDocumentController.java: /home/sysadmin/NetBeansProjects/AdventureGameEngine/src/main/java/com/mycompany/adventuregameengine/FXMLDocumentController.java uses unchecked or unsafe operations.
[INFO] /home/sysadmin/NetBeansProjects/AdventureGameEngine/src/main/java/com/mycompany/adventuregameengine/FXMLDocumentController.java: Recompile with -Xlint:unchecked for details.
com.mycompany.adventuregameengine file:///home/sysadmin/NetBeansProjects/AdventureGameEngine/target/classes/
java.base file:///usr/lib/jvm/java-11-openjdk-amd64/jmods/java.base.jmod
java.datatransfer file:///usr/lib/jvm/java-11-openjdk-amd64/jmods/java.datatransfer.jmod
java.desktop file:///usr/lib/jvm/java-11-openjdk-amd64/jmods/java.desktop.jmod
java.logging file:///usr/lib/jvm/java-11-openjdk-amd64/jmods/java.logging.jmod
java.prefs file:///usr/lib/jvm/java-11-openjdk-amd64/jmods/java.prefs.jmod
java.scripting file:///usr/lib/jvm/java-11-openjdk-amd64/jmods/java.scripting.jmod
java.sql file:///usr/lib/jvm/java-11-openjdk-amd64/jmods/java.sql.jmod
java.transaction.xa file:///usr/lib/jvm/java-11-openjdk-amd64/jmods/java.transaction.xa.jmod
java.xml file:///usr/lib/jvm/java-11-openjdk-amd64/jmods/java.xml.jmod
javafx.base file:///home/sysadmin/.m2/repository/org/openjfx/javafx-base/11/javafx-base-11-linux.jar
javafx.controls file:///home/sysadmin/.m2/repository/org/openjfx/javafx-controls/11/javafx-controls-11-linux.jar
javafx.fxml file:///home/sysadmin/.m2/repository/org/openjfx/javafx-fxml/11/javafx-fxml-11-linux.jar
javafx.graphics file:///home/sysadmin/.m2/repository/org/openjfx/javafx-graphics/11/javafx-graphics-11-linux.jar
jdk.unsupported file:///usr/lib/jvm/java-11-openjdk-amd64/jmods/jdk.unsupported.jmod
Providers:
java.desktop provides java.net.ContentHandlerFactory used by java.base
java.base provides java.nio.file.spi.FileSystemProvider used by java.base
java.desktop provides javax.print.PrintServiceLookup used by java.desktop
java.desktop provides javax.print.StreamPrintServiceFactory used by java.desktop
java.desktop provides javax.sound.midi.spi.MidiDeviceProvider used by java.desktop
java.desktop provides javax.sound.midi.spi.MidiFileReader used by java.desktop
java.desktop provides javax.sound.midi.spi.MidiFileWriter used by java.desktop
java.desktop provides javax.sound.midi.spi.SoundbankReader used by java.desktop
java.desktop provides javax.sound.sampled.spi.AudioFileReader used by java.desktop
java.desktop provides javax.sound.sampled.spi.AudioFileWriter used by java.desktop
java.desktop provides javax.sound.sampled.spi.FormatConversionProvider used by java.desktop
java.desktop provides javax.sound.sampled.spi.MixerProvider used by java.desktop
java.logging provides jdk.internal.logger.DefaultLoggerFinder used by java.base
java.desktop provides sun.datatransfer.DesktopDatatransferService used by java.datatransfer
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.176 s
[INFO] Finished at: 2020-06-17T11:01:49+02:00
[INFO] Final Memory: 22M/84M
[INFO] ------------------------------------------------------------------------
It still gives the 'BUILD SUCCESS' result and despite it says 'java.sql file:///usr/lib/jvm/java-11-openjdk-amd64/jmods/java.sql.jmod
', the java.sql is missing from the 'Providers:' section.
END of UPDATE.
I am working on a game in Java11 + JavaFX. The building tool is Maven. The IDE is Netbeans 11.
It is a modular project.
I use this manual: https://openjfx.io/openjfx-docs/#IDE-NetBeans
The game compiles and runs smoothly, it can create/read/update the Derby DB when I start it in Netbeans via maven by 'clean javafx:run'.
When I want to create the runtime from terminal by 'mvn clean javafx:jlink' I get a 'BUILD SUCCESS' result too.
But when I try to start the launcher by 'target/adventuregame/bin/adventuregamelauncher' I get an error message:
Connection error: java.sql.SQLException: No suitable driver found for jdbc:derby:advDB;create=true
Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javafx.fxml.LoadException:
/com.mycompany.adventuregameengine/com/mycompany/adventuregameengine/FXMLDocument.fxml:15
at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2603)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3237)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3194)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3163)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3136)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3113)
at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:3106)
at com.mycompany.adventuregameengine#1.0-SNAPSHOT/com.mycompany.adventuregameengine.AdventureGame.start(AdventureGame.java:17)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
... 1 more
Caused by: java.lang.NullPointerException
at com.mycompany.adventuregameengine#1.0-SNAPSHOT/com.mycompany.adventuregameengine.DB.<init>(DB.java:46)
at com.mycompany.adventuregameengine#1.0-SNAPSHOT/com.mycompany.adventuregameengine.FXMLDocumentController.<init>(FXMLDocumentController.java:888)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.lang.Class.newInstance(Class.java:584)
at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:936)
at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:980)
at javafx.fxml/javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:227)
at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:752)
at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2722)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2552)
... 17 more
Exception running application com.mycompany.adventuregameengine.AdventureGame
I checked the target/adventuregame/lib/classlist file and it seems to me that the problem is that the jdbc / derby classes are not included. It seems to me that the Jlink can not put the jdbc into the runtime, despite that this manual
https://github.com/openjfx/javafx-maven-plugin#javafxjlink-options
writes that 'The plugin includes by default: --module-path, --add-modules and -classpath options.'
Here is my module-info.java file:
module com.mycompany.adventuregameengine {
requires javafx.controls;
requires javafx.fxml;
requires java.sql;
requires java.desktop;
// requires java.naming;
// requires java.management;
opens com.mycompany.adventuregameengine to javafx.fxml; //java.desktop, java.sql
exports com.mycompany.adventuregameengine;
}
Before I posted I've checked the similar topics here on stackoverflow, and one suggested that including java.naming and java.management could help, I tried it but it doesn't.
Here is my pom file:
<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.mycompany</groupId>
<artifactId>AdventureGameEngine</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
<classifier>linux</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11</version>
<classifier>linux</classifier>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.15.2.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.3</version>
<configuration>
<compilerArgs>
<arg>--add-modules</arg>
<arg>java.sql</arg>
</compilerArgs>
<launcher>adventuregamelauncher</launcher>
<jlinkImageName>adventuregame</jlinkImageName>
<mainClass>com.mycompany.adventuregameengine.AdventureGame</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
I tried the 'compilerArgs' section, but it did not help.
Here is the section of my DB file what the error message refers to, but it must be OK since it runs properly via Netbeans, the problem is with the runtime.
public class DB {
final String JDBC_DRIVER = "org.apache.derby.jdbc.EmbeddedDriver";
final String URL = "jdbc:derby:advDB;create=true";
Connection conn = null;
Statement createStatement = null;
DatabaseMetaData dbmd = null;
public DB(){
try {
conn = DriverManager.getConnection(URL);
System.out.println("There is a connection.");
} catch (SQLException ex) {
System.err.println("Connection error: " + ex);
}
if (conn != null){
try {
createStatement = conn.createStatement(); //create a statement (auto)
} catch (SQLException ex) {
System.err.println("Statement error: " + ex);
}
}
//is the database empty, so the program runs first time?
try {
dbmd = conn.getMetaData();
ResultSet rs = dbmd.getTables(null, "APP", "HERO", null); //capital letter!
if(!rs.next()){
createStatement.execute("create table hero(hp INT, score INT, currentRoom INT, vanBackpack boolean)");
createStatement.execute("create table rooms(description varchar(200), eszakra INT, keletre INT, delre INT, nyugatra INT, fel INT, le INT, id INT)");
createStatement.execute("create table items(roomnumber INT, name varchar(30), description varchar(200), felveheto boolean, vizsgal varchar(200), pozX INT, pozY INT)");
}
} catch (SQLException ex) {
System.err.println("ResultSet getTables/create table error: " + ex);
}
}
If I create a simple sample project on the same way as the above manual suggests, then the runtime runs properly. It seems it can not include only the jdbc/derby.
I thank you in advance for every suggestion to solve this really annoying issue.
Zed
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.
I'm new to Spring Integration and am trying to develop an application which simply (1) polls a folder for new files with extension .dat containing data in csv format (2) initialize for each line a domain POJO object of class RecordDTO and finally (3) sends this object as payload to a REST service with a POST.
For this I'm trying to use Java DSL for Spring Integration.
The problem I'm getting is the following VerifyError / HttpRequestExecutingMessageHandler overrides final method onInit. exception.
2016-07-22 10:01:38.965 ERROR 4460 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'upcase' defined in eu.softeco.examples.SpringBootIntegrationTestApplication: Initialization of bean failed; nest
ed exception is java.lang.VerifyError: class org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler overrides final method onInit.()V
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.1.RELEASE.jar:4.3.1.RELEASE]
...
Caused by: java.lang.VerifyError: class org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler overrides final method onInit.()V
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_45]
at java.lang.ClassLoader.defineClass(ClassLoader.java:760) ~[na:1.8.0_45]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_45]
...
Below are relevant details concerning my code and maven configuration. Please not that
1) the problem is at startup, before any data is put in the input folder
2) if I replace the final Http outboundGateway step with the simple (commented) System.out.println, everything works fine.
Following are code/config details. This is my main Spring Boot application class with Spring Integration Flow definition:
#SpringBootApplication
#EnableIntegration
#IntegrationComponentScan
public class SpringBootIntegrationTestApplication {
...
public static void main(String[] args) {
SpringApplication.run(SpringBootIntegrationTestApplication.class, args);
}
/**
* Inbound FileReadingMessageSource
*/
#Bean
#InboundChannelAdapter(channel = "upcase.input", poller = #Poller(fixedDelay = "4000"))
public MessageSource<File> fileReadingMessageSource() {
FileReadingMessageSource source = new FileReadingMessageSource();
source.setDirectory(new File(INBOUND_PATH));
source.setFilter(new SimplePatternFileListFilter("*.dat"));
return source;
}
/**
* Spring Integration Java DSL Flow
*/
#Bean
public IntegrationFlow upcase() {
FileToStringTransformer fileToStringTranformer = Transformers.fileToString();
fileToStringTranformer.setDeleteFiles(true);
return flow -> flow
// get string contents from fie
.transform(fileToStringTranformer)
// split into individual lines
.split( s -> s.applySequence(true).get().getT2().setDelimiters("\n"))
// cleanup lines from trailing returns
.transform( (String s) -> s.replace("\n", "").replace("\r", "") )
// convert csv string to RecordDTO object
.transform("#recordFromCsvTransformer.transform(payload)")
// print on System.out
// .handle(m -> System.out.println(m.getPayload()))
// send to
.handle(Http.outboundGateway("http://localhost:8080/records")
.httpMethod(HttpMethod.POST)
.expectedResponseType(RecordDTO.class));
}
}
Below the RecordFromCsvTransformer class
#Component
public class RecordFromCsvTransformer
{
#Transformer
public RecordDTO transform(String csvline) throws Exception {
RecordDTO record = new RecordDTO();
... parse csv and initialize record's fields...
return record;
}
}
And Finally the relevant parts of pom.xml (dependencies);
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RC1</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
...
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-file</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-http</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>
...
</dependencies>
...
As a side question in general, can someone suggest me some good tutorial / getting started guide to learn Spring Integration with Java Annotation/Java DSL? So far I've only found either introductory guide based on Spring Integration XML configuration or material about Java Annotations/DSL but that already requires prior knowledge of Spring Integration.
<version>2.1.0.RELEASE</version>
That version of Spring Integration is mismatched with the spring-integration-core version brought in transitively by maven.
You need to use the same version of all spring-integration-* files - check which version of spring-integration-file is being pulled in by boot and use the same version.
I am developing a sample Java EE applicaiton with Intellij Idea 13. Simply, my project is a Maven project and has JPA end EJB modules. But when deploying and running application on Glassfish server I get errors.
I created a Maven project named SimpleEE and added JPA, EJB modules.
Here is my project structure:
|-SampleEE
| |+.idea
| |-src
| | |-main
| | | |-java
| | | | |-beans
| | | | | |-MyBean.java
| | | | |-entities
| | | | |-Staff.java
| | | |-resources
| | | |-META-INF
| | | |-ejb-jar.xml
| | | |-persistence.xml
| | |+test
| |-pom.xml
| |-SampleEE.iml
| |-SampleEE.jpr
|+ExternalLibraries
MyBean.java:
package beans;
import entities.Staff;
import javax.annotation.PostConstruct;
import javax.ejb.LocalBean;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.persistence.EntityManager;
import javax.persistence.Persistence;
#Startup
#LocalBean
#Singleton
public class MyBean {
public MyBean() {
}
#PostConstruct
public void myMain() {
EntityManager em = Persistence.createEntityManagerFactory("mysqlPU").createEntityManager();
em.getTransaction().begin();
Staff staff = new Staff();
staff.setAge(44);
staff.setGender("M");
staff.setSalary(123);
staff.setName("Staff Name");
em.persist(staff);
em.getTransaction().commit();
}
}
Staff.java
package entities;
import javax.persistence.*;
#Entity
public class Staff {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name = "STAFF_ID")
private int id;
#Column(name = "NAME")
private String name;
#Column(name = "AGE")
private Integer age;
#Column(name = "GENDER")
private String gender;
#Column(name = "SALARY")
private Integer salary;
#Lob
#Column(name = "IMAGE", nullable = true)
private byte[] image;
// Getters and setters
// ...
#Override
public int hashCode() {
// implementation ignored here for simplicity
}
#Override
public boolean equals(Object o) {
// implementation ignored here for simplicity
}
}
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
<persistence-unit name="mysqlPU">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>entities.Staff</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/dbName"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.user" value="mysqlUsername"/>
<property name="javax.persistence.jdbc.password" value="mysqlPassword"/>
</properties>
</persistence-unit>
</persistence>
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>SampleEE</groupId>
<artifactId>SampleEE</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.27</version>
</dependency>
</dependencies>
</project>
I created an EJB Application:Exploded artifact from project structure. In Run/Debug configurations window I built a Glassfish configuration. But when running this configuration, Idea complains that it can not find classes in mysql jdbc driver and shows errors emerging from this error. Server is started but application is not deployed. Error message snippet from Idea output log:
....
[2013-12-13 04:07:31,362] Artifact SampleEE:ejb exploded: Artifact is being deployed, please wait...
[2013-12-13 04:07:33,011] Artifact SampleEE:ejb exploded: Error during artifact deployment. See server log for details.
[2013-12-13 04:07:33,018] Artifact SampleEE:ejb exploded: java.io.IOException: com.sun.enterprise.admin.remote.RemoteFailureException: Error occurred during deployment: Exception while loading the app : javax.ejb.CreateException: Initialization failed for Singleton MyBean. Please see server.log for more details.
Last error in Glassfish log
....
Caused by: Exception [EclipseLink-4003] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Configuration error. Class [com.mysql.jdbc.Driver] not found.
....
I guess jar files of libraries are not deployed. But my maven configuration is valid. M2_HOME is set correctly and IDEA resolves maven path. The jar files are also available in local repository.
I created a same structured project in Netbeans and it runs succesfully. I don't know what I am doing wrong or what configuration parameters I am missing.
You need to add a JavaEE module and add create a JavaEE artifact. Then add all libraries you need to that artifact.