code is nothing more than ofbiz demo code for component/plugin
development. In fact just the import statement alone cause the error
even if there is no other code. Similarly groovy script also complains
about ofbiz class which should be available to the framework. Following
is the the java code and error messages.

package net.rimptec.expenses.services;
import java.util.Map;
 
import org.ofbiz.base.util.Debug;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.ServiceUtil;
 
public class ExpensesServices {

    public static final String module =
ExpensesServices.class.getName();
 
    public static Map<String, Object> createExpenses(DispatchContext
dctx, Map<String, ? extends Object> context) {
        Map<String, Object> result = ServiceUtil.returnSuccess();
        Delegator delegator = dctx.getDelegator();
        try {
            GenericValue expenses = delegator.makeValue("Expenses");
            // Auto generating next sequence of expensesId primary key
            expenses.setNextSeqId();
            // Setting up all non primary key field values from context
map
            expenses.setNonPKFields(context);
            // Creating record in database for Expenses entity for
prepared value
            expenses = delegator.create(expenses);
            result.put("expensesId", expenses.getString("expensesId"));
            Debug.log("==========Expenses record created successfully
with expensesId: "+expenses.getString("expensesId"));
        } catch (GenericEntityException e) {
            Debug.logError(e, module);
            return ServiceUtil.returnError("Error in creating record in
Expenses entity ........" +module);
        }
        return result;
    }
    
} 




/home/plehal/Downloads/apache-ofbiz-
16.11.02/specialpurpose/expenses/src/main/java/net/rimptec/expenses/ser
vices/ExpensesServices.java:17: error: cannot find symbol
        Map<String, Object> result = ServiceUtil.returnSuccess();
                                     ^
  symbol:   variable ServiceUtil
  location: class ExpensesServices
/home/plehal/Downloads/apache-ofbiz-
16.11.02/specialpurpose/expenses/src/main/java/net/rimptec/expenses/ser
vices/ExpensesServices.java:18: error: cannot find symbol
        Delegator delegator = dctx.getDelegator();
        ^
  symbol:   class Delegator
  location: class ExpensesServices
/home/plehal/Downloads/apache-ofbiz-
16.11.02/specialpurpose/expenses/src/main/java/net/rimptec/expenses/ser
vices/ExpensesServices.java:20: error: cannot find symbol
            GenericValue expenses = delegator.makeValue("Expenses");
            ^
  symbol:   class GenericValue
  location: class ExpensesServices
/home/plehal/Downloads/apache-ofbiz-
16.11.02/specialpurpose/expenses/src/main/java/net/rimptec/expenses/ser
vices/ExpensesServices.java:28: error: cannot find symbol
            Debug.log("==========Expenses record created successfully
with expensesId: "+expenses.getString("expensesId"));
            ^
  symbol:   variable Debug
  location: class ExpensesServices
/home/plehal/Downloads/apache-ofbiz-
16.11.02/specialpurpose/expenses/src/main/java/net/rimptec/expenses/ser
vices/ExpensesServices.java:29: error: cannot find symbol
        } catch (GenericEntityException e) {
                 ^
  symbol:   class GenericEntityException
  location: class ExpensesServices
/home/plehal/Downloads/apache-ofbiz-
16.11.02/specialpurpose/expenses/src/main/java/net/rimptec/expenses/ser
vices/ExpensesServices.java:30: error: cannot find symbol
            Debug.logError(e, module);
            ^
  symbol:   variable Debug
  location: class ExpensesServices
/home/plehal/Downloads/apache-ofbiz-
16.11.02/specialpurpose/expenses/src/main/java/net/rimptec/expenses/ser
vices/ExpensesServices.java:31: error: cannot find symbol
            return ServiceUtil.returnError("Error in creating record in
Expenses entity ........" +module);
                   ^
  symbol:   variable ServiceUtil
  location: class ExpensesServices
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
14 errors

:compileJava FAILED




















-----Original Message-----

Date: Wed, 14 Jun 2017 11:12:45 +0200
Subject: Re: Ofbiz fails to build with a java service created in a
plugin
To: [email protected]
Reply-to: [email protected]
From: Jacques Le Roux <[email protected]>
Sorry but we will need more information to help

Maybe the stack trace, and even more the piece of code which fails with
the name of the directory where the file is placed

Jacques


Le 13/06/2017 à 21:49, Parminder S. Lehal a écrit :
> 16.11.02.
> 
> 
> 
> -----Original Message-----
> 
> Date: Tue, 13 Jun 2017 20:02:20 +0200
> Subject: Re: Ofbiz fails to build with a java service created in a
> plugin
> To: [email protected]
> Reply-to: [email protected]
> From: Jacques Le Roux <[email protected]>
> Which version are you using?
> 
> Jacques
> 
> 
> Le 13/06/2017 à 18:46, Parminder S. Lehal a écrit :
> > xxxxx is tld.companyname...The error is about missing ofbiz
> > imports.
> > 
> > Same thing happens with groovy service script too at runtime.
> > 
> > 1: unable to resolve class org.ofbiz.entity.GenericEntityException
> >    @ line 1, column 1.
> >      import org.ofbiz.entity.GenericEntityException;
> >      ^
> > 
> > 
> > 
> > 
> > -----Original Message-----
> > 
> > Date: Tue, 13 Jun 2017 14:47:24 +0300
> > Subject: RE: Ofbiz fails to build with a java service created in a
> > plugin
> > To: [email protected], [email protected]
> > From: Taher Alkhateeb <[email protected]>
> > What's exactly in the "xxxxxxx" and does it match the directory
> > structure?
> > 
> > -----Original Message-----
> > From: Parminder S. Lehal [mailto:[email protected]]
> > Sent: Tuesday, 13 June 2017 2:31 PM
> > To: user <[email protected]>
> > Subject: Ofbiz fails to build with a java service created in a
> > plugin
> > 
> > Ofbiz fails to compile with a java service created in a plugin as
> > it
> > complains about missing symbols on all ofbiz imports.
> > 
> > 
> > 
> >    } catch (GenericEntityException e) {
> >                    ^
> >     symbol:   class GenericEntityException
> >     location: class ExpensesServices
> > /home/plehal/Downloads/apache-ofbiz-
> > 16.11.02/specialpurpose/expenses/src/main/java/xxxxxxxxxxxxxx/expen
> > se
> > s/
> > services/ExpensesServices.java:30: error: cannot find symbol
> >               Debug.logError(e, module);
> >               ^
> >     symbol:   variable Debug
> >     location: class ExpensesServices
> > /home/plehal/Downloads/apache-ofbiz-
> > 16.11.02/specialpurpose/expenses/src/main/java/xxxxxxxxxxxxxxxxxxx/
> > ex
> > pe
> > nses/services/ExpensesServices.java:31: error: cannot find symbol
> >               return ServiceUtil.returnError("Error in creating
> > record
> > in
> > Expenses entity ........" +module);
> >                      ^
> >     symbol:   variable ServiceUtil
> > 
> > 

Reply via email to