googleads / googleads-java-lib

Google Ad Manager SOAP API Client Library for Java
Apache License 2.0
226 stars 360 forks source link

Support latest guice version with jakarta API #277

Closed genazenko closed 3 months ago

genazenko commented 3 months ago

Hi! We have a problem when trying to use java library in the application with the latest guice version (7.0.0). In that case we are getting an error when trying to initialize AdManagerServices

[Guice/MissingConstructor]: No injectable constructor for type AdsAxisEngineConfigurationFactory.

class AdsAxisEngineConfigurationFactory does not have a @Inject annotated constructor or a no-arg constructor.

Requested by:
1  : AdsAxisEngineConfigurationFactory.class(AdsAxisEngineConfigurationFactory.java:34)
     at AxisModule.configure(AxisModule.java:58)
      \_ installed by: AdManagerAxisModule -> AxisModule

Current version of java library is using 5.0.1 version of guice with an javax.inject.Inject annotation. But the latest version of guice is using jakarta.inject.Inject annotation.

Could you please upgrade java library in order to support jakarta API and the latest guice version?

We are using com.google.api-ads:ads-lib:5.0.0 and com.google.api-ads:dfp-axis:5.0.0 libraries with guice 7.0.0.

genazenko commented 3 months ago

This PR https://github.com/googleads/googleads-java-lib/pull/278 will solve the issue

Instead of using javax/jakarta inject API we could use google.inject API and it works for both guice 5.0.1 and guice 7.0.0 versions

ChrisBafaro commented 3 months ago

We are facing a similar issue trying to use the adManager v202405 on Java 17. The Exception happens on this code line: AdManagerServices adManagerServices = new AdManagerServices();

This is our Exception: ` Invocation of static Method 'getOrderId(java.lang.String,java.lang.String,java.lang.String,java.lang.String)' from Class 'admanager.axis.v202405.ApproveOrders' with arguments [java.lang.String orderId, java.lang.String networkCode, java.lang.String applicationName, java.lang.String filePath] resulted in an error. Expected arguments are [java.lang.String orderId, java.lang.String networkCode, java.lang.String applicationName, java.lang.String filePath]. Cause: com.google.inject.CreationException - Unable to create injector, see the following errors:

1) [Guice/ErrorInjectingConstructor]: ExceptionInInitializerError at AdsAxisEngineConfigurationFactory.(AdsAxisEngineConfigurationFactory.java:34) while locating AdsAxisEngineConfigurationFactory at AxisHandler.(AxisHandler.java:56) _ for 1st parameter while locating AxisHandler at AxisModule.configure(AxisModule.java:59) _ installed by: AdManagerAxisModule -> AxisModule while locating SoapClientHandlerInterface

Learn more: https://github.com/google/guice/wiki/ERROR_INJECTING_CONSTRUCTOR

1 error

Full classname legend:

AdManagerAxisModule: "com.google.api.ads.admanager.axis.AdManagerAxisModule" AdsAxisEngineConfigurationFactory: "com.google.api.ads.common.lib.soap.axis.conf.AdsAxisEngineConfigurationFactory" AxisHandler: "com.google.api.ads.common.lib.soap.axis.AxisHandler" AxisModule: "com.google.api.ads.common.lib.soap.axis.AxisModule" SoapClientHandlerInterface: "com.google.api.ads.common.lib.soap.SoapClientHandlerInterface"

End of classname legend:

`

Could your PR resolve this issue?

genazenko commented 3 months ago

Hi @ChrisBafaro ! Not sure if it's the same issue. But my original issue was fixed with the new release version (5.6.0). So I'm closing this issue. Feel free to open new one if it's still the case