eclipse - Strange Java NullPointer with SQLlite and JavaFX initialization - paths? (Maven) -
i've got problem project , didn't find matching solution yet:
our project written in java, uses javafx 1.8 , sqllite db. use maven build our jars. pom attached @ bottom. point maybe, we're using internalization of javafx , getting our resourceboundles sqllite db too.
our program working great when startet in eclipse not work @ when started jar.
just into: need db, initialize 1 if no db file exists. in step, running of programm gives necessery checks tables checked, db filled a.s.o.. creates db file next .jar afterwards - when db should accessed we're getting nullpointer without(!?) stacktrace.
i tried launch .jar copying existing , working db eclipse project before. routine gets steps further, want live information (select something...) db, program ends in catch block, saying not search in db.
do maybe have clue how can debug this? or @ least how reproduce in eclipse?
some more thoughts: interesting if go in menu graph stored in db drawn, works... can manipulate location of nodes, restart program , db gets it. if want search node given error under pom thrown. , if change language known nullpointer apears again...
it seems have problem language resources. 1 more thought came when wanted add background image given graph is, might have problems paths in project, because had - known .getresource() struggle.. (.pom updated)
thanks!
first edit: had mistake in .pom: after adding correct versionentry of sqlite driver runnig improved. language working, mentioned nullpointer still there. can not import or load background images reason...
25.07.: program working correctly if db file exists. if db file created in eclipse. if want run without db, meaning should create db on own, couple of things, gets described nullpointer.
after debugging sysprints found out seems problem languages. we're importing .xml file .db witch contains existing strings language. seems file not loaded have no idea how check wrong :-/
try { // resourcebundle bundle = new propertyresourcebundle(inputstream); // loader load fxml, sets location of choose map view // fxml file via parameter. fxmlloader loader = new fxmlloader(); loader.setresources(this.mainhandler.getiohandler().getlanguage( locale)); loader.setlocation(getclass().getresource( viewpathenum.choose_map.getpath())); // container items of choose map view. pane choosemaphbox = null; // loads fxml file mapchoose view. choosemaphbox = loader.load();
.pom:
<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>pse15-group1</groupid> <artifactid>carp</artifactid> <version>0.0.1-snapshot</version> <packaging>jar</packaging> <name>carp</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> </properties> <dependencies> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupid>org.xerial</groupid> <artifactid>sqlite-jdbc</artifactid> <version>3.8.10.1</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>3.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-assembly-plugin</artifactid> <version>2.5.5</version> <configuration> <descriptorrefs> <descriptorref>jar-with-dependencies</descriptorref> </descriptorrefs> <archive> <manifest> <addclasspath>true</addclasspath> <mainclass>pse15group1.carp.controller.maincontroller</mainclass> </manifest> </archive> </configuration> <executions> <execution> <id>assemble-all</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-jar-plugin</artifactid> <configuration> <archive> <manifest> <addclasspath>true</addclasspath> <mainclass>pse15group1.carp.controller.maincontroller</mainclass> </manifest> </archive> </configuration> </plugin> </plugins> </build> </project>
and 1 of ould errors is fixed, problem wrong sqlite version...:
c:\....>java -jar carp-0.0.1-snapshot-jar-with-dependencies.jar opened database table map checked succesfully table metrics checked succesfully table node checked succesfully table edge checked succesfully table tag checked succesfully table metricsedge checked succesfully table language checked succesfully table languagedata checked succesfully opened database table map checked succesfully table metrics checked succesfully table node checked succesfully table edge checked succesfully table tag checked succesfully table metricsedge checked succesfully table language checked succesfully table languagedata checked succesfully java.sql.sqlexception: [sqlite_error] sql error or missing database (ambiguous c olumn name: map_id) @ org.sqlite.db.newsqlexception(db.java:383) @ org.sqlite.db.newsqlexception(db.java:387) @ org.sqlite.db.throwex(db.java:374) @ org.sqlite.nativedb.prepare(native method) @ org.sqlite.db.prepare(db.java:123) @ org.sqlite.stmt.executequery(stmt.java:121) @ pse15group1.carp.model.io.sqlconnector.searchnodes(sqlconnector.java: 190)
Comments
Post a Comment