Why are manifest class path entries not found on WebSphere Liberty Profile startup? - classpath

When starting my application with WebSphere Liberty Profile (release 2013.11.0.0 - 8.5.5.Next Alpha with extended content) there are a lot of warnings showing up:
W SRVE9967W: The manifest class path dhbcore.jar can not be found in jar file wsjar:file:[blablabla] or its parent.
W SRVE9967W: The manifest class path jms.jar can not be found in jar file wsjar:file:[blablabla] or its parent.
W SRVE9967W: The manifest class path com.ibm.mq.jmqi.jar can not be found in jar file wsjar:file:[blablabla] or its parent.
W SRVE9967W: The manifest class path dhbcore.jar can not be found in jar file wsjar:file:[blablabla] or its parent.
W SRVE9967W: The manifest class path rmm.jar can not be found in jar file wsjar:file:[blablabla] or its parent.
W SRVE9967W: The manifest class path jndi.jar can not be found in jar file wsjar:file:[blablabla] or its parent.
W SRVE9967W: The manifest class path ldap.jar can not be found in jar file wsjar:file:[blablabla] or its parent.
W SRVE9967W: The manifest class path fscontext.jar can not be found in jar wsjar:file:[blablabla] or its parent.
W SRVE9967W: The manifest class path providerutil.jar can not be found in jar file wsjar:file:[blablabla] or its parent.
W SRVE9967W: The manifest class path jta.jar can not be found in jar file wsjar:file:[blablabla] or its parent.
W SRVE9967W: The manifest class path com.ibm.mq.ese.jar can not be found in jar wsjar:file:[blablabla] or its parent.
I tried to fix that with server start --clean as stated in this forum thread but it did not help.
There's a similar question here on Stackoverflow but before opening a PMR at IBM as suggested maybe someone has experienced this issue as well and solved it already.

These warnings are saying that the JAR on the right (the one in wsjar:file:...) has a META-INF/MANIFEST.MF file with a Class-Path attribute that refers to the JARs on the left (e.g., dhbcore.jar), but those JARs don't actually exist.
This warning is indicative an application packaging issue, not something that can be resolved by changing configuration, restarting the server, etc. It is trying to help you avoid common causes of class loading problems: incorrectly formatting Class-Path attribute and misspelled JAR names.
Edit: As of 8.5.5.4, the <logging hideMessage="SRVE9967W"> configuration can be used to remove these messages after they have been reviewed. Be sure to temporarily remove the hiding when adding new applications (or debugging application classpath problems). See the Logging and Trace topic in the Knowledge Center.

Related

How to determine resources for fatjar?

I build my scala project with https://github.com/sbt/sbt-assembly to get a fatjar.
The structure of the project looks as following(You can see the resources folder, that contains a file SapConfig.json):
Then, I tried to execute the fatjar as following:
java -jar SapEvents-assembly-0.1.0.jar
java.nio.file.FileSystemNotFoundException
at com.sun.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:171)
at com.sun.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:157)
at java.nio.file.Paths.get(Paths.java:143)
at ch.micarna.SapEventServer$.stream(SapEventServer.scala:22)
at ch.micarna.SapEventServer$.stream(SapEventServer.scala:16)
at fs2.StreamApp.$anonfun$runStream$1(StreamApp.scala:66)
at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:128)
at cats.effect.internals.IORunLoop$.start(IORunLoop.scala:35)
at cats.effect.IO.unsafeRunAsync(IO.scala:257)
at cats.effect.IO.$anonfun$runAsync$1(IO.scala:175)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at cats.effect.internals.IORunLoop$.step(IORunLoop.scala:167)
at cats.effect.IO.unsafeRunTimed(IO.scala:304)
at cats.effect.IO.unsafeRunSync(IO.scala:239)
at fs2.StreamApp.main(StreamApp.scala:83)
at ch.micarna.SapEventServer.main(SapEventServer.scala)
As you can recognize, I assume that the resource file could not be found.
The code, that read the resource file looks as following:
Paths.get(getClass.getClassLoader.getResource("SapConfig.json")
Where should I put my resource file?
I think your solution is in this post.
Change only
src/main/webapp to src/main/resources

Debugging OfBiz in Eclipse gives MissingResourceException

I downloaded the OfBiz Java application and the following line throws an MissingResourceException:
ResourceBundle res = ResourceBundle.getBundle(settingsResourceName);
The value of settingsResourceName is "cache", but I cannot find any file called cache.properties or cache_en.properties.
Where should I be looking? I'm new to Java. All my research on SO says there should be such a file.
I imported OfBiz in Eclipse using the Import menu option and selecting Existing Project from File System (I'm not in front of my dev machine so I don't remember the exact wording). But I chose the root folder of the downloaded OfBiz.
I then added the appropriate VM Arguments in the Run Configuration to get it to run properly at least. And that's it, on the first Run I got the above error. I think it has to do with a missing class path but I don't know what to add to class path.
Here is the stack trace:
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.apache.ofbiz.base.util.Debug.<clinit>(Debug.java:68)
at org.apache.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:61)
at org.apache.ofbiz.base.start.StartupControlPanel.loadStartupLoaders(StartupControlPanel.java:202)
at org.apache.ofbiz.base.start.StartupControlPanel.start(StartupControlPanel.java:69)
at org.apache.ofbiz.base.start.Start.main(Start.java:84)
Caused by: java.util.MissingResourceException: Can't find bundle for base name cache, locale en
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:773)
at org.apache.ofbiz.base.util.cache.UtilCache.setPropertiesParams(UtilCache.java:174)
at org.apache.ofbiz.base.util.cache.UtilCache.setPropertiesParams(UtilCache.java:170)
at org.apache.ofbiz.base.util.cache.UtilCache.setPropertiesParams(UtilCache.java:166)
at org.apache.ofbiz.base.util.cache.UtilCache.<init>(UtilCache.java:124)
at org.apache.ofbiz.base.util.cache.UtilCache.createUtilCache(UtilCache.java:769)
at org.apache.ofbiz.base.util.UtilProperties.<clinit>(UtilProperties.java:75)
... 5 more
UPDATE:
My mistake, I found two files both called cache.properties in the following folders:
ofbiz-trunk/build/resources/main
ofbiz-trunk/framework/base/config
But these are folders, not packages. I tried putting them in the .classpath but that did not work, I still kept getting the same error.
As suspected, I knew it was because of a missing reference to a class path. After looking at a section on this page: http://www.opensourcestrategies.com/ofbiz/ofbiz_eclipse.php, I learned that I was supposed to go to the Java Build Path and in the Libraries tab, click on Add Class Folder, then point that to ofbiz-trunk/framework/base/config. Which is where I have one of the cache.properties files.

