Re: [Apiman-user] Logger exception
by Marc Savy
I'll try to look into it shortly and post back onto the ML.
On 30 January 2017 at 16:16, Balu S <sbalu27(a)gmail.com> wrote:
> Hi Marc,
> thanks for your quick response. Unfortunately it doesn't work.
>
> Although, what I am trying to achieve is to use "Slf4jLoggerFactory" and
> it fails with same null pointer.
>
> 2017-01-30 17:12:59,911 ERROR [org.jboss.msc.service.fail] (ServerService
> Thread Pool -- 64) MSC000001: Failed to start service
> jboss.undertow.deployment.default-server.default-host./apiman-gateway:
> org.jboss.msc.service.StartException in service jboss.undertow.deployment.
> default-server.default-host./apiman-gateway: java.lang.RuntimeException:
> java.lang.RuntimeException: java.lang.NullPointerException
> at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.
> run(UndertowDeploymentService.java:85)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1142)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> at org.jboss.threads.JBossThread.run(JBossThread.java:320)
> Caused by: java.lang.RuntimeException: java.lang.RuntimeException:
> java.lang.NullPointerException
> at io.undertow.servlet.core.DeploymentManagerImpl.deploy(
> DeploymentManagerImpl.java:236)
> at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.
> startContext(UndertowDeploymentService.java:100)
> at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.
> run(UndertowDeploymentService.java:82)
> ... 6 more
> Caused by: java.lang.RuntimeException: java.lang.NullPointerException
> at io.apiman.gateway.engine.impl.ConfigDrivenEngineFactory.instantiate(
> ConfigDrivenEngineFactory.java:179)
> at io.apiman.gateway.engine.impl.ConfigDrivenEngineFactory.create(
> ConfigDrivenEngineFactory.java:163)
> at io.apiman.gateway.engine.impl.ConfigDrivenEngineFactory.
> createLoggerFactory(ConfigDrivenEngineFactory.java:152)
> at io.apiman.gateway.engine.impl.AbstractEngineFactory.createEngine(
> AbstractEngineFactory.java:60)
> at io.apiman.gateway.platforms.war.WarGateway.init(WarGateway.java:55)
> at io.apiman.gateway.platforms.war.listeners.WarGatewayBootstrapper.
> contextInitialized(WarGatewayBootstrapper.java:
>
> On Mon, Jan 30, 2017 at 5:07 PM, Marc Savy <marc.savy(a)redhat.com> wrote:
>
>> I think you want
>> io.apiman.common.logging.DefaultDelegateFactory in that field rather
>> than SystemOutLogger directly.
>>
>> Does that work?
>>
>> The name is probably confusing - it *was* the default one at some point.
>>
>>
>>
>> On 30 January 2017 at 15:57, Balu S <sbalu27(a)gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I'm trying to simply replace the NoOpLoggerFactory to SystemOutLogger in
>>> apiman.properties and get below exception. It is quite strange as
>>> SystemOutLogger is infact implements IDelegateFactory.
>>>
>>> #apiman-gateway.logger-factory=io.apiman.common.logging.impl
>>> .NoOpLoggerFactory
>>> apiman-gateway.logger-factory=io.apiman.common.logging.impl.
>>> SystemOutLogger
>>>
>>> Also, If I try to change to Slf4jLoggerFactory, then even
>>> the Slf4jLoggerFactory.class is not found.
>>>
>>> Could you please advise if there is any reference to be added and causes
>>> below error. Thanks
>>>
>>> . Falling back to the Default. [No IDataEncrypter class configured.]
>>> 16:50:52,028 ERROR [org.jboss.msc.service.fail] (ServerService Thread
>>> Pool -- 69) MSC000001: Failed
>>> to start service jboss.undertow.deployment.defa
>>> ult-server.default-host./apiman-gateway-api: org.jbos
>>> s.msc.service.StartException in service jboss.undertow.deployment.defa
>>> ult-server.default-host./apima
>>> n-gateway-api: java.lang.RuntimeException: java.lang.ClassCastException:
>>> io.apiman.common.logging.impl.SystemOutLogger cannot be cast to
>>> io.apiman.common.logging.IDelegateFactory
>>> at org.wildfly.extension.undertow.deployment.UndertowDeployment
>>> Service$1.run(UndertowDeploym
>>> entService.java:85)
>>> at java.util.concurrent.Executors$RunnableAdapter.call(Executor
>>> s.java:511)
>>> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>>> Executor.java:1142)
>>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>>> lExecutor.java:617)
>>> at java.lang.Thread.run(Thread.java:745)
>>> at org.jboss.threads.JBossThread.run(JBossThread.java:320)
>>> Caused by: java.lang.RuntimeException: java.lang.ClassCastException:
>>> io.apiman.common.logging.impl.SystemOutLogger cannot be cast to
>>> io.apiman.common.logging.IDelegateFactory
>>> at io.undertow.servlet.core.DeploymentManagerImpl.deploy(Deploy
>>> mentManagerImpl.java:236)
>>> at org.wildfly.extension.undertow.deployment.UndertowDeployment
>>> Service.startContext(Undertow
>>> DeploymentService.java:100)
>>> at org.wildfly.extension.undertow.deployment.UndertowDeployment
>>> Service$1.run(UndertowDeploym
>>>
>>>
>>> regards
>>> Balu
>>>
>>> _______________________________________________
>>> Apiman-user mailing list
>>> Apiman-user(a)lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/apiman-user
>>>
>>>
>>
>
7 years, 3 months
How to limit access for IP Address
by Celso Agra
All,
I'd like to know if the Apiman has policies to restrict the number of
access from specific IP Address. Such as Quota Policy or Rate Limiting
Policy.
Should I have to implement this Policy?
Best Regards,
--
---
*Celso Agra*
7 years, 3 months
maven local m2 override missing.
by Balu S
Hello,
I have checked the source and one of the place that downloads plugin does
not have this m2override defined.
String m2Override =
System.getProperty("apiman.gateway.m2-repository-path");
I think Apiman gateway looks at
io.apiman.gateway.engine.impl.DefaultPluginRegistry.loadPlugin(PluginCoordinates,
IAsyncResultHandler<Plugin>)
where as Apiman manager UI reads from
io.apiman.manager.api.core.plugin.AbstractPluginRegistry.downloadPlugin(File,
PluginCoordinates)
This makes the application inconsistent. Please let me know if I can raise
JIRA or pull request ? Thanks.
Best regards
Balu
7 years, 3 months
Logger exception
by Balu S
Hello,
I'm trying to simply replace the NoOpLoggerFactory to SystemOutLogger in
apiman.properties and get below exception. It is quite strange as
SystemOutLogger is infact implements IDelegateFactory.
#apiman-gateway.logger-factory=io.apiman.common.logging.impl.NoOpLoggerFactory
apiman-gateway.logger-factory=io.apiman.common.logging.impl.SystemOutLogger
Also, If I try to change to Slf4jLoggerFactory, then even
the Slf4jLoggerFactory.class is not found.
Could you please advise if there is any reference to be added and causes
below error. Thanks
. Falling back to the Default. [No IDataEncrypter class configured.]
16:50:52,028 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool
-- 69) MSC000001: Failed
to start service
jboss.undertow.deployment.default-server.default-host./apiman-gateway-api:
org.jbos
s.msc.service.StartException in service
jboss.undertow.deployment.default-server.default-host./apima
n-gateway-api: java.lang.RuntimeException: java.lang.ClassCastException:
io.apiman.common.logging.impl.SystemOutLogger cannot be cast to
io.apiman.common.logging.IDelegateFactory
at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploym
entService.java:85)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.lang.RuntimeException: java.lang.ClassCastException:
io.apiman.common.logging.impl.SystemOutLogger cannot be cast to
io.apiman.common.logging.IDelegateFactory
at
io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:236)
at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(Undertow
DeploymentService.java:100)
at
org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploym
regards
Balu
7 years, 3 months
ApiMan error writer implementation.
by Balu Sadhasivam
Hello,
I can see in the developer guide
<http://www.apiman.io/latest/developer-guide.html> that to custom generate
IPolicyErrorWriter, one can extend using below option
4.5.3.2.6. io.apiman.gateway.engine.IPolicyErrorWriter Example Configuration
apiman-gateway.writers.policy-error=plugin:com.example.groupId:artifactId:1.0.Final/com.example.apiman.FooPolicyErrorWriterImpl
But the code base defines the error writer to be loaded from below property.
GatewayConfigPropertiesERROR_WRITER_CLASS = "apiman-gateway.writers.error";
Is this case of mistake in documentation ? Does there exists more than one
error writer API for policy and separately for other components ?
regards
Balu
7 years, 3 months
Re: [Apiman-user] How to configure CORS in APIMan? Problems with Headers in ajax
by Marc Savy
Replying to list.
This going to help me a lot! I'm still planning to update my apiman
> instance. Could I just remove my old version (1.2.3) and then deploy the
> new one with my configurations files?
Yes, that should work fine. You might want to build from master,
considering the bug you encountered. I'll see if it's possible to at least
do a snapshot release soon. People are on holiday at the moment.
How to avoid chunked encoding when the rest api is passing through APIMan?
> <http://stackoverflow.com/questions/41385736/how-to-avoid-chunked-encoding...>
At present we use chunked encoding[1] because it's much simpler when
handling mutable streaming payloads - especially if we're doing a
transformation where it is not be clear what the final payload size will be
until the process is completed (which would cause substantial buffering).
That being said, in the case of a pipeline where no body mutation policies
exist, we could consider setting content-length. I'll have to think about
it to consider whether there are any important implications. This would be
a feature request.
How to consume a service with chunked-encoding transfer in java using
> Jersey Framework
> <http://stackoverflow.com/questions/41432329/how-to-consume-a-service-with...>
Chunked encoding has been supported since HTTP/1.1, unless you are using an
extremely old/buggy version of Jersey it should work fine. It should be
pretty much transparent in practice.
Your bug might be something else. I suggest trying the latest release and
then filing a JIRA with full information (e.g. expected vs actual; console
output; configuration).
Maybe this is happen for that reason -> APIMAN 984
> <https://issues.jboss.org/browse/APIMAN-984>
>
I don't think you are using the policy mentioned in that ticket, are you?
For now, I do not found any ways to workaround that issue, so I think I'm
> gonna create a policy / plugin to solve that, just to adding a response
> header setting the Content-Length on header. I don't know if it is a good
> idea, but maybe could solve this for while.
>
You may be able to do that, but it would require buffering which will
reduce performance. It may also be tricky to determine from within the
policy which is the final chunk of a stream (with small payloads it's
likely just 1 chunk, though).
On 2 January 2017 at 22:12, Celso Agra <celso.agra(a)gmail.com> wrote:
> Thanks Marc!
>
> This going to help me a lot! I'm still planning to update my apiman
> instance. Could I just remove my old version (1.2.3) and then deploy the
> new one with my configurations files?
>
> Just to let you know... I believe I got another issue with apiman:
>
> - How to avoid chunked encoding when the rest api is passing through
> APIMan?
> <http://stackoverflow.com/questions/41385736/how-to-avoid-chunked-encoding...>
> - How to consume a service with chunked-encoding transfer in java
> using Jersey Framework
> <http://stackoverflow.com/questions/41432329/how-to-consume-a-service-with...>
>
> Maybe this is happen for that reason -> APIMAN 984
> <https://issues.jboss.org/browse/APIMAN-984>
>
For now, I do not found any ways to workaround that issue, so I think I'm
> gonna create a policy / plugin to solve that, just to adding a response
> header setting the Content-Length on header. I don't know if it is a good
> idea, but maybe could solve this for while.
>
> Thanks for your help Marc!
>
>
> 2017-01-02 17:04 GMT-03:00 Marc Savy <marc.savy(a)redhat.com>:
>
>> I addressed this for Celso over JIRA.
>>
>> Summary:
>>
>> - In general, if you're using CORS you should probably use the query
>> parameter to transmit your access token (if you have one). This is because
>> of a limitation to CORS preflight request phase which never transmits
>> custom headers.
>>
>> - A separate issue was a bug (now fixed on master) where a data structure
>> would cause certain header-value fields to be mixed up in specific
>> circumstances.
>>
>> On 28 December 2016 at 14:10, Celso Agra <celso.agra(a)gmail.com> wrote:
>>
>>> Hi all,
>>>
>>> It's me again!
>>> So, I was looking for some solutions about my issue, and I found this:
>>> https://issues.jboss.org/browse/APIMAN-516
>>>
>>> It seems this issue still occurs with me. I tries to send some headers
>>> via ajax, and get this response:
>>>
>>>> XMLHttpRequest cannot load https://apiman.url. Response to preflight
>>>> request doesn't pass access control check: No 'Access-Control-Allow-Origin'
>>>> header is present on the requested resource. Origin '
>>>> http://192.168.56.22:8080' is therefore not allowed access. The
>>>> response had HTTP status code 500.
>>>
>>>
>>> Here is the Response Headers:
>>>
>>>> Connection:close
>>>> Content-Type:application/json
>>>> Date:Wed, 28 Dec 2016 13:54:08 GMT
>>>> Server:Apache/2.4.18 (Ubuntu)
>>>> Transfer-Encoding:chunked
>>>> X-Gateway-Error:API not public.
>>>> X-Powered-By:Undertow/1
>>>
>>>
>>> and
>>>
>>> Here is the Request Headers:
>>>
>>>> Accept:*/*
>>>> Accept-Encoding:gzip, deflate, sdch, br
>>>> Accept-Language:pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4
>>>> Access-Control-Request-Headers:authorization, x-api-key
>>>> Access-Control-Request-Method:GET
>>>> Connection:keep-alive
>>>> Host: apiman.url
>>>> Origin:http://192.168.56.22:8080
>>>> Referer:http://192.168.56.22:8080/app
>>>> User-Agent:Mozilla/5.0 ...
>>>> Query String Parameters
>>>> view source
>>>> view URL encoded
>>>
>>>
>>> Does anyone has the same problem?
>>>
>>> Best regards,
>>>
>>> --
>>> ---
>>> *Celso Agra*
>>>
>>> _______________________________________________
>>> Apiman-user mailing list
>>> Apiman-user(a)lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/apiman-user
>>>
>>>
>>
>
>
> --
> ---
> *Celso Agra*
>
7 years, 3 months
Upcoming enhancement: Content-Length when no body mutating (data) policies in pipeline
by Marc Savy
Based upon a community request, I'm making a small patch that ensures the
Content-Length header is left intact when no data policies are in the
pipeline (instead of using chunked encoding). This is handy if you want the
client to know how far downloaded their file is, for instance.
*Let me know if this might have any adverse impact upon you.*
Example:
CORS <-> Rate Limiting - Content-Length set.
CORS <-> [ URL Rewriting ] - Transfer-Encoding: chunked; *no*
Content-Length set.
We don't set Content-Length in cases when body mutation may occur because
it would require buffering to determine the final size before transmission
- which is something we avoid for performance reasons.
Regards,
Marc
7 years, 3 months
Query
by pal rawat
Hi Apiman Team,
I am Devops with a startup Project. Need ur help.
We have apiman that is storing data in Elastic Search. We have Grafana,
that is using ElasticSearch as data source.One of the variable in apiman is
resource [ "resource" : {
"type" : "string"] The resource values are like
"/token/refresh", so when I trying to parse/execute calucaiton this
resource type, its displaying it as two different values like token one and
refresh another, that is wrong. I need it to as single "/token/refresh".
I know about data collector like logstash, where one can declare them as
data type URIPARAM, that can fix the problem. But not sure here.
May I request you to please help me.
Best Regards
Deepak
7 years, 3 months
Impact of adding extra fields in Rate Limiting Policy
by Ram.Tanna@ril.com
Dear Team,
I have added 2 extra fields in Rate limiting Policy, as shown in the below image.
These extra fields are added because I need it in response header in success(200) as well as failure(429) responses.
To do so I have modified below mentioned files,
1. rate-limiting.include
<div>
<span>I want to set retry time to</span>
<input id="time-limit" ng-model="config.retryTime" class="form-control inline-apiman-form-control form-control" style="width: 100px" type="text" apiman-i18n-key="rate-limiting.enter-num-requests" placeholder="Time limit" ng-disabled="isEntityDisabled()"></input>
<select id="retryTimeUnit" ng-model="config.retryTimeUnit" apiman-select-picker="" data-field="retryTimeUnit" class="selectpicker inline-line apiman-inline-form-dropdown" data-style="btn-default apiman-inline-form-dropdown" style="width: 100px" ng-disabled="isEntityDisabled()">
<option value="Second" data-content="<span class='apiman-label-faded'>Second</span>" apiman-i18n-key="rate-limiting.second">Second</option>
<option value="Minute" apiman-i18n-key="rate-limiting.minute">Minute</option>
<option value="Hour" apiman-i18n-key="rate-limiting.hour">Hour</option>
<option value="Day" apiman-i18n-key="rate-limiting.day">Day</option>
<option value="Month" apiman-i18n-key="rate-limiting.month">Month</option>
<option value="Year" apiman-i18n-key="rate-limiting.year">Year</option>
</select>
</div>
2. RateLimitingConfig
private long retryTime;
private RateLimitingPeriod retryTimeUnit;
-- getter , setters
3. RateLimitingPolicy
responseHeaders.put("X-Retry-Time", timeLimit);
Kindly Confirm,
- Where are we storing these information ? In Elastic Search, in SQL or somewhere else ?
- Will these changes make any impact on other components ?
- Would you recommend this code change ?
Kindly suggest if you have any other solution for similar requirement.
[cid:image001.png@01D26DC5.2691F410]
Regards,
Ram Tanna
9819002243
"Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s).
are confidential and may be privileged. If you are not the intended recipient. you are hereby notified that any
review. re-transmission. conversion to hard copy. copying. circulation or other use of this message and any attachments is
strictly prohibited. If you are not the intended recipient. please notify the sender immediately by return email.
and delete this message and any attachments from your system.
Virus Warning: Although the company has taken reasonable precautions to ensure no viruses are present in this email.
The company cannot accept responsibility for any loss or damage arising from the use of this email or attachment."
7 years, 3 months
Unable to get Simple Header Policy response when Rate Limiting Policy fails
by Ram.Tanna@ril.com
Hi Guys,
I have added Simple Header Policy and Rate Limiting Policy on my API.
I want my custom response header(defined in simple header policy) in all the responses.
I am getting custom header when the response is 200. But as my Rate limit exceeds I receive 429 status code and custom response doesn´t appear.
I want Custom Response Header in all the scenarios (whether its 200 or 429).
Can you please help me in achieving it ?
Thanks and Regards,
Ram Tanna
"Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s).
are confidential and may be privileged. If you are not the intended recipient. you are hereby notified that any
review. re-transmission. conversion to hard copy. copying. circulation or other use of this message and any attachments is
strictly prohibited. If you are not the intended recipient. please notify the sender immediately by return email.
and delete this message and any attachments from your system.
Virus Warning: Although the company has taken reasonable precautions to ensure no viruses are present in this email.
The company cannot accept responsibility for any loss or damage arising from the use of this email or attachment."
7 years, 4 months