Hello, I'm a new module developer still very much learning. I am trying to follow the gateway-webpage example and after I have made all my changes I see the question marks on the gateway config page. The error I get
java.util.MissingResourceException: Can't find bundle for base name com/gpasettings/GPASettings, locale en_US
this is my gateway hook class setup:
@Override
public void setup(GatewayContext gatewayContext) {
this.context = gatewayContext;
log.debug("Beginning setup of GPA Settings Module");
// Register GatewayHook.properties by registering the GatewayHook.class with BundleUtils
BundleUtil.get().addBundle("GPASettings", getClass(), "GPASettings");
//rest of code
I am not sure what I'm missing here. I have a GPASettings.properties in the resource folder.
Sorry I did not noticed this was tagged as ignition 7.9. I am doing everything with the most up to date versions of SDK and maven plugin.
First question - are you using a new build of your module, and are you sure it has the gateway resources in the correct location? Check the actual built output .modl file; it's just a zip, and you can also open each .jar within as a .zip to check the directory structure.
Your class structure looks like it should be correct. Are you sure the resources
directory is an actual directory structure, with subfolders? IntelliJ, in its infinite wisdom, doesn't distinguish between an actual directory tree or a directory literally named com.gpasettings
.
So after looking at the directory structure you were absolutely right. Intellij was creating the directory com.gpasettings instead of com/gpasettings.
Thank you for the tip! I can't believe I overlooked that.
1 Like
That's bitten me a number of times, so it's one of the first things I check
This topic bothers me every time I make a new module so I'm trying to get to the bottom of it once and for all. Here is an example of one that is working and one that is not:
This one works ( folder structure looks like an actual folder structure, not "." )
This one does not work ( folder structure in the resource area is "." )
@PGriffith If I'm understanding this correct, what do you do to make IntelliJ not do the "." structure where you don't want it?
Thanks,
Nick
If you're making the resource directory from scratch, just use /
as the delimiter when writing out the package name, instead of .
IntelliJ will automatically create the intermediate directories.
There is likely a setting to not collapse the directory structure, but I've never gone digging for it because when it is set up the right way, it's helpful to present it the same as the package structure. It's just a problem on setup.
1 Like
Thanks. Just so everyone can be super clear on this, I did the following:
- right click on the folder structure in question and chose refactor --> rename
- Changed from
com.walmart.ignition.cws
to com/walmart/ignition/cws
That doesn't work, give some error message. So I just recreated the folder structure manually then it shows up correctly like this:
After rebuilding the module it works as expected and the labels show up as expected. I have spent so much time on this matter but now I feel like I can remedy it should it rear its head again.
For anyone else who see this same issue, do this:
- Go to File --> Project Structure
- Verify there is a valid folder structure and not dots "."
- If there are dots, rebuild the folder structure to your property resources
NO DOTS!!
Nick
4 Likes