.MissingResourceException: Could not find package for base name

I use jnca library to collect netflow udp packets sent from the router.

When it is imported into a new project in IntellijIDea, it works.

Jnca

The bid, if used in the maven project, does not work and gives this exception.

jnca

An exception:

java.util.MissingResourceException: Can't find bundle for base name org.wso2.event.adaptor.udp.jnca.etc.NetFlow, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1499)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1322)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:795)
at org.wso2.event.adaptor.udp.jnca.cai.utils.Resources.<init>(Resources.java:24)
at org.wso2.event.adaptor.udp.jnca.cai.flow.collector.Collector.<clinit>(Collector.java:51)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at org.wso2.event.adaptor.udp.jnca.cai.flow.collector.Run.<clinit>(Run.java:14)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
NetFlow.properties: Can't find bundle for base name org.wso2.event.adaptor.udp.jnca.etc.NetFlow, locale en_US

No problem with package names.

Problem with this code segment

      try {

        resources = ResourceBundle.getBundle("org.wso2.event.adaptor.udp.jnca.etc." + myName, Locale
                                             .getDefault());
    } catch (MissingResourceException exc) {
        exc.printStackTrace();
        error(SuperString.exceptionMsg(exc.toString()));
    }

myName = Netflow

I tried to change the path to the resource, but it did not work. And tried to include this netflow.properties file in the maven project resources folder, it also didn't work.

How to fix it

thanks

+4
source share
2 answers

Maven src/main/resources, src/main/java (. )

, , faces-config.xml( msgs ):

    <resource-bundle>
        <base-name>i18n.PanneauPrincipal</base-name>
        <var>msgs</var>
    </resource-bundle>

:

    ResourceBundle bundle = ResourceBundle.getBundle("i18n.PanneauPrincipal", locale);

PanneauPrincipal_en.properties :

    src/main/resources/i18n
+8

.properties ( ) , .properties, . .properties. :

 resources = ResourceBundle.getBundle(myName, Locale.getDefault());
0

Source: https://habr.com/ru/post/1527856/


All Articles