NetBeans and JBoss

I am reading this tutorial http://www.tutorialspoint.com/ejb/index.htm. I have installed NetBeans IDE 8.0.2 and JBoss 5 server. And I have a problem with this part of the tutorial http://www.tutorialspoint.com/ejb/ejb_create_application.htm with jndi.properties file. I don't understand where should i put it? I have put it here C:\Users\Mimo\Documents\NetBeansProjects\EjbTester\jndi.properties in my EjbTester project and I get the following exceptions.
run:
java.io.FileNotFoundException: C:\Users\Mimo\Documents\NetBeansProjects\EjbTester\jndi.properties (The system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.(FileInputStream.java:138)
at java.io.FileInputStream.(FileInputStream.java:93)
at com.tutorialspoint.test.EJBTester.(EJBTester.java:25)
at com.tutorialspoint.test.EJBTester.main(EJBTester.java:39)
Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at com.tutorialspoint.test.EJBTester.testStatelessEjb(EJBTester.java:53)
at com.tutorialspoint.test.EJBTester.main(EJBTester.java:41)
Thanks for all your help!
Right click on project name in Project explorer window and select empty file name is jndi.properties and add info it... its work

JavaFX: load resource from other package - NetBeans

I know there have already been some questions about relative paths, but I Keep failing to get JavaFX FXML loader to load a resource from a package other than itself.
The loading class is located in the package gui.controllers and the fxml file BarSheet.fxml is located in the package gui.resources.
What should i now put in :
FXMLLoader myLoader = new FXMLLoader(getClass().getResource("src/gui/resources/BarSheet.fxml"));
Thanks in advance
SOLVED: The fault was in the fact that my fxml file contained an error so i didnt know when i entered the right path because it would still not work...
The path should start with / to indicate the path starting from the root followed by packages/filename. So in my case
FXMLLoader myLoader = new FXMLLoader(getClass().getResource("/gui/resources/BarSheet.fxml"));
As a complement when you have a package like com.company.view, and inside you have the .fxml file in order to make this work you have to put the line like this:
FXMLLoader myLoader = new FXMLLoader(getClass().getResource("/com/company/view/file.fxml"));

MANIFEST.MF issue with jhall.jar

i have created a jar-file (DicoDB.jar) with Eclipse in the folder called 'program-jar'. Inside a subdirectory 'javahelp' are the following jar-files: jhall.jar, hsviewer.jar, jh.jar and dicoDBHelp.jar (this is my jar-file which contents my help-application).
In the top directory 'program-jar' are also the following jars: jgraph.jar, gnujpdf.jar.
This is my MANIFEST.MF: (The file is manually created)
Manifest-Version: 1.0
Main-Class: gui.DicoDB
Class-Path: jgraph.jar
gnujpdf.jar
javahelp/jhall.jar
javahelp/hsviewer.jar
javahelp/jh.jar
javahelp/dicoDBHelp.jar
At the end of the file is an empty line.
Now I execute the DicoDB.jar in my terminal. Everything works fine until I want to open my help-file (dicoDBHelp.jar).
I get the following exception:
java.lang.NoClassDefFoundError: javax/help/JHelp
The JHelp class is contained by jhall.jar.
Now I don't undertand why the program does not find the class.
So i hope somebody can help me.
Just a thought: try to put all jars in the same line as Class-Path: .... separated by spaces.