WSO2 AS 5.2.1. Servlet Exception while making the decision : java.lang.NullPointerException - wso2

i was actual trying this tutorial: http://wso2.com/library/tutorials/2012/12/providing-xacml-fine-grained-authorization-webapps/
on the authentication with admin:admin on localhost:9763/Entitlement_Sample_WebApp/protected.jsp i encountered an error:
exception
org.wso2.carbon.identity.entitlement.filter.exception.EntitlementFilterException: Exception while making the decision : java.lang.NullPointerException
org.wso2.carbon.identity.entitlement.filter.EntitlementFilter.doFilter(EntitlementFilter.java:191)
My WSO2 IS PDP receives the request and responds also correctly with a XACML Response : Permit
so where could be the problem ??
thank you

The problem caused by an error of EntitlementFilter, so I could solve this by correcting the source file EntitlementFilter.java (line 191)
like below:
simpleDecision = decisionElement.getFirstChildWithName(new QName("Result")).getFirstChildWithName(new QName("Decision")).getText();
rewrite it:
simpleDecision = decisionElement.getFirstChildWithName(new QName(“urn:oasis:names:tc:xacml:3.0:core:schema:wd-17″,”Result”)).
getFirstChildWithName(new QName(“urn:oasis:names:tc:xacml:3.0:core:schema:wd-17″,”Decision”)).getText();
It ommitted namespace in QName method
The detail is here (https://nparkstar.wordpress.com/2015/01/27/wso2-as-sample-authorization-%EC%98%A4%EB%A5%98-%EC%88%98%EC%A0%95/).
Sorry, it is written in Korean, but I wish it could helpful.

It could be anywhere starting from this line : pepProxy.getDecision(userName, resource, action, env)
It could be in your pepProxy code, where they are getting back the result, or might be in the other lines after this call in that try catch.
One thing is sure PDP is not at all culprit.
Please paste your full exception here if you want to know precise problem + Solution.
:)

Related

Camunda- Acessing to a specific json element

I would like to obtain in a response of http-connector, only the “number” element, but I cannot obtain it.
I’m trying to have an inline Javascript with the following statement:
S(response).prop(“status”).prop(“number”).numberValue();
but it shows an error: SPIN/JACKSON-JSON-01004 Unable to find ‘status’
What it’s wrong in the statement?
Rest response to parse:
{
“status”: {
“number”: 200,
“type”: “OK”,
“description”: “Status OK”
}
}
There is no obvious issue with your expression. I would debug further to see if response indeed contanis the Json string you posted. The error shows that response exists, but the content differs.
This working example I just created may help you:
https://github.com/rob2universe/camunda-http-connector-example
If this does not help, you could share more info, e.g. the process model, server log, service you are calling...

Error when run command (start IOUFlow iouValue: 99, otherParty: "O=PartyB,L=New York,C=US") in (hello world 1)

