I am trying to use <fx:include source="abcd.fxml"/> tag but I get Base location is undefined error when launching the application.
If a set the location of FXMLLoader this time it doesn't work in jar files because when a resource is in jar file it's URL is meaningless (because a jar file is a kind of a zip file).
Is there a way to use this include tag even if I deploy my application as a jar file?
Related
I created one jar file and in that i have class files, .classpath file, .project file In sample on github, i see apiproxy, callout and lib folder. when i deploy it, i getting error that traffic can't flow , i get error like traffic.How to upload dependencies jar in lib folder However when i upload my main jar file in resources folder, i don't see any lib folder for dependencies jars. Should i place all jars in one resources folder. in my .classpath file, i can see all lib jars like message-flow-1.0.0.jar, expressions-1.0.0.jar and itextpdf-5.5.6.jar. However in documentation, its given to deploy by maven but i don't know maven, from UI how should i create lib folder and upload jars there.
Okay, in my understanding of your point.
You can upload jar file into apigee from Scripts > import file > in file type choose "JAR" > select jar file from your work space > and finally, define your jar name and then use policy Java Callout to call your jar.
If you have to modified your jar and want to deploy it, delete your existing jar in apigee and upload the new jar by following 1. In case of new jar has the same name of existing jar, you do not need to do anything with Java Callout policy. But the new jar has the different name, don't forget to modified Java Callout for refer to your new jar.
Please create the single jar file which contains jars like message-flow-1.0.0.jar, expressions-1.0.0.jar and itextpdf-5.5.6.jar. As per the apigee doc in create a Java Callout policy and make sure you have mentioned the package name & class name in Java Callout Poliy
<ClassName>package.ClassName</ClassName
<ResourceURL>java://SingleJar.jar</ResourceURL>
I've just finished my JavaFX project.
In the src file I've got some folders that each includes different files: FXML, CSS, Class, Files, Controllers.
After I build Artifacts in the IntelliJ, when I run it on cmd, the Jar file throws an exception because it can not find the FXML files!
I've copied the FXML folders next to the Jar file and a folder before it but it doesn't work
I've made packages to be clean but it has made some trouble for me!
here is a screenshot of my code
And I've made a fatherController that each controller extends from that and it has a method called load page that's how I load my FXML files
Try calling the FXMLs like this
Parent root = FXMLLoader.load(getClass().getResource("/ContactList/FXML/"+fxmlFileName+".fxml"));
I found the problem! I shouldn't Address the FXML files like the picture.
instead of "../FXML/example.fxml", Is should use "/FXML/example.fxml".
I want to read a json file placed in resources/data/info.json in my webapp. Got to know that need to use Convertor.class.getResourceAsStream("\\WEB-INF\\classes\\data\\Address.json"); where Convertor is my util class for some reason am unable to read the file and i see the InputStream returning null and i see the below exception :
com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
at [Source: UNKNOWN; line: 1, column: 0]
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4133)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3988)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3058)
at com.wf.hrca.util.Convertor.unMarshal(Convertor.java:84)
resources is a folder of your source project on your development machine. Tomcat doesn't care about how your source project looks like. And by the way, when you'll deploy the application in production, there won't be any source project on the machine.
All Tomcat cares about is the war file you deploy. Inside this war file, the WEB-INF/classes directory, along with all the jar files under WEB-INF/lib, constitute the classpath of the application.
Convertor.class.getResourceAsStream(), as the javadoc explains (but you really need to read it to know) expects a /-separated path. If the path starts with a /, then the path starts at one of the roots of the classpath (i.e. / refers to WEB-INF/classes, and to the root of each jar file of WEB-INF/lib).
So, find where the json file is located inside the war file. If it's under /WEB-INF/classes/data/info.json, then you should use
Convertor.class.getResourceAsStream("/data/info.json");
I'm working on a spring-mvc project and was wondering if, like grails, I can create an external configuration file in tomcat with the appconfig folder. My project lives in /var/lib/tomcat7/webapps/<app> and was wondering if placing a configuration file in /var/lib/tomcat7/appconfigs/<config.xml> would work? If so, is it like grails and the application searches that location by default, or do I need to specify where that configuration lives? Thanks
What do you mean by "external configuration file"? Would this config file be separate from the war file? Or would it be packaged along with war file?
If packaged along with war file, you can put it under src/main/resources folder and it should be automatically packaged and placed in classpath.
If not packaged with war file, I usually put the configuration parameters under Tomcat's context.xml. Here's the documentation: http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Environment_Entries
I have made on Javafx 2 standalone application using netbeans 7.2 IDE. Internally netbeans use ant script for making a build.
Now my application creates some XML file based on some input. For xml creation I have used one third party jar file 'xstream-1.4.3.jar'. Now when I make build and run the application from netbeans IDE only.. application works fine. But when I copy jar to some other location my application stops working.
Reason being when jar file is copied to some other location, application is not able to find 'xstream**.jar' file. So now how to include this jar file (all jar files from class path) in the build so that my application can become distributable.
Thanks in advance.
The manifest file in the JAR is updated to include entries that designate main class and any libraries that are on the project's classpath.
http://netbeans.org/kb/docs/java/javase-deploy.html#build
Include the following code in your build.xml file and change the folder names to suit your project.
<target name="-post-jar">
<jar jarfile="${dist.jar}" update="true">
<zipfileset src="C:/Java/ExcelJars/jxl.jar" includes="**/*.class" />
<zipfileset src="C:/Java/ExcelJars/SX.jar" includes="**/*.class"/>
</jar>
</target>