After some more digging, we've identified the offending code that's
causing our App to fail with 202 Errors.
We do not, however, fully know the cause.
We integrate with Google Checkout and use an older version (Google
Checkout Java Code for jdk1.5).
We create a
com.google.checkout.protocol.MerchantCalculationResultBuilder to
return tax information to Google Checkout as follows:
----------------------------------------------------------------------------------------------------------------
MerchantCalculationResultBuilder.getInstance();
----------------------------------------------------------------------------------------------------------------
This, in turn, calls
com.google.checkout.sample.protocol.AbstractProtocolBuilder's
constructor:
----------------------------------------------------------------------------------------------------------------
protected AbstractProtocolBuilder() throws JAXBException,
ProtocolException {
_objectFact = new ObjectFactory();
_xmlMarshaller = createXmlMarshaller();
_xmlUnMarshaller = createXmlUnMashaller();
_domBuilder = createDomBuilder();
}
----------------------------------------------------------------------------------------------------------------
The full source of this class can be found at:
http://code.google.com/p/google-checkout-java15-sample-code/source/browse/trunk/src/com/google/checkout/sample/protocol/AbstractProtocolBuilder.java
BOTH createXmlMarshaller() and createXmlUnMashaller() in the above
constructor create a JAXBContext as follows:
----------------------------------------------------------------------------------------------------------------
JAXBContext jc =
JAXBContext.newInstance("com.google.checkout.schema._2");
----------------------------------------------------------------------------------------------------------------
And therein lies the problem. The fact that JAXBContext.newInstance()
is called twice is, for some reason, causing App Engine to eventually
fail with an Error 202.
We haven't dug into the JAXB code - it's quite complex - so we're not
exactly sure why creating 2 JAXBContext instances is not allowed on
the App Engine cloud.
Anyway, our fix is to only create 1 JAXBContext; we've refactored the
constructor above so that we no longer create 2 contexts:
----------------------------------------------------------------------------------------------------------------
protected AbstractProtocolBuilder() throws JAXBException,
ProtocolException {
// create only 1 JAXBContext and pass it into
createXmlMarshaller() and createXmlUnMashaller().
JAXBContext jc =
JAXBContext.newInstance("com.google.checkout.schema._2");
_objectFact = new ObjectFactory();
_xmlMarshaller = createXmlMarshaller(jc);
_xmlUnMarshaller = createXmlUnMashaller(jc);
_domBuilder = createDomBuilder();
}
----------------------------------------------------------------------------------------------------------------
Does anybody have any insight into WHY the creation of 2 JAXBContexts
causes App Engine to fail with Error 202?
Also, any feedback on our proposed solution would be appreciated.
Thanks.
On Aug 25, 11:05 pm, Nichole <[email protected]> wrote:
> I started seeing errors due to changes in appengine security manager
> and a new appengine
> defined user-class loader on about July 21st for classes that I was
> constructing on
> the fly dynamically in the code using Constructor. In addition to
> ExceptionInInitializerErrors there were logs statements about not
> being to resolve
> some of the members within the dynamically constructed class. Some of
> those members
> were in other jars. I added code to catch a few exceptions related to
> that and
> use the classes constructor instead.
>
> Your log statement java.lang.reflect.InvocationTargetException
> suggests that you may
> be seeing something similar.
>
> On Aug 24, 4:08 pm, Eddie C <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hello.
>
> > Our app integrates with Google Checkout.
> > As part of the checkout process, Google Checkout makes an HTTP
> > callback request to our App to calculate taxes; it is at this point
> > that we are failing. It appears that the error occurs when our App
> > attempts to process XML content in the Google Checkout callback.
>
> > Here's the error that we see in the AppEngine console:
> > ------
> > A serious problem was encountered with the process that handled this
> > request, causing it to exit. This is likely to cause a new process to
> > be used for the next request to your application.
> > If you see this message frequently, you should contact the App Engine
> > team. (Error code 202)
> > ------
>
> > Not very helpful.
>
> > We turned up the logging level and got some more detailed logs.
> > Here's an excerpt from that log:
> > ------
> > Caused by: java.lang.LinkageError: loader (instance of com/google/
> > apphosting/runtime/security/UserClassLoader): attempted duplicate
> > class definition for name: "com/google/checkout/schema/_2/
> > ShippingRestrictions$ExcludedAreas
> > $JaxbAccessorF_usStateAreaOrUsZipAreaOrUsCountryArea"
> > at
> > com.google.appengine.runtime.Request.process-5e6d2d1250669cff(Request.java)
> > at java.lang.ClassLoader.defineClass1(Native Method)
> > at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
> > ... 152 more
> > D 2011-08-21 12:19:28.208
> > com.sun.xml.bind.v2.runtime.reflect.opt.Injector inject: Unable to
> > inject com/google/checkout/schema/_2/MerchantCalculatedShipping
> > $JaxbAccessorF_name
> > java.lang.reflect.InvocationTargetException
> > at
> > com.google.appengine.runtime.Request.process-5e6d2d1250669cff(Request.java)
> > at sun.reflect.GeneratedMethodAccessor191.invoke(Unknown Source)
> > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
> > l.java:
> > 43)
> > at java.lang.reflect.Method.invoke(Method.java:43)
> > at
> > com.sun.xml.bind.v2.runtime.reflect.opt.Injector.inject(Injector.java:
> > 181)
> > at
> > com.sun.xml.bind.v2.runtime.reflect.opt.Injector.inject(Injector.java:
> > 85)
> > at
> > com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector.prepare(AccessorIn
> > jector.java:
> > 87)
> > at
> > com.sun.xml.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory.get(Optimi
> > zedAccessorFactory.java:
> > 164)
> > at com.sun.xml.bind.v2.runtime.reflect.Accessor
> > $FieldReflection.optimize(Accessor.java:252)
> > at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor
> > $CompositeTransducedAccessorImpl.<init>(TransducedAccessor.java:231)
> > at
> > com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor.get(TransducedAccess
> > or.java:
> > 173)
> > at
> > com.sun.xml.bind.v2.runtime.property.AttributeProperty.<init>(AttributeProp
> > erty.java:
> > 87)
> > at
> > com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory
> > .java:
> > 104)
> > at
> > com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java
> > :
> > 171)
> > at
> > com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.jav
> > a:
> > 481)
> > at
> > com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:
> > 315)
> > at
> > com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:
> > 139)
> > at
> > com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:
> > 117)
> > at
> > com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:
> > 188)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > 57)
> > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
> > l.java:
> > 43)
> > at java.lang.reflect.Method.invoke(Method.java:616)
> > at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:159)
> > at javax.xml.bind.ContextFinder.find(ContextFinder.java:311)
> > at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:392)
> > at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:357)
> > at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:264)
> > at
> > com.google.checkout.protocol.AbstractProtocolBuilder.createXmlUnMashaller(A
> > bstractProtocolBuilder.java:
> > 86)
> > at
> > com.google.checkout.protocol.AbstractProtocolBuilder.<init>(AbstractProtoco
> > lBuilder.java:
> > 76)
> > at
> > com.google.checkout.protocol.MerchantCalculationResultBuilder.<init>(Mercha
> > ntCalculationResultBuilder.java:
> > 44)
> > at
> > com.google.checkout.protocol.MerchantCalculationResultBuilder.getInstance(M
> > erchantCalculationResultBuilder.java:
> > 55)
> > at
> > com.company.service.shoppingcart.impl.GoogleCallbackServiceImpl.calculateSh
> > ippingAndTax(GoogleCallbackServiceImpl.java:
> > 212)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > 57)
> > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
> > l.java:
> > 43)
> > at java.lang.reflect.Method.invoke(Method.java:43)
> > at
> > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(Aop
> > Utils.java:
> > 310)
> > at
> > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoin
> > t(ReflectiveMethodInvocation.java:
> > 182)
> > at
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec
> > tiveMethodInvocation.java:
> > 149)
> > at
> > org.springframework.transaction.interceptor.TransactionInterceptor.invoke(T
> > ransactionInterceptor.java:
> > 106)
> > at
> > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec
> > tiveMethodInvocation.java:
> > 171)
> > at
> > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopPr
> > oxy.java:
> > 204)
> > at $Proxy158.calculateShippingAndTax(Unknown Source)
> > at
> > com.company.sfweb.controller.impl.GoogleMerchantCalculationCallbackControll
> > erImpl.handleEvent(GoogleMerchantCalculationCallbackControllerImpl.java:
> > 99)
> > at
> > com.company.sfweb.controller.impl.GoogleMerchantCalculationCallbackControll
> > erImpl.handleRequestInternal(GoogleMerchantCalculationCallbackControllerImp
> > l.java:
> > 61)
> > at
> > org.springframework.web.servlet.mvc.AbstractController.handleRequest(Abstra
> > ctController.java:
> > 153)
> > at
> > org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(S
> > impleControllerHandlerAdapter.java:
> > 48)
> > at
> > org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServ
> > let.java:
> > 875)
> > at
> > org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServl
> > et.java:
> > 809)
> > at
> > org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkSe
> > rvlet.java:
> > 571)
> > at
> > org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.ja
> > va:
> > 511)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> > at
> > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> > 511)
> > at org.mortbay.jetty.servlet.ServletHandler
> > $CachedChain.doFilter(ServletHandler.java:1166)
> > at
> > com.company.commons.filter.impl.CachingControlFilter.doFilter(CachingContro
> > lFilter.java:
> > 163)
> > at
> > com.company.sfweb.filters.EpFilterToBeanProxy.doFilter(EpFilterToBeanProxy.
> > java:
> > 137)
> > at org.mortbay.jetty.servlet.ServletHandler
> > $CachedChain.doFilter(ServletHandler.java:1157)
> > at org.acegisecurity.util.FilterChainProxy
> > $VirtualFilterChain.doFilter(FilterChainProxy.java:265)
> > at
> > org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecu
> > rityInterceptor.java:
> > 107)
> > at
> > org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSe
> > curityInterceptor.java:
> > 72)
> > at org.acegisecurity.util.FilterChainProxy
> > $VirtualFilterChain.doFilter(FilterChainProxy.java:275)
> > at
> > org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslati
> > onFilter.java:
> > 166)
> > at org.acegisecurity.util.FilterChainProxy
> > $VirtualFilterChain.doFilter(FilterChainProxy.java:275)
> > at
> > org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessi
> > ngFilter.java:
> > 173)
> > at org.acegisecurity.util.FilterChainProxy
> > $VirtualFilterChain.doFilter(FilterChainProxy.java:275)
> > at
> > org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(
> > SecurityContextHolderAwareRequestFilter.java:
> > 81)
> > at org.acegisecurity.util.FilterChainProxy
>
> ...
>
> read more »
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.