I'm using maven to run my selenium tests but it doesn't find this tests i put it under src/test/java. My test class is named SeleniumTest.java so it follows convention (*Test.java) here's the code :
<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>com.tests.functional.selenium</groupId>
<artifactId>functionalTestsSelenium</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>functionalTestsSelenium Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium.client-drivers</groupId>
<artifactId>selenium-java-client-driver</artifactId>
<version>1.0.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>functionalTestsSelenium</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.0-beta-1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
</plugin>
<!-- Start the tomcat server and Deploy the war -->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<wait>false</wait>
<container>
<containerId>tomcat6x</containerId>
<type>installed</type>
<home>${env.CATALINA_HOME}</home>
</container>
</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Start the selenium server -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
<configuration>
<background>true</background>
<logOutput>true</logOutput>
</configuration>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop-server</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Fire the function tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<junitArtifactname>
org.junit:com.springsource.org.junit
</junitArtifactname>
<excludes>
excluding the test class in the functional tests package
during the test phase
<exclude>**/functional/*Test.java</exclude>
</excludes>
</configuration>
<executions>
<execution>
<!-- Running the tests in the functional tests package during the integration tests phase. -->
<id>integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/functional/*Test.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
here's my test class :
package functional;
import com.thoughtworks.selenium.SeleneseTestCase;
public class SeleniumTest extends SeleneseTestCase {
#Override
public void setUp() throws Exception {
setUp("http://www.netapsys.fr"); // délégation de la configuration à la classe parente
}
public void test() {
selenium.open("/"); // ouverture de la page
selenium.waitForPageToLoad("5000");
assertTrue(selenium.isTextPresent("Netapsys"));
}
}
here's the console result after running :
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building seleniumproject Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # seleniumproject ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # seleniumproject ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # seleniumproject ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\neila\workspace\seleniumproject\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # seleniumproject ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # seleniumproject ---
[INFO] No tests to run.
[INFO] Surefire report directory: C:\Users\neila\workspace\seleniumproject\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-war-plugin:2.0.2:war (default-war) # seleniumproject ---
[INFO] Exploding webapp...
[INFO] Assembling webapp seleniumproject in C:\Users\neila\workspace\seleniumproject\target\seleniumproject
[INFO] Copy webapp webResources to C:\Users\neila\workspace\seleniumproject\target\seleniumproject
[INFO] Generating war C:\Users\neila\workspace\seleniumproject\target\seleniumproject.war
[INFO] Building war: C:\Users\neila\workspace\seleniumproject\target\seleniumproject.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.922s
[INFO] Finished at: Wed Jul 04 08:18:56 GMT+01:00 2012
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
Your test belongs to the package functional. Thus, it will not run during the test phase, as your pom specifies that any *functional* package should be excluded:
<configuration>
<junitArtifactname>
org.junit:com.springsource.org.junit
</junitArtifactname>
<excludes>
excluding the test class in the functional tests package
during the test phase
<exclude>**/functional/*Test.java</exclude>
</excludes>
</configuration>
Your pom is configured to start (and stop) the Selenium server during the pre-integration-test and post-integration-test phases. However, during these phases, you do not ask to run any test. I suggest that you have a look on the failsafe Maven plugin to run your functional.* Selenium tests during the integration-test phase.
Related
I have a Maven project and I'm using TestNG. My build completes in Jenkins, but the tests I want to run are not actually executed. I have my console output from Jenkins and my pom.xml file. Hopefully, something can be gleaned from this. The tutorials I've followed all seem to do something a little different with config settings or plug-ins. I meticulously followed one tutorial but somewhere I've done not something correctly. I would be hugely indebted for any assistance.
17:15:56 [INFO] Scanning for projects...
17:15:56 [INFO]
17:15:56 [INFO] -----------------< >------------------
17:15:56 [INFO] Building test 1.0-SNAPSHOT
17:15:56 [INFO] --------------------------------[ jar ]---------------------------------
17:15:57 [INFO]
17:15:57 [INFO] --- maven-clean-plugin:2.5:clean (default-clean) # test ---
17:15:57 [INFO]
17:15:57 [INFO] --- maven-resources-plugin:2.6:resources (default-resources) # test ---
17:15:57 [INFO] Using 'UTF-8' encoding to copy filtered resources.
17:15:57 [INFO] skip non existing resourceDirectory /dbdata/testauto/home/testauto/jenkins/workspace/_7692-api-test-gestion-binaire/src/main/resources
17:15:57 [INFO]
17:15:57 [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # test ---
17:15:57 [INFO] Changes detected - recompiling the module!
17:15:57 [INFO] Compiling 15 source files to /dbdata/testauto/home/testauto/jenkins/workspace/_7692-api-test-gestion-binaire/target/classes
17:15:57 [INFO]
17:15:57 [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # test ---
17:15:57 [INFO] Not copying test resources
17:15:57 [INFO]
17:15:57 [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # test ---
17:15:57 [INFO] Not compiling test sources
17:15:57 [INFO]
17:15:57 [INFO] --- maven-surefire-plugin:3.0.0-M1:test (default-test) # test ---
17:15:57 [INFO] Tests are skipped.
17:15:57 [INFO]
17:15:57 [INFO] --- maven-jar-plugin:2.4:jar (default-jar) # test ---
17:15:58 [INFO] Building jar: /dbdata/testauto/home/testauto/jenkins/workspace/_7692-api-test-gestion-binaire/target/test-1.0-SNAPSHOT.jar
17:15:58 [INFO]
17:15:58 [INFO] --- maven-install-plugin:2.4:install (default-install) # test ---
And this is my pom.xml file
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
</plugins>
<directory>target</directory>
<outputDirectory>target/classes</outputDirectory>
<finalName>${project.artifactId}-${project.version}</finalName>
<testOutputDirectory>target/test-classes</testOutputDirectory>
<sourceDirectory>src/main/java</sourceDirectory>
<!--scriptSourceDirectory>src/main/scripts</scriptSourceDirectory-->
<testSourceDirectory>src/test/java</testSourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.1</version>
<type>maven-plugin</type>
</dependency>
</dependencies>
I am using Spring Cloud Functions with Kafka Binder. My application SpringcloudfuncApplication.class
is pretty straightforward as can be seen below:
#SpringBootApplication
#Log4j2
public class SpringcloudfuncApplication {
public static void main(String[] args) {
SpringApplication.run(SpringcloudfuncApplication.class, args);
}
#Bean
public Function<Message<String>, String> greeter() {
return (input) -> {
log.info("Hello {}", input.getPayload());
return "Hello " + input.getPayload();
};
}
}
I am expecting a incoming StringInput then will return a greeting -> Hello {StringInput}
I have setup a self-managed Apache Kafka/Zookeeper on AWS EC2 instance with public access for testing purposes then updated my application.yml file:
spring:
cloud:
function:
definition: greeter
stream:
kafka:
default:
consumer:
startOffset: earliest
binder:
brokers: ec2-13-212-236-60.ap-southeast-1.compute.amazonaws.com:9092
bindings:
greeter-in-0:
destination: topic-names
greeter-out-0:
destination: topic-greetings
Everything is working fine on my local setup pointing to this AWS EC2 with Kafka/Zookeeper. However, I am not able to make this work when I attempt to create a function in AWS Lambda with my shaded jar then added Apache Kafka for trigger. I have followed this AWS Blog in setting up AWS Lambda with self-hosted Kafka as an Event source.
Take note that doing a AWS Lambda test by sending a string (using hello-world template) my function works. But adding a Kafka trigger gives me below error:
Last processing result: PROBLEM: Lambda internal error. Please contact Lambda customer support.
Maven dependencies:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-function-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-adapter-aws</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Maven build plugin for shaded JAR:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
<dependencies>
<dependency>
<groupId>org.springframework.boot.experimental</groupId>
<artifactId>spring-boot-thin-layout</artifactId>
<version>${spring-boot-thin-layout.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>aws</shadedClassifierName>
</configuration>
</plugin>
</plugins>
</build>
Thank you in advance! Cheers!
It looks like the main issue is I have used public subnet on my EC2 instance with Apache Kafka/Zookeeper thus I have declared a public DNS on the AWS Lambda trigger - Apache Kafka Bootsrap servers. Now, I got it working by going thru again this reference but instead of using a NAT gateway I have setup a NAT Instance for better costing. I am now getting OK on the processing results.
Apache Kafka: Endpoints: [ip-10-0-1-199.ap-southeast-1.compute.internal:9092] (Enabled)
Details
Batch size: 100
Last processing result: OK
selfManagedEventSource:
Looking into the AWS CloudWatch logs, I am now seeing these logs:
2021-03-02 12:00:45.912 INFO 8 --- [ main] o.s.c.f.a.aws.CustomRuntimeEventLoop : Located function greeter
2021-03-02 12:00:45.918 INFO 8 --- [ main] c.j.s.s.SpringcloudfuncApplication : Hello {
"eventSource": "SelfManagedKafka",
"bootstrapServers": "ip-10-0-1-199.ap-southeast-1.compute.internal:9092",
"records": {
"topic-names-0": [
{
"topic": "topic-names",
"partition": 0,
"offset": 13,
"timestamp": 1614686444377,
"timestampType": "CREATE_TIME",
"value": "SnVuIEtpbmc="
}
]
}
}
And this goes to my next question, my String message produced on the topic is "Jun King" but the message returned to me is a JSON payload with my expected value encoded into Base64. I have tried to decode "SnVuIEtpbmc=" using this Online Base64Decoder which indeed return my actual message "Jun King".
I can process this within the code but would that make my function AWS-aware? and would have to traverse it. Thank you again in advance. Cheers!
Hi i am testing my controllers methods with chrome's reslet client and i have an error 404, after checking everything in my project i built a new one and created just one service and one controller and still all i get is error 404.
any ideas?
this is the url im calling:
http://localhost:8080/rest/api/encryptor/checkAutorization
that is my PomXML with al the dependencys :
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.serverside</groupId>
<artifactId>app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>app</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
this is the Controller:
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import Services.GeneralResponse;
import Services.TokenEncryptor;
#RestController
#RequestMapping("rest/api/encryptor")
public class EncryptionController {
#Autowired
private TokenEncryptor tokenEncryptor;
#GetMapping("/checkAutorization")
public GeneralResponse checkAutorization() throws Throwable {
try {
// byte[] byteToken = token.getBytes(StandardCharsets.UTF_8);
return new GeneralResponse(tokenEncryptor.encryptToken(new byte[]
{}));
} catch (Exception AccessDeniedException) {
return new GeneralResponse(AccessDeniedException);
}
}
}
Main method:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;
#Configuration
#SpringBootApplication
public class AppApplication {
public static void main(String[] args) {
SpringApplication.run(AppApplication.class, args);
}
}
General Response Class:
import java.text.SimpleDateFormat;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonInclude;
#JsonInclude(JsonInclude.Include.NON_NULL)
public class GeneralResponse {
private Object error;
private Object result;
public GeneralResponse() {
}
public GeneralResponse(Object result) {
this.result = result;
}
public GeneralResponse(Exception e) {
this.result = null;
this.error = e;
StackTraceElement[] stackTrace = e.getStackTrace();
System.out.println("The exception occured in method " + stackTrace[0].getMethodName());
System.out.println("The class name is " + stackTrace[0].getClassName());
System.out.println("at line number: " + stackTrace[0].getLineNumber());
System.out.println(e.toString() + " \n" + "error cause: " + e.getCause() + "\n" + "at: " + formatTime(System.currentTimeMillis()));
}
public Object getError() {
return error;
}
public void setError(Object error) {
this.error = error;
}
public Object getResult() {
return result;
}
public void setResult(Object result) {
this.result = result;
}
private String formatTime(Long currentTime) {
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm");
Date resultdate = new Date(currentTime);
return (sdf.format(resultdate));
}
}
Console startup log :
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.1.RELEASE)
2018-12-17 13:40:20.763 INFO 21872 --- [ restartedMain] com.serverside.app.AppApplication : Starting AppApplication on LAPTOP-0GNLE6KN with PID 21872 (C:\Users\omert\eclipse-workspace\app\target\classes started by omert in C:\Users\omert\eclipse-workspace\app)
2018-12-17 13:40:20.766 INFO 21872 --- [ restartedMain] com.serverside.app.AppApplication : No active profile set, falling back to default profiles: default
2018-12-17 13:40:20.814 INFO 21872 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2018-12-17 13:40:20.815 INFO 21872 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2018-12-17 13:40:21.546 INFO 21872 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2018-12-17 13:40:21.569 INFO 21872 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 15ms. Found 0 repository interfaces.
2018-12-17 13:40:21.946 INFO 21872 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$365e8361] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-12-17 13:40:22.515 INFO 21872 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2018-12-17 13:40:22.541 INFO 21872 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-12-17 13:40:22.542 INFO 21872 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/9.0.13
2018-12-17 13:40:22.554 INFO 21872 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jre1.8.0_181\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_191/bin/server;C:/Program Files/Java/jre1.8.0_191/bin;C:/Program Files/Java/jre1.8.0_191/lib/amd64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Users\omert\AppData\Local\Microsoft\WindowsApps;C:\Users\omert\AppData\Roaming\npm;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\nodejs\node.exe;;C:\WINDOWS\system32;;.]
2018-12-17 13:40:22.697 INFO 21872 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-12-17 13:40:22.697 INFO 21872 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1882 ms
2018-12-17 13:40:22.915 INFO 21872 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2018-12-17 13:40:23.063 INFO 21872 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2018-12-17 13:40:23.109 INFO 21872 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2018-12-17 13:40:23.178 INFO 21872 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.3.7.Final}
2018-12-17 13:40:23.181 INFO 21872 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-12-17 13:40:23.338 INFO 21872 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2018-12-17 13:40:23.482 INFO 21872 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2018-12-17 13:40:23.713 INFO 21872 --- [ restartedMain] o.h.t.schema.internal.SchemaCreatorImpl : HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl#77c8a0a2'
2018-12-17 13:40:23.716 INFO 21872 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2018-12-17 13:40:23.731 INFO 21872 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2018-12-17 13:40:23.983 INFO 21872 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2018-12-17 13:40:24.038 WARN 21872 --- [ restartedMain] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2018-12-17 13:40:24.325 INFO 21872 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2018-12-17 13:40:24.329 INFO 21872 --- [ restartedMain] com.serverside.app.AppApplication : Started AppApplication in 3.869 seconds (JVM running for 4.415)
I am getting 200 response code
POM : http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.gjp.springboot
test
0.0.1-SNAPSHOT
jar
test
Test Spring Boot Web Application
org.springframework.boot
spring-boot-starter-parent
2.0.0.RELEASE
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
#Service
public class TokenEncryptor {
I've spent ~6 hours banging my head against an issue encountered in the official tutorial for Amazon Web Services (AWS) Lambda. I'm only using code provided in the tutorial..
I encounter the issue on Step 2.3.2: Test the Lambda Function (Invoke Manually), found on this page:
https://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-upload-deployment-pkg.html?shortFooter=true
At this step we're creating an inputfile.txt using code provided by the AWS tutorial - the code simulates an "event" which triggers lambda.
Here's the code that goes into the inputfile.txt (I'm only copying & pasting from the tutorial):
{
"Records":[
{
"eventVersion":"2.0",
"eventSource":"aws:s3",
"awsRegion":"us-west-2",
"eventTime":"1970-01-01T00:00:00.000Z",
"eventName":"ObjectCreated:Put",
"userIdentity":{
"principalId":"AIDAJDPLRKLG7UEXAMPLE"
},
"requestParameters":{
"sourceIPAddress":"127.0.0.1"
},
"responseElements":{
"x-amz-request-id":"C3D13FE58DE4C810",
"x-amz-id-2":"FMyUVURIY8/IgAtTv8xRjskZQpcIZ9KG4V5Wp6S7S/JRWeUWerMUE5JgHvANOjpD"
},
"s3":{
"s3SchemaVersion":"1.0",
"configurationId":"testConfigRule",
"bucket":{
"name":"sourcebucket",
"ownerIdentity":{
"principalId":"A3NL1KOZZKExample"
},
"arn":"arn:aws:s3:::sourcebucket"
},
"object":{
"key":"HappyFace.jpg",
"size":1024,
"eTag":"d41d8cd98f00b204e9800998ecf8427e",
"versionId":"096fKKXTRTtl3on89fVO.nfljtsv6qko"
}
}
}
]
}
Here's the code which activates the inputfile.txt as an "event":
aws lambda invoke \
--invocation-type Event \
--function-name CreateThumbnail7 \
--region us-west-2 \
--payload file:/Users/username/inputfile.txt \
--profile adminuser \
outputfile.txt
and the error message about the invoke command:
An error occurred (InvalidRequestContentException) when calling the Invoke operation: Could not parse request body into json: Unrecognized token 'file': was expecting 'null', 'true', 'false' or NaN
at [Source: [B#4aeacf9d; line: 1, column: 6]
(???)
Any ideas what could be happening / how to fix? Is this about the format of the inputfile.txt?
I've tried everything I can think of.. I must be doing something wrong or there must be an easy fix for the JSON formatting.
For those who find this thread and are struggling with Javascript deployment package step in the Amazon Web Services (AWS) Lamba tutorial, there are three separate issues in the tutorial guidelines which you must address:
1.) Make sure your Java environment is 8, Java10 will throw a number of errors.
2.) #MikePatrick is correct, the path to your inputfile MUST be: file:///Users/username/inputfile.txt
3.) And finally, try using this pom.xml file (note the dependencies), this is the only combo that worked for me:
<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>doc-examples</groupId>
<artifactId>lambda-java-example</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>lambda-java-example</name>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-core</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-log4j2</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.11.349</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I have a problem with Maven Compiler Hellow-Service sample.
the response: Unable to add module to the current project as it is not of packaging type 'pom' -> [Help 1]
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building WSO2 MSF4J Microservice 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) # Hello-Service >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) # Hello-Service <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.4:generate (default-cli) # Hello-Service ---
[INFO] Generating project in Interactive mode
[INFO] Archetype repository not defined. Using the one from [org.wso2.msf4j:msf4j-microservice:1.0.0] found in catalog remote
[INFO] Using property: groupId = org.example
[INFO] Using property: artifactId = Hello-Service
[INFO] Using property: version = 1.0.0-SNAPSHOT
[INFO] Using property: package = br.teste.service
[INFO] Using property: serviceClass = HelloService
Confirm properties configuration:
groupId: org.example
artifactId: Hello-Service
version: 1.0.0-SNAPSHOT
package: br.teste.service
serviceClass: HelloService
Y: : y
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: msf4j-microservice:1.0.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: org.example
[INFO] Parameter: artifactId, Value: Hello-Service
[INFO] Parameter: version, Value: 1.0.0-SNAPSHOT
[INFO] Parameter: package, Value: br.teste.service
[INFO] Parameter: packageInPathFormat, Value: br/teste/service
[INFO] Parameter: package, Value: br.teste.service
[INFO] Parameter: version, Value: 1.0.0-SNAPSHOT
[INFO] Parameter: groupId, Value: org.example
[INFO] Parameter: serviceClass, Value: HelloService
[INFO] Parameter: artifactId, Value: Hello-Service
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping WSO2 MSF4J Microservice
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.359s
[INFO] Finished at: Wed Mar 16 15:05:44 BRT 2016
[INFO] Final Memory: 22M/265M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate (default-cli) on project Hello-Service: org.apache.maven.archetype.exception.InvalidPackaging: Unable to add module to the current project as it is not of packaging type 'pom' -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
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/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.msf4j</groupId>
<artifactId>msf4j-service</artifactId>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>Hello-Service</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>WSO2 MSF4J Microservice</name>
<properties>
<microservice.mainClass>org.example.service.Application</microservice.mainClass>
</properties>
</project>
You are using old version of source code. I can identify it from your module artifact name. Relevant pom file can be found here
I can compile the latest source code without any issues.