i have followed all the steps in hello world 1
https://docs.corda.net/hello-world-template.html
https://github.com/corda/cordapp-template-kotlin
but when run this command
i have faced this error:
[ERROR] 20:14:21+0200 [Node thread-1] proxies.ExceptionSerialisingRpcOpsProxy.log - Error during RPC invocation [errorCode=ue63ey, moreInformationAt=https://errors.corda.net/OS/4.0/ue63ey] {actor_id=internalShell, actor_owning_identity=O=PartyA, L=London, C=GB, actor_store_id=NODE_CONFIG, fiber-id=10000001, flow-id=ef20094f-ecea-4004-b6dc-e687f88fdce9, invocation_id=c783d17e-1a70-4ec9-93ca-cb08714afac7, invocation_timestamp=2019-03-12T18:14:18.869Z, origin=internalShell, session_id=e7787152-785d-47fc-a5a6-e8893a730942, session_timestamp=2019-03-12T18:14:02.935Z, thread-id=221, tx_id=E38133ECBB005885B0DFD501A214C928AB67C34188C7B0F0BD659825487A27AF}
I can't understand the meaning of the error
how can solve this error ?
It got resolved by adding #BelongsToContract annotation on IOUState class. Thanks to gerferra for helping :)
#BelongsToContract(TemplateContract.class)
public class IOUState implements ContractState {
...
}
This error means the real exception can be found in the node logs.
We will probably adjust this in a future release so all exceptions are sent back to the RPC client instead of just some of them.
I'm having the same problem. The node logs report:
net.corda.core.contracts.TransactionVerificationException$TransactionRequiredContractUnspecifiedException:
State of class com.template.IOUState does not have a specified owning
contract. Add the #BelongsToContract annotation to this class to
ensure that it can only be bundled in a TransactionState with the
correct contract.
Adding the annotation to the IOUState class solved the problem.
[Thread-19 (ActiveMQ-client-global-threads)] custom.ThrowableSerializer.fromProxy - Unexpected exception de-serializing throwable: net.corda.core.contracts.TransactionVerificationException$TransactionRequiredContractUnspecifiedException. Converting to CordaRuntimeException. [errorCode=39z9vh, moreInformationAt=https://errors.corda.net/OS/4.0/39z9vh]
java.lang.reflect.InvocationTargetException: null
|
|
Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method net.corda.core.contracts.TransactionVerificationException$TransactionRequiredContractUnspecifiedException., parameter state
at net.corda.core.contracts.TransactionVerificationException$TransactionRequiredContractUnspecifiedException.(TransactionVerificationException.kt) ~[corda-core-4.0.jar:?]

Web Service Error 400 - Bad Request

I have a perplexing issue. I have Web Service A (henceforth WSA), a 3.5 .Net WCF, which I have added a call to Web Service B (henceforth WSB) which is a 3.5 .Net ASMX. When running WSA in the client (SOAPUI or WCFStorm), the WSB call times out per the client timeout setting.
In the VS event viewer I can see that the call to WSB immediately throws two error 400s:
Exception thrown: 'System.Net.WebException' in System.dll ("The remote
server returned an error: (400) Bad Request."). Exception thrown:
'System.Net.WebException' in System.dll ("The remote server returned
an error: (400) Bad Request.")
No reason is given. What is just as puzzling to me is the error doesn't go to my catch. When I debug and I hit the line of code that calls WSB, it's like a reset. No further code gets executed and no error is thrown by my WSA.
If I call WSB directly, it works. So nothing is wrong with WSB. At suggestion of a coworker, I took the code specific to my change and put it in a stand-alone service. I literally C&P the code and configs setting specific to me and adjust namespaces and class names. Lo and behold it works. My stand-alone web service called WSB just fine and get the data I expect.
A coworker and I checked the logs (IIS log for the service and the HTTPERR log) on the IIS server that WSB resides on to see if there was any mention of the 400 error. We found none.
So we are kind of perplexed at this point. The only thing we can think of is perhaps something in the web config might be interfering but have no idea what it could be.
If you have any suggestions of where else to look that would be helpful.
And it would be nice to know why it isn't falling into my error handler.
Thanks.
Update: It was requested I add config and code. I don't think it will help honestly and it is pretty straightforward. I can't put the real code due to company reasons but it is basically this:
In web config:
<configuration>
<appSettings>
<add key="endpointUrl" value = "someurl" />
</appSettings>
.
.
.
<applicationSettings>
<MyService.Properties.Settings>
<setting name="MyService_TheirService"
serializeAs="String">
<value>someurl</value>
</setting>
</MyService.Properties.Settings>
</applicationSettings>
Even though the data is super small I did try making large reader settings and such:
<binding name="CustomHtttpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" closeTimeout="01:50:00" openTimeout="01:50:00" sendTimeout="01:50:00" receiveTimeout="01:50:00" >
<readerQuotas maxDepth="128"
maxStringContentLength="8388608"
maxArrayLength="2147483646"
maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
</binding>
Code:
using MyService.TheirService
.
.
.
var theirURL = ConfigurationManager.AppSettings["endpointUrl"];
var oSvc = new TheirServiceObject
{
Url = theirURL
};
int numberIneed = oSvc.SomeMethod();
That last line is where it throws the 400.
UPDATE 2:
A colleague show me how to use Fiddler. And I can now see that the request to WSB is absolute garbage.
xڭ s 6 mr!!u \ .3 5'3 G QOH>Iп kX M3 ~vY ) X e Z
w ~ :jv -ݴwڽHb Yqv A :(Q Z; >9W O0g 6 .ɖVlU Ţ 8Z
< ( t eSv U]r R $N \
Some odd encoding? At least it's another clue.
Wanted to let you know this problem was solved. Another Dev that had worked on this service before but no longer just happened to walk by and I said "Hey! Look at this!"
They saw the garbage request data and said "That looks like compression. Look up compression in the project."
Turn out there was a custom compression component that was compressing the outgoing data of the service and you needed to add 2 lines of code to decompress. After adding those lines to the top of my method everything immediately worked.
The lesson here is if your project is doing some weird stuff that defies reason, try and find as many people as you can that worked on it before even if they aren't working on it anymore.

NullPointerException [no message] -- how can I find its source?

I have NullPointerException [no message] in my luminus application. The code is quite long to post it here and I can't find the source of the error. Neither there's any mention of "NullPointerException [no message]" in the logs, and in the browser the error just doesn't make sense and the exact place and variables where the error is caused aren't shown precisely.
How can I trace what causes the error?
the approach that i take for such errors is
if it is a new error (started happening recently), then most probably it is being caused by the code that was added recently. so use that code as the starting point
see if there are any API calls which might be returning a nil value. try to replace every API w/ a real hardcoded value, one-by-one, and see if you're still seeing the error
once you figure out which API call is returning nil, then dig deeper to see if you're passing any wrong arguments to the API, or causing some case due to which it is returning the nil
HTH :)
Clojure's error messages can be hell but they aren't useless. Take a look at this link:
https://8thlight.com/blog/connor-mendenhall/2014/09/12/clojure-stacktraces.html
It helped me out and hope it can do the same for you
Null pointer exception is caused because of accessing / using a variable which holds the value. As a programmer we have to do null chuck to the variable which are returning a value from other functions.
If you want to trace it just keep debug point from which action you are getting this error n chuck which variable your accessing as null value.

SSOFilter java.lang.NullPointerException

I have created sample sso wso2 program with help of existing code which I have downloaded from wso2 website and follow the same steps. But when I am executing my programm I am getting error
SEVERE: Exception starting filter SSOFilter
java.lang.NullPointerException at
org.wso2.carbon.identity.sso.agent.util.SSOAgentConfigs.isSAMLSSOLoginEnabled(SSOAgentConfigs.java:345)
at
org.wso2.carbon.identity.sso.agent.util.SSOAgentConfigs.initCheck(SSOAgentConfigs.java:222)
at
org.wso2.carbon.identity.sso.agent.SSOAgentFilter.init(SSOAgentFilter.java:53)
at
org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at
org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:105)
at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4854)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5546)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask.run(FutureTask.java:262) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Thre
As per the source I referred, there isn't way of throwing NPE from that line since it have following code,
public static boolean isSAMLSSOLoginEnabled() {
return samlSSOLoginEnabled;
}
And I found this matching lines in older v1.2.0 of org.wso2.carbon.identity.sso.agent component [1].
So in order to resolve the issue, you need to find the correct source of the relevant jar, debug the flow and need to check exactly which variable it use a null reference to access something.
If you find difficulty finding a source of a relevant component, raise a separate question mentioning the versions you are looking for.
[1] https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/identity/org.wso2.carbon.identity.sso.agent/1.2.0/src/main/java/org/wso2/carbon/identity/sso/agent/util/SSOAgentConfigs.java
HTH,
DarRay