Hi,
I'm new to Ofbiz... I have a very simple client application based on the org.ofbiz.service.rmi.ExampleRemoteClient, talking to a remote Offbiz instance. I exported the userLogin service and the service call from the client app returns successfully. I get the userLogin object from the result map as a GenericValue fine. Next I try to get some fields from the GenericValue which fails with an Exception. As I debugged the client side code I realized that getting a field from the GenericValue involves GenericEntity and GenericDelegator from the included Ofbiz jars and my call fails as it tries to create a new GenericDelegator with the name "default" and tries to log this action with org.ofbiz.base.util.Debug. I get a MissingResourceException: Can't find bundle for base name cache, locale hu_HU. I guess it's because I don't have a configured Ofbiz instance on the client side, no configuration files, propertiy files there, only the jars, and I guess I don't have a delegator at all there... Can someone help me what do I have to do to fetch the fields of a GenericValue returned by a service on the client side? Do I have to setup my client app to use the remote delegator maybe? my code: // call the login service Map result = dispatcher.runSync("userLogin", UtilMisc.toMap("login.username", username, "login.password", password)); GenericValue userLogin = (GenericValue) result.get("userLogin"); String userLoginId = userLogin.getString("userLoginId"); the Exception: Exception in thread "main" java.lang.ExceptionInInitializerError at org.ofbiz.base.util.Debug.<clinit>(Debug.java:92) at org.ofbiz.entity.GenericDelegator.getGenericDelegator( GenericDelegator.java:113) at org.ofbiz.entity.GenericEntity.getDelegator(GenericEntity.java:271) at org.ofbiz.entity.GenericEntity.getModelEntity(GenericEntity.java:257) at org.ofbiz.entity.GenericEntity.get(GenericEntity.java:287) at org.ofbiz.entity.GenericEntity.getString(GenericEntity.java:543) at CallCenterAgentSession.checkLogin(CallCenterAgentSession.java:117) at CallCenterAgentSession.login(CallCenterAgentSession.java:98) at CallCenterAgent.main(CallCenterAgent.java:27) Caused by: java.util.MissingResourceException: Can't find bundle for base name cache, locale hu_HU at java.util.ResourceBundle.throwMissingResourceException(Unknown Source) at java.util.ResourceBundle.getBundleImpl(Unknown Source) at java.util.ResourceBundle.getBundle(Unknown Source) at org.ofbiz.base.util.cache.UtilCache.setPropertiesParams( UtilCache.java:217) at org.ofbiz.base.util.cache.UtilCache.setPropertiesParams( UtilCache.java:213) at org.ofbiz.base.util.cache.UtilCache.<init>(UtilCache.java:172) at org.ofbiz.base.util.UtilProperties.<clinit>(UtilProperties.java:53) ... 9 more Thanks for your help in advance, Zoltan |
When using certain objects, like the GenericValue object, from OFBiz there are a few resources you need. This error message says it can't find the cache.properties file, so you need to add that to you application classpath. -David On Feb 17, 2007, at 10:33 AM, Zoltan Vereczi wrote: > Hi, > > I'm new to Ofbiz... > I have a very simple client application based on the > org.ofbiz.service.rmi.ExampleRemoteClient, talking to a remote > Offbiz instance. > I exported the userLogin service and the service call from the > client app > returns successfully. > I get the userLogin object from the result map as a GenericValue fine. > Next I try to get some fields from the GenericValue which > fails with an Exception. > As I debugged the client side code I realized that getting a field > from the > GenericValue involves GenericEntity and GenericDelegator from the > included > Ofbiz jars and my call fails as it tries to create a new > GenericDelegator with > the name "default" and tries to log this action with > org.ofbiz.base.util.Debug. > I get a MissingResourceException: Can't find bundle for base name > cache, > locale hu_HU. > I guess it's because I don't have a configured Ofbiz instance on > the client > side, no configuration files, propertiy files there, only the jars, > and I guess I don't have a delegator at all there... > Can someone help me what do I have to do to fetch the fields of a > GenericValue > returned by a service on the client side? > Do I have to setup my client app to use the remote delegator maybe? > > my code: > > // call the login service > Map result = dispatcher.runSync("userLogin", UtilMisc.toMap > ("login.username", > username, "login.password", password)); > GenericValue userLogin = (GenericValue) result.get("userLogin"); > String userLoginId = userLogin.getString("userLoginId"); > > > the Exception: > > Exception in thread "main" java.lang.ExceptionInInitializerError > at org.ofbiz.base.util.Debug.<clinit>(Debug.java:92) > at org.ofbiz.entity.GenericDelegator.getGenericDelegator( > GenericDelegator.java:113) > at org.ofbiz.entity.GenericEntity.getDelegator(GenericEntity.java: > 271) > at org.ofbiz.entity.GenericEntity.getModelEntity > (GenericEntity.java:257) > at org.ofbiz.entity.GenericEntity.get(GenericEntity.java:287) > at org.ofbiz.entity.GenericEntity.getString(GenericEntity.java:543) > at CallCenterAgentSession.checkLogin(CallCenterAgentSession.java:117) > at CallCenterAgentSession.login(CallCenterAgentSession.java:98) > at CallCenterAgent.main(CallCenterAgent.java:27) > Caused by: java.util.MissingResourceException: > Can't find bundle for base name cache, locale hu_HU > at java.util.ResourceBundle.throwMissingResourceException(Unknown > Source) > at java.util.ResourceBundle.getBundleImpl(Unknown Source) > at java.util.ResourceBundle.getBundle(Unknown Source) > at org.ofbiz.base.util.cache.UtilCache.setPropertiesParams( > UtilCache.java:217) > at org.ofbiz.base.util.cache.UtilCache.setPropertiesParams( > UtilCache.java:213) > at org.ofbiz.base.util.cache.UtilCache.<init>(UtilCache.java:172) > at org.ofbiz.base.util.UtilProperties.<clinit>(UtilProperties.java: > 53) > ... 9 more > > Thanks for your help in advance, Zoltan > smime.p7s (3K) Download Attachment |
First of all thanks for the fast reply.
I started to add the missing resources... First I added cache.properties, debug.properties. If I only include cache.properties I get the following exception: java.lang.IllegalStateException: [GenericEntity.getDelegator] could not find delegator with name default if I add debug.properties it starts to throw ClassNotFoundExceptions. I continued to add the missing jars and files. I had to add a lot of stuff, jars (avalon, xerces, oro, geronimo...), even the entityengine.xml and the serviceengine.xml, security.xml... xsd files, and some more ofbiz jars as well. Not a few, a lot... Is this normal? Right now I'm getting the following on the console. Did I add unnecessary files or still missing something (looks like it needs the entity definitions too)? 2007-02-17 20:38:16,933 (main) [ GenericDelegator.java:113:INFO ] Creating new delegator [default] (main) 2007-02-17 20:38:19,427 (main) [ UtilXml.java:243:DEBUG] XML Read 2.234s: file:/F:/workspace-3.2.1/blaze_dev/bin/entityengine.xml 2007-02-17 20:38:19,697 (main) [ ModelReader.java:394:INFO ] FINISHED LOADING ENTITIES - ALL FILES; #Entities=0 #ViewEntities=0 #Fields=0 #Relationships=0 #AutoRelationships=0 2007-02-17 20:38:19,817 (main) [ GenericDelegator.java:148:INFO ] Doing entity definition check... 2007-02-17 20:38:19,857 (main) [ ModelEntityChecker.java:506:INFO ] [initReservedWords] array length=1023 2007-02-17 20:38:20,678 (main) [ GenericDelegator.java:1876:ERROR] ---- exception report ---------------------------------------------------------- Failure in findListIteratorByCondition operation for entity [DynamicView]: org.ofbiz.entity.GenericModelException: Could not find definition for entity name EntityKeyStore. Rolling back transaction. Exception: org.ofbiz.entity.GenericModelException Message: Could not find definition for entity name EntityKeyStore Thanks, Zoltan |
In reply to this post by David E Jones
All things needed are documented in ExampleRemoteClient.java
(cache.properties, other propertie, jars etc). However the problem was about how to access the fields of a GenericValue object, i.e. how to 'get inside' a GenericValue. It was obvious that we have the information available on the client side (printing out the object showed all), just had problems about accessing the fields. Zoltan found out that on the remote client side using the get method leads you to nowhere, because it would drag way too many ofbiz things (works with local) to the client side. He also found that the proper way of getting these is by using the getAllFields, getFields etc. methods instead. Regards, András Saturday, February 17, 2007, 6:48:24 PM, you wrote: > When using certain objects, like the GenericValue object, from OFBiz > there are a few resources you need. This error message says it can't > find the cache.properties file, so you need to add that to you > application classpath. > -David > On Feb 17, 2007, at 10:33 AM, Zoltan Vereczi wrote: >> Hi, >> >> I'm new to Ofbiz... >> I have a very simple client application based on the >> org.ofbiz.service.rmi.ExampleRemoteClient, talking to a remote >> Offbiz instance. >> I exported the userLogin service and the service call from the >> client app >> returns successfully. >> I get the userLogin object from the result map as a GenericValue fine. >> Next I try to get some fields from the GenericValue which >> fails with an Exception. >> As I debugged the client side code I realized that getting a field >> from the >> GenericValue involves GenericEntity and GenericDelegator from the >> included >> Ofbiz jars and my call fails as it tries to create a new >> GenericDelegator with >> the name "default" and tries to log this action with >> org.ofbiz.base.util.Debug. >> I get a MissingResourceException: Can't find bundle for base name >> cache, >> locale hu_HU. >> I guess it's because I don't have a configured Ofbiz instance on >> the client >> side, no configuration files, propertiy files there, only the jars, >> and I guess I don't have a delegator at all there... >> Can someone help me what do I have to do to fetch the fields of a >> GenericValue >> returned by a service on the client side? >> Do I have to setup my client app to use the remote delegator maybe? >> >> my code: >> >> // call the login service >> Map result = dispatcher.runSync("userLogin", UtilMisc.toMap >> ("login.username", >> username, "login.password", password)); >> GenericValue userLogin = (GenericValue) result.get("userLogin"); >> String userLoginId = userLogin.getString("userLoginId"); >> >> >> the Exception: >> >> Exception in thread "main" java.lang.ExceptionInInitializerError >> at org.ofbiz.base.util.Debug.<clinit>(Debug.java:92) >> at org.ofbiz.entity.GenericDelegator.getGenericDelegator( >> GenericDelegator.java:113) >> at >> org.ofbiz.entity.GenericEntity.getDelegator(GenericEntity.java: >> 271) >> at org.ofbiz.entity.GenericEntity.getModelEntity >> (GenericEntity.java:257) >> at org.ofbiz.entity.GenericEntity.get(GenericEntity.java:287) >> at >> org.ofbiz.entity.GenericEntity.getString(GenericEntity.java:543) >> at >> CallCenterAgentSession.checkLogin(CallCenterAgentSession.java:117) >> at CallCenterAgentSession.login(CallCenterAgentSession.java:98) >> at CallCenterAgent.main(CallCenterAgent.java:27) >> Caused by: java.util.MissingResourceException: >> Can't find bundle for base name cache, locale hu_HU >> at >> java.util.ResourceBundle.throwMissingResourceException(Unknown >> Source) >> at java.util.ResourceBundle.getBundleImpl(Unknown Source) >> at java.util.ResourceBundle.getBundle(Unknown Source) >> at org.ofbiz.base.util.cache.UtilCache.setPropertiesParams( >> UtilCache.java:217) >> at org.ofbiz.base.util.cache.UtilCache.setPropertiesParams( >> UtilCache.java:213) >> at org.ofbiz.base.util.cache.UtilCache.<init>(UtilCache.java:172) >> at >> org.ofbiz.base.util.UtilProperties.<clinit>(UtilProperties.java: >> 53) >> ... 9 more >> >> Thanks for your help in advance, Zoltan >> |
Free forum by Nabble | Edit this page |