ATG Rest full API addItemToOrder is not working - atg

I am working on ATG Web-commerce REST Full API, addItemToOrder is not working.
This is the Error:
{
"formError": true,
"formExceptions": [
{
"localizedMessage": "Unable to process the request currently. Please try again after some time",
"errorCode": "atg.droplet.DropletException"
}
],
"concurrentUpdate": false
}
http://IP:Port/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder
I have checked the server log file, Null pointer exception is showing.
/atg/dynamo/servlet/pipeline/RequestScopeManager/RequestScope-143/atg/commerce/order/purchase/CartModifierFormHandler --- java.lang.NullPointerException
**** Error /atg/dynamo/servlet/pipeline/RequestScopeManager/RequestScope-143/atg/commerce/order/purchase/CartModifierFormHandler at atg.siebel.catalog.SiebelCatalogTools.updateQuoteWithProfileDetails(SiebelCatalogTools.java:3681)
/atg/dynamo/servlet/pipeline/RequestScopeManager/RequestScope-143/atg/commerce/order/purchase/CartModifierFormHandler at atg.siebel.catalog.SiebelCatalogTools.checkProductEligibility(SiebelCatalogTools.java:3384)
/atg/dynamo/servlet/pipeline/RequestScopeManager/RequestScope-143/atg/commerce/order/purchase/CartModifierFormHandler at atg.siebel.validation.SiebelValidator.validateProductEligibility(SiebelValidator.java:141)
/atg/dynamo/servlet/pipeline/RequestScopeManager/RequestScope-143/atg/commerce/order/purchase/CartModifierFormHandler at atg.siebel.order.purchase.SiebelCartModifierFormHandler.preAddItemToOrder(SiebelCartModifierFormHandler.java:569)
/atg/dynamo/servlet/pipeline/RequestScopeManager/RequestScope-143/atg/commerce/order/purchase/CartModifierFormHandler at atg.commerce.order.purchase.CartModifierFormHandler.handleAddItemToOrder(CartModifierFormHandler.java:3035)
/atg/dynamo/servlet/pipeline/RequestScopeManager/RequestScope-143/atg/commerce/order/purchase/CartModifierFormHandler at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
/atg/dynamo/servlet/pipeline/RequestScopeManager/RequestScope-143/atg/commerce/order/purchase/CartModifierFormHandler at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
/atg/dynamo/servlet/pipeline/RequestScopeManager/RequestScope-143/atg/commerce/order/purchase/CartModifierFormHandler at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
/atg/dynamo/servlet/pipeline/RequestScopeManager/RequestScope-143/atg/commerce/order/purchase/CartModifierFormHandler at java.lang.reflect.Method.in
(there are more lines of error Unable to post here),
Would it be because of product sync issue? or sku's issue..?
Please help

Still a bit difficult to work out exactly where the error is but considering that you are calling the updateQuoteWithProfileDetails(Quote,RepositoryItem) method and in the calling method there is a null check on the RepositoryItem (profile) and Quote is new, then the only line that could end up with a NullPointerException in the calling code is:
parentOrganizationOfProfile = (RepositoryItem) profile.getPropertyValue(getProfilePropertyParentOrganization());
Which means that the ProfileParentOrganisation value on the profile RepositoryItem is null.
The rest of the code in that method (according to the source provided by ATG in the reference application) all provide null checks.

Related

Spring WebMVC Exception Handling

I have a global exception handler that extends ExceptionHandlerExceptionResolver that handles exceptions thrown from my #RestController. The JSON payload returned in the response includes an "exception" field. E.g.
{
"timestamp": 01010101010101
"exception": <some exception class>
}
After upgrading from spring-webmvc 4.3.22.RELEASE to 5.0.8.RELEASE, the exception field is missing. Any idea if this is a Spring change, or is this likely my code?
Found it. server.error.include-exception is false by default. Setting it to true re-introduces this behavior.

ProviderIncompatibleException with Entity Framework

