I am getting following error:
Response for preflight has invalid HTTP status code 401
for the code which I am using is:
$httpProvider.defaults.headers.common['Authorization'] = 'Basic auth' + "username" + ":" + "password";
When I am trying to run this code in Chrome it is giving me such error but when I am trying to run the same in Internet Explorer its working fine.
Maven dependencies:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>
application.properties:
security.user.password=password
security.user.name=username
Please help me out.
Related
I'm upgrading Payara from 4.1.1 to 4.1.2.181 and now I'm getting 401 when calling my Auth end point. My auth endpoint returns 200 (ok) but the calling application is getting 401 from Payara (as far as I can tell)
Parent pom.xml:
...
<dependency>
<groupId>fish.payara.extras</groupId>
<artifactId>payara-embedded-all</artifactId>
<version>4.1.2.181</version>
<scope>provided</scope>
</dependency>
...
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-jaxb</artifactId>
<version>2.25</version>
<scope>test</scope>
</dependency>
Sub-project pom.xml
...
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.27</version>
<scope>provided</scope>
</dependency>
...
The problem goes away when I switch back to version 4.1.1
Please assist in how I can more information in the log file or a solution to this problem.
Updates
This seems to be related to 4.1.2.181 using JWT?
Added <jaxrs-roles-allowed-enabled>false</jaxrs-roles-allowed-enabled> to glassfisf-web.xml only gives a warning in the log file
I'm seeing the following in the log file:
Could not load service class fish.payara.appserver.roles.api.extension.RolesCDIExtension
org.osgi.framework.BundleException: Unresolved constraint in bundle fish.payara.appserver.cdi-auth-roles [374]: Unable to resolve 374.0: missing requirement [374.0] osgi.wiring.package; (osgi.wiring.package=fish.payara.cdi.auth.roles)
I manage to switch on Jersey's tracing logging and got the following as the last trace in the log file:
[2018-07-17T14:41:02.968+0200] [Payara 4.1] [FINE] [] [org.glassfish.jersey.tracing.general] [tid: _ThreadID=28 _ThreadName=http-thread-pool::http-listener-1(2)] [timeMillis: 1531831262968] [levelValue: 500] [CLASSNAME: org.glassfish.jersey.message.internal.TracingLogger$TracingLoggerImpl] [METHODNAME: logImpl] [[
FINISHED Response status: 200/SUCCESSFUL|OK [ ---- ms]]]
Also found this: REST Resources secured with Jersey filter not accessible after upgrade from 174 to 181
Downgrading to Payara 4.1.2.174 works but might not be supported on the target server
Payara 4.1.2.174 is supported on the target server
I am trying to capture JSESSION ID in #beforeClass
Cookie oldCookie =
driver.get().manage().getCookieNamed("JSESSIONID");
ConsoleLog.info("COOKIE VALUE = " +
oldCookie.getValue());
but the script is failing with
org.openqa.selenium.remote.UnreachableBrowserExcepti>on: Error communicating with the remote browser. It may >have died.
I have updated gson version and the issue is fixed
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.7</version>
</dependency>
I trying to do migration from S3n to S3a for my Flink application.
I have written my custom rolling sink for writing data into aws S3. Its accepts URL as base path like S3a:///.
Its works for S3n and when i did following changes for S3a, its throws following exception.
Its seems like core-site.xml is not picking up incase of S3a for AWS credential.
its using AWS default loader for loading the credentials.
Please let me know what configuration is missing for this. Right now i am running in eclipse development enviornment,how its works in flink cluster mode?
Exception is:
com.amazonaws.AmazonClientException: Unable to load AWS credentials from any provider in the chain
at com.amazonaws.auth.AWSCredentialsProviderChain.getCredentials(AWSCredentialsProviderChain.java:117)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3521)
at com.amazonaws.services.s3.AmazonS3Client.headBucket(AmazonS3Client.java:1031)
at com.amazonaws.services.s3.AmazonS3Client.doesBucketExist(AmazonS3Client.java:994)
at org.apache.hadoop.fs.s3a.S3AFileSystem.initialize(S3AFileSystem.java:297)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2316)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:90)
at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2350)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2332)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:369)
at org.apache.hadoop.fs.Path.getFileSystem(Path.java:296)
at com.abc.abc.common.sinks.CustomRollingSink.open(CustomRollingSink.java:260)
I am using the flink 1.0.0 version and following dependecies into the project pom file and core-site .xml for AWS credentials.
<property>
<name>fs.s3a.awsAccessKeyId</name>
<value>value..</value>
</property>
<property>
<name>fs.s3a.awsSecretAccessKey</name>
<value>values...</value>
</property>
<property>
<name>fs.s3a.impl</name>
<value>org.apache.hadoop.fs.s3a.S3AFileSystem</value>
</property>
Pom file:
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-aws</artifactId>
<version>2.7.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.2.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.6.3</version>
</dependency>
There seems to be a problem with Spring Roo, GAE, and GWT.
Here is a simple roo script.
project --topLevelPackage com.my.gae --projectName gaetest --java 6
persistence setup --provider DATANUCLEUS --database GOOGLE_APP_ENGINE
entity jpa --class ~.domain.Person
field string --fieldName name
web gwt setup
web gwt all --proxyPackage ~.proxy --requestPackage ~.request
web gwt gae update
logging setup --level DEBUG
roo script <path-to-above-script>
Fix a bug in the pom by adding <scope>runtime</scope> to the datanucleus-core dependency
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.0.7</version>
<scope>runtime</scope>
</dependency>
3. mvn gae:run
There will be many errors.
[INFO] Checking rule
[INFO] [ERROR] Errors in 'file:/C:/Java/Roo/MyRooSamples/gae6/src/main/java/com/my/gae/client/managed/req
uest/ApplicationRequestFactory.java'
[INFO] [ERROR] Line 11: No source code is available for type com.my.gae.request.PersonRequest; did you
forget to inherit a required module?
[INFO] [ERROR] Errors in 'file:/C:/Java/Roo/MyRooSamples/gae6/src/main/java/com/my/gae/client/managed/act
ivity/ApplicationDetailsActivities_Roo_Gwt.java'
[INFO] [ERROR] Line 29: No source code is available for type com.my.gae.proxy.PersonProxy; did you for
get to inherit a required module?
[INFO] [ERROR] Errors in 'file:/C:/Java/Roo/MyRooSamples/gae6/src/main/java/com/my/gae/client/managed/act
ivity/ApplicationMasterActivities_Roo_Gwt.java'
I am using 1.2.1.RELEASE [rev 6eae723] of Roo.
Is there a workaround or perhaps I have made an error ?
I was getting several errors as well when trying to create GWT application for the Google App Engine using Spring Roo 1.2.1. I created my project using the SpringSource Tool Suite (STS). Took me forever, but I finally got it working by making some changes to my pom.xml.
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.0.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jdo</artifactId>
<version>3.0.7</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>3.0.7</version>
</dependency>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rdbms</artifactId>
<version>3.0.7</version>
</dependency>
I also enabled Datanucleus Support (right click on project, Datanucleus -> Add Data Nucleus Support), then enhanced the classes manually (right click on project, Datanucleus -> Run Enhancer Tool). These Datanucleus steps failed without the preceding pom.xml changes.
The application launches fine. However, now I can't get the RequestValidationTool to work.
I am learing REST throught java using JBoss RestEasy. To use JAXB api implementation I given the following dependency in pom.xml, {I am using maven project in eclipse}
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.3.1.GA</version>
</dependency>
But I am getting some set of build errors. But the below is the root cause of the errors I guess,
ArtifactDescriptorException: Failed to read artifact descriptor for javax.xml.stream:stax-api:jar:1.0-2:
ArtifactResolutionException: Failure to transfer javax.xml.stream:stax-api:pom:1.0-2 from
http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval
of central has elapsed or updates are forced.
Original error: Could not transfer artifact javax.xml.stream:stax-api:pom:1.0-2 from/to central (http://repo1.maven.org/maven2): null to http://repo1.maven.org/maven2/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.pom
By the above error I understand that it failed to transfer the stax-api depency file. I added the dependency for that stax-api later. But no use. Still getting the same error.
Is my perception of the above error correct? If so do I have to give the repository info for this file too in pom.xml? Then is it not contradicting the main advantage of Maven usage(auto download of dependency files)?
Please correct me if I were wrong
Below is my complete pom.xml,
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.droidaceapps.services</groupId>
<artifactId>RestServicesProject</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>RestServicesProject Maven Webapp</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>jboss</id>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.3.1.GA</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>2.3.1.GA</version>
</dependency>
</dependencies>
<build>
<finalName>RestServicesProject</finalName>
</build>
</project>
Thanks
Hurrah...I solved this. I did execute the MVN from command line .. it just worked. Then I went back to eclipse and refreshed the project then all the bugs gone and all dependancies are in place.
seems there is a problem with the m2eclipse plugin (whichi I conculde as root cause of the bug.. :-)
i solved this problem....not using maven.......just by creating a Dynamic web project...with jboss server..with web.xml
and then...go to source > new >other >web service > create a sample restful web serivce
click to update the web.xml......and it support jboss in eclipse