I always get this error when I issue this command
http://localhost:19572/api/courses
This method is generating the exception
public IQueryable GetAllCourses()
{
return _ctx.Courses
.Include(“CourseSubject”)
.Include(“CourseTutor”)
.AsQueryable();
}
Exception:
System.Data.Entity.CoreProviderIncompatibleExceptionoccurred inEntityFramework.dll` but was not handled in user code
Additional information An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.
and when I inspect the JSON element in Fiddler I always get this
ExceptionMessage=The system cannot find the file specified
ExceptionType=System.ComponentModel.Win32Exception
Message=An error has occurred.
I am using Entity Framework 6.0.1, and I have tried 5 but it didn’t work so I there any thing wrong with Entity Framework version or what?

How to read Wildfly resteasy deserialization error from client?

My Wildfly resteasy service is working fine, or was until I made a code change. No big deal, now I'm getting a deserialization error: "Problem deserializing 'setterless' property ..."
My question is whether there is anyway to get an error message in the client. I'm getting a Status of 400, and I can test that, but I'd like to get any message if possible. Any ideas?
If I get an error in the user code, I can set an error message in the header, but since there is a deserialization problem, the server is throwing a error before getting to any user code.
You can use an ExceptionMapper to handle the response returned to the client. JAX-RS has an exception hierarchy that will map to different responses and status codes. 400 in JAX-RS is a BadRequestException. So you could do something like
#Provider
public class BadRequestExceptionMapper
implements ExceptionMapper<BadRequestException> {
#Override
public Response toResponse(BadRequestException e) {
Response response = Response.status(Response.Status.BAD_REQUEST)
.entity("Sorry I forgot to implement a Setter").build();
return response;
}
}
This isn't a very great example, because BadRequestException is thrown for many other reasons, than just forgetting a setter (or deserialization), but it demonstrates how you can intercept the response after the exception is thrown.
See RestEasy Exception Handling
Jersey User Guider has a better explanation
See Exception Hierarchy

Xpage Extension Library Rest Service return: http 200 Bad Request, Unable to read Unread Marks

I coded an Xpage extension library rest service, and it worked until today, in my development enviroment it worked but not in prodution (same documents):
Here the response when ajax contact rest service:
{
"code":400,
"text":"Bad Request",
"message":"Unable to read Unread Marks",
"type":"text",
"data":"com.ibm.domino.services.ServiceException:
at com.ibm.domino.services.rest.das.view.RestViewNavigatorFactory$NOINavigator.getRead(RestViewNavigatorFactory.java:175)
at com.ibm.domino.services.rest.das.view.RestViewItemFileService.writeSystemColumns(RestViewItemFileService.java:359)
at com.ibm.domino.services.rest.das.view.RestViewItemFileService.writeEntryAsJson(RestViewItemFileService.java:308)
at com.ibm.domino.services.rest.das.view.RestViewItemFileService.renderServiceJSONGet(RestViewItemFileService.java:280)
at com.ibm.domino.services.rest.das.view.RestViewItemFileService.renderService(RestViewItemFileService.java:77)
at com.ibm.domino.services.HttpServiceEngine.processRequest(HttpServiceEngine.java:167)
at com.ibm.xsp.extlib.component.rest.UIBaseRestService._processAjaxRequest(UIBaseRestService.java:242)
at com.ibm.xsp.extlib.component.rest.UIBaseRestService.processAjaxRequest(UIBaseRestService.java:219)
at com.ibm.xsp.util.AjaxUtilEx$1.invokeContextCallback(AjaxUtilEx.java:194)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:862)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at com.ibm.xsp.component.UIDataPanelBase.invokeOnComponent(UIDataPanelBase.java:416)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:878)
at com.ibm.xsp.component.UIViewRootEx.invokeOnComponent(UIViewRootEx.java:1552)
at com.ibm.xsp.util.AjaxUtilEx.renderAjaxPartialLifecycle(AjaxUtilEx.java:188)
at com.ibm.xsp.webapp.FacesServletEx.renderAjaxPartial(FacesServletEx.java:225)
at com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:170)
at com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160)
at com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138)
at com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:583)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1281)
at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:854)
at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:803)
at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:572)
at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1265)
at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:658)
at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:481)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:341)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:297)
at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
Caused by: NotesException: Unable to read Unread Marks
at lotus.domino.local.ViewEntry.getRead(Unknown Source)
at com.ibm.domino.services.rest.das.view.RestViewNavigatorFactory$NOINavigator.getRead(RestViewNavigatorFactory.java:173)
... 35 more
"
}
I have no idea what going wrong.
It just stop working
Are you using one of the provided examples to just get a documentCollection? If not, are unread marks on for your production database? Does your REST call have access/does your database allow anonymous access via REST if not?
Your error is here:
at lotus.domino.local.ViewEntry.getRead(Unknown Source)
This method of the NotesViewEntry class looks for the user name in order to know whether to return a boolean telling if the entry has been read. If no user is specified, it returns for the current user, and that may be the server or who is authenticated in the REST service.
Also, I find this http://www-10.lotus.com/ldd/nd8forum.nsf/5f27803bba85d8e285256bf10054620d/2f8ee50784b70b06852577dc0050efeb?OpenDocument saying unread marks are not working in some releases, but I've not been able to verify it.
If you can remove the line calling for getRead() and run it, that will confirm for you.
Cheers,
Brian

Problem verifying signed mail with bouncycastle API only in axis2 webservice environment

here's my very strange problem :
I wrote a ws that checks a signed mail with bouncycastle API. When I test the method outside axis2 environment, all works fine. As soon as i've deployed the ws in tomcat, all goes wrong. I've got a strange exception that I've localized in the bc api, in the readObject() method, when the api try to cast the mime message to asn1 structure.
Here's the exception :
Caused by: org.bouncycastle.cms.CMSException: IOException reading content.
at org.bouncycastle.cms.CMSUtils.readContentInfo(Unknown Source)
at org.bouncycastle.cms.CMSUtils.readContentInfo(Unknown Source)
at org.bouncycastle.cms.CMSSignedData.<init>(Unknown Source)
at org.bouncycastle.mail.smime.SMIMESigned.<init>(Unknown Source)
... 32 more
Caused by: java.io.EOFException: EOF found when length expected
at org.bouncycastle.asn1.ASN1InputStream.readLength(Unknown Source)
at org.bouncycastle.asn1.ASN1InputStream.readLength(Unknown Source)
at org.bouncycastle.asn1.ASN1InputStream.readObject(Unknown Source
The exception is raised when i call the SignedMailValidator constructor.
private static SignBean verifySignedMail(MimeMessage msg, PKIXParameters param, Log log)
throws SarvaraException
{
String errorSubject = "";
String errorDetails = "";
SignBean signReturn = new SignBean();
// set locale for the output
Locale loc = Locale.FRENCH;
// Locale loc = Locale.GERMAN;
// validate signatures
SignedMailValidator validator;
try
{
validator = new SignedMailValidator(msg, param);
...
I dont think the problem comes from the code I wrote because everything's ok oustide axis2 environment. I'm really stuck and I've found nothing about that anywhere. By the way, the MimeMessage constructor takes the Sytem properties in parameter and to be sure that was not the point, I've put exactly the same System properties in both environment (standalone prog and axis2 ws). Every suggestions would be welcome. Thanks you all.
Ok, I've found the problem, and that's really strange... As soon as I remove the geronimo-javamail librarie from the tomcat classpath, all goes well... I really dont know what is the problem with this librarie but the fact is tomcat felt better without it.