I am having problems running tests with arquillian/wildfly 10.0.0.Final.
The error is a LifecycleException: Could not start container, due to TimeoutException: Managed Server was not started within [120] s (I have upped the timeout from 60 to see if it would make a difference).
Funny thing is, Wildfly starts fine (within the default 60s) and then sits there
until it's told to shut down, which it does.
I had tests in another project which used to run but now don't run anymore, they fail with the same error (although they do still run on Jenkins).
Also, turning on Shrinkwrap.writeTo(System.out, Formatters.VERBOSE) (used to build the war file) does not produce any output (which I also know it did in the past)
What has changed:
The server was hooked up to LDAP to managed admin logins, and a datasource was added
Eclipse was updated to Neon 3
Arquillian configuration file is:
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://jboss.org/schema/arquillian" xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<container qualifier="wildfly" default="true">
<configuration>
<property name="jbossHome">/Users/turekg/dev/apps/wildfly-10.0.0.Final</property>
<property name="startupTimeoutInSeconds">120</property>
</configuration>
</container>
I am using ant with Ivy to manage test dependencies and these are:
<dependency org="org.jboss.arquillian" name="arquillian-bom" rev="1.1.11.Final" conf="test->default"/>
<dependency org="org.jboss.arquillian.junit" name="arquillian-junit-container" rev="1.1.11.Final" conf="test->default"/>
<dependency org="org.wildfly.arquillian" name="wildfly-arquillian-container-managed" rev="2.0.0.Final" conf="test->default"/>
<dependency org="org.wildfly.security" name="wildfly-security-manager" rev="1.1.2.Final" conf="test->default"/>
<dependency org="org.jboss.shrinkwrap.resolver" name="shrinkwrap-resolver-depchain" rev="2.2.4" conf="test->default"/>
<dependency org="org.jboss.arquillian.extension" name="arquillian-rest-client-impl-3x" rev="1.0.0.Final-SNAPSHOT" conf="test->default"/>
Thanx
Gaby
Related
There are several analyzers whose NuGet packages I almost always include in any project I make. It's annoying adding them all individually whenever I start a new project, so I have long wanted to make a NuGet package of my own that just says "include these other packages". I recently did so, and it seems to work fine. I made the following nuspec file, did a "nuget pack" and then a "nuget push" to a private package server:
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Rwv37.Metapackage.Analyzers</id>
<version>1.0.0</version>
<authors>Robert William Vesterman</authors>
<owners>Robert William Vesterman</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A collection of frequently used analyzers.</description>
<copyright>Copyright 2019 Robert William Vesterman</copyright>
<developmentDependency>true</developmentDependency>
<dependencies>
<group targetFramework="netstandard2.0">
<dependency id="CSharpGuidelinesAnalyzer" version="3.1.0" />
<dependency id="IDisposableAnalyzers" version="2.1.2" />
<dependency id="Microsoft.CodeAnalysis.FxCopAnalyzers" version="2.9.4" />
<dependency id="StyleCop.Analyzers" version="1.1.118" />
</group>
</dependencies>
</metadata>
</package>
I then decided to do the same thing with a bunch of test-related packages that I almost always include in all of my unit test projects:
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Rwv37.Metapackage.UnitTesting</id>
<version>1.0.0</version>
<authors>Robert William Vesterman</authors>
<owners>Robert William Vesterman</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A collection of frequently used unit testing stuff.</description>
<copyright>Copyright 2019 Robert William Vesterman</copyright>
<developmentDependency>true</developmentDependency>
<dependencies>
<group targetFramework="netstandard2.0">
<dependency id="FluentAssertions" version="5.7.0" />
<dependency id="FluentAssertions.Analyzers" version="0.11.4" />
<dependency id="Moq" version="4.12.0" />
<dependency id="Moq.Analyzers" version="0.0.7" />
<dependency id="xunit" version="2.4.1" />
<dependency id="xunit.analyzers" version="0.10.0" />
</group>
</dependencies>
</metadata>
</package>
That did not work. When I add this metapackage to a unit testing project, I can see it (and its constituent packages) in VS 2019's Solution Explorer, but I get a bunch of errors saying things like:
The type or namespace name 'FluentAssertions' could not be found (are you missing a using directive or an assembly reference?)
I thought maybe I was misunderstanding the "developmentDependency" tag, so I removed that and bumped the version number, but this did not help.
What am I doing wrong? How do I do it correctly? Thanks.
Answering my own question:
It seems like it is due to some Visual Studio caching wackiness or something like that. As I noted in the original post, after I found that it didn't work, I removed the "developmentDependency" tag and bumped the version number, which did not help.
However, the way that I had upgraded the project to use the new version was via "Update" in VS's NuGet Package Manager. Just now, I instead tried uninstalling the old version, then installing the new version. It magically started working.
I tried each way a few more times, and it always was the same: If I "Update" version 1 to version 2, it doesn't work, but if I "Uninstall" version 1 and then "Install" version 2, it works fine. 🙄
Just for the sake of completeness, I will also mention that prior to discovering this workaround, I had tried various things like clean/rebuild, unload project/reload project, close VS/open VS, and combinations thereof (like clean/close/open/rebuild), none of which helped.
I have created a package for a framework which depends on numerous projects within a single solution. I want to create nuget packages for the framework and various projects within the solution.
In Framework.Framework.nuspec, I have the following dependencies declared:
<dependencies>
<group>
<dependency id="Framework.CompositionRoot" version="1.0" />
<dependency id="Framework.Services" version="1.0" />
<dependency id="Framework.Domain" version="1.0" />
</group>
</dependencies>
And in each project file has its own nuspec file, such as Framework.CompositionRoot.nuspec, which has the following dependencies:
<dependencies>
<group>
<dependency id="Super.Services" version="1.0" />
<dependency id="Super.Data" version="1.0" />
<dependency id="Super.Domain" version="1.0" />
</group>
</dependencies>
My problem is that when I install Framework.Framework in another project, it seems to install some of the dependent nuget packages but not others. In this case, it installs Framework.CompositionRoot and Framework.Services, but not Framework.Domain.
Framework.Domain has its own nuspec file in the solution and the generated Framework.Framework.nupkg file shows Framework.Domain as a dependency. I have only installed Framework.Framework in the project, not Framework.Domain, since to my understanding this should be installed when I install Framework.Framework.
When I look in the references for the solution, it has added a Framework.Domain.dll, but half of the interfaces declared in that domain are missing. (I have made sure the missing interfaces are declared as public.) However, if I copy/paste the dll into the lib folder and reference it manually, all the of the interfaces are there.
Any help would be appreciated.
This was due to nuget installing old versions by default. While Framework.Domain was not in the list of installed packages when viewing through the package manager, it was visible in packages.config, and had an old version which did not contain the interfaces. (Nuget install will install the lowest version of dependencies by default.)
In order to fix this, I uninstalled the package and re-installed it using the flag:
-DependencyVersion "HighestPatch".
The objective I have is to develop a bus with Mule, to run it into a JBoss.
My IDE is eclipse kepler, I have the Anypoint Studio plugin installed, a JBoss 7.1.1, a 3.5 CE runtime, Maven etc etc.
I took a look a this page : Deploy War into Mule Standalone server but I don't see haw it could help.
Context :
- Jboss is an imposed choice. I know it exists an EE version of the runtime, specially for the HA ability (that I need), but it's not an option for my client.
As it's "easier" to test my flows on the standalone (CE) runtime, I wanted to find a way to develop one Mule project to execute it on a CE runtime during the developing phase, and on a JBoss AS during the integration phase.
To do that, I tried to define :
- a jar maven project which contains all the flow
- a "mule" maven project, with the previous jar as the dependency
- a war maven project which athe previous jar and all the module/transport mule jars as dependencies
When I build the mule zip, my jar is included inside, but when it's executed none of ny flew is registered. So it doesn't work.
When I execute the war on JBoss, everything looks fine for the "first" flow (the input one), but I have a crash when the second one is called using a VM connector (other issue, I'll make another request)
Is there a way to do something working with this approach?
I tried to define 2 pom for the same mule project (one pom which generate a war, and a standalone-pom which generate the mule zip), but this is not very "easy to use" for my team, as the eclipse integration of this kind of project is not very friendly.
The last thing I can try is to keep the mule project pom with a mule packaging, and add a maven assembly to build the jar I could include in my war, but I'd prefer a nicer solution...
Thanks for all of your ideas!
Ah, the test flew I'm trying to integrate.
I have 3 flew :
- The first one stands for the HTTP request (to call my CE runtime)
- The second one stands for the Servlet request (to call my JBoss)
- The third one is called by both my CE runtime and my JBoss input flow, throw the VM connector. I'm thinking replace the VM connector by a Flow Call, as the VM inbound-endpoint is not registered when it's embedded into my war (but it works when executed in a CE runtime...)
main file :
<flow name="muleFlow1" doc:name="muleFlow1">
<http:inbound-endpoint exchange-pattern="request-response"
host="localhost" port="8081" doc:name="HTTP" />
<echo-component doc:name="Echo" />
<vm:outbound-endpoint path="receiver"
exchange-pattern="request-response" responseTimeout="10000" doc:name="VM" />
</flow>
<flow name="muleFlow2" doc:name="muleFlow2">
<servlet:inbound-endpoint path="servlet"
responseTimeout="10000" doc:name="Servlet" />
<echo-component doc:name="Echo" />
<vm:outbound-endpoint path="receiver"
exchange-pattern="request-response" responseTimeout="10000" doc:name="VM" />
</flow>
second file :
<flow name="otroFlow1" doc:name="otroFlow1">
<vm:inbound-endpoint path="receiver"
exchange-pattern="request-response" responseTimeout="10000" doc:name="VM" />
<set-payload value="it works" doc:name="Set Payload" />
<echo-component doc:name="Echo" />
</flow>
Thanks !
I didn't find anything else, so I opted for an assembly descriptor...
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>mule</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}/classes</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.xml</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>classes/**/*.class</include>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<useTransitiveDependencies>true</useTransitiveDependencies>
<excludes>
<exclude>org.mule:mule-core</exclude>
<exclude>commons-cli:commons-cli</exclude>
<exclude>log4j:log4j</exclude>
<exclude>org.mule.mvel:mule-mvel2</exclude>
<exclude>org.mule.common:mule-common</exclude>
<exclude>org.mule.modules:mule-module-client</exclude>
<exclude>org.mule.modules:mule-module-spring-config</exclude>
<exclude>org.mule.modules:mule-module-annotations</exclude>
<exclude>org.mule.modules:mule-module-xml</exclude>
<exclude>org.mule.modules:mule-module-cxf</exclude>
<exclude>org.mule.modules:mule-module-spring-security</exclude>
<exclude>org.mule.transports:mule-transport-http</exclude>
<exclude>org.mule.transports:mule-transport-ssl</exclude>
<exclude>org.mule.transports:mule-transport-tcp</exclude>
<exclude>commons-codec:commons-codec</exclude>
<exclude>org.mule.modules:mule-module-spring-extras</exclude>
<exclude>org.mule.modules:mule-module-builders</exclude>
<exclude>org.mule.modules:mule-module-management</exclude>
<exclude>org.mule.modules:mule-module-scripting</exclude>
<exclude>org.mule.modules:mule-module-sxc</exclude>
<exclude>org.mule.tests:mule-tests-functional</exclude>
<exclude>org.mule:mule-core</exclude>
<exclude>org.mule.transports:mule-transport-file</exclude>
<exclude>org.mule.transports:mule-transport-jdbc</exclude>
<exclude>org.mule.transports:mule-transport-jms</exclude>
<exclude>org.mule.transports:mule-transport-servlet</exclude>
<exclude>org.mule.transports:mule-transport-vm</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>
My mule project is now a jar, which generate a jar file (for my webapp) and a zip file (for my runtime CE)
One important thing :
To realize the spring imports of each flow, we need to specify when mule is deployed in a web app, but the runtime expects to work. It can be done by creating a maven profile and enabling the resources filtering to determine when add "classpath:"...
I've tried many times to debug a Test in managed container enviroment.
I get errors like JDWP Transport Error, socket failed to initialize. Means I can not initialize arquillian with the below property tag.
My arquillian.xml file looks like this:
<arquillian xmlns="http://jboss.org/schema/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<engine>
<property name="deploymentExportPath">target/arq.deployments</property>
</engine>
<container qualifier="jboss" default="true">
<protocol type="jmx-as7">
<property name="executionType">MANAGED</property>
</protocol>
<configuration>
<property name="javaVmArguments">-Xrunjdwp:transport=dt_socket,address=55407,server=y,suspend=y -Xmx512m -XX:MaxPermSize=128m</property>
</configuration>
</container>
</arquillian>
Am I missing something?
There are 3 JVM running in this case. So this is a special debug case.
1st JVM-> Started by Arquillian/Junit to perform the tests.
2nd JVM-> Started by Arquillian to run managed Jboss.
3rd JVM-> It's a remote debugging configuration that must be ported to JVM
number 2 in order to debug 2nd JVM. Check out this blog
So this is the idea, Run test (2nd JVM will be suspended until a JVM is attached to it), then run a new remote configuration, as soon as this starts, the past JVM will run.
It's a bit confusing but works.
Note that if you only have 2 JVM in simple debug mode, you will be debugging arquillian/junit JVM, which is not the one you are interested.
I've been given the task of migrating an existing project -- formerly built with Ant -- to use Apache Maven. I'm brand new to the entire concept, though I've spent the last several hours doing as much research as I can on the subject. Sadly, I'm having some proxy issues when it comes to installing things like m2e and Eclipse IAM, so everything must be done from the command prompt. As of right now, I do have maven installed properly; the trick now is to use it in my project rather than Ant. I've looked online and found a few tutorials, but they are all too vague for me considering my lack of experience with all of this. If anyone can break the steps down for me one-by-one in a detailed manner, that would be more than amazing. On a side note, I've been told to add the following to the local Maven Settings:
<settings>
<servers>
<server>
<id>local_tomcat</id>
<username>admin</username>
<password>tomcat</password>
</server>
<server>
<id>artifactory</id>
<username>user</username>
<password>password</password>
</server>
</servers>
<mirrors>
<mirror>
<id>artifactory</id>
<name>Artifactory</name>
<url>https://jenkins.web.jw.local/artifactory/repo1</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.jw.local</host>
<port>80</port>
<username>user</username>
<password>password</password>
<nonProxyHosts>*.jw.local</nonProxyHosts>
</proxy>
</proxies>
</settings>
With the obvious username and password information filled in. I think I've managed that thus far by simply adding the necessary blocks into the settings.xml file under my ApacheMaven\conf directory. Other than that single step, I'm pretty much lost. Again, any help, especially that of a detailed tutorial in terms of command line instructions to build this project would be wonderful. Oh, and on another side-note, I am using Eclipse... Not sure if that would matter much.
EDIT: Considering Petr Kozelka's answer, I've attempted to make a pom.xml file for my project. Here's what I have so far...
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>appName</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<name>Application Name</name>
<description>Yadda Yadda</description>
<build>
<plugins>
</plugins>
</build>
<dependencies>
</dependencies>
<repositories>
</repositories>
</project>
Is this heading in the right direction? Also, do I need to construct the archetype.xml file myself, or will Maven do that through the command line somehow? If I need to do it myself, this is what I've come up with thus far:
<archetype xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0 http://maven.apache.org/xsd/archetype-1.0.0.xsd">
<id>lighthouse</id>
<sources>
<source>src/com/jeldwen/lighthouse/controller/AddTimeController.java</source>
<source>src/com/jeldwen/lighthouse/controller/BugController.java</source>
<source>src/com/jeldwen/lighthouse/controller/DeleteTimeController.java</source>
<source>src/com/jeldwen/lighthouse/controller/EnterTimeController.java</source>
<source>src/com/jeldwen/lighthouse/controller/ModifyTimeController.java</source>
<source>src/com/jeldwen/lighthouse/controller/PersonController.java</source>
<source>src/com/jeldwen/lighthouse/controller/ProjectController.java</source>
<source>src/com/jeldwen/lighthouse/controller/TimeController.java</source>
<source>src/com/jeldwen/lighthouse/model/Area.java</source>
<source>src/com/jeldwen/lighthouse/model/Bug.java</source>
<source>src/com/jeldwen/lighthouse/model/DBModel.java</source>
<source>src/com/jeldwen/lighthouse/model/DefaultModel.java</source>
<source>src/com/jeldwen/lighthouse/model/JWModel.java</source>
<source>src/com/jeldwen/lighthouse/model/JWTime.java</source>
<source>src/com/jeldwen/lighthouse/model/Person.java</source>
<source>src/com/jeldwen/lighthouse/model/Project.java</source>
<source>src/com/jeldwen/lighthouse/util/Lighthouse.java</source>
<source>src/com/jeldwen/lighthouse/util/LighthouseApplicationListener.java</source>
<source>src/com/jeldwen/lighthouse/util/LighthouseServlet.java</source>
<source>src/com/jeldwen/lighthouse/util/LighthouseSystemProperties.java</source>
<source>src/com/jeldwen/lighthouse/LighthouseApp.java</source>
</sources>
<testSources>
<!-- None -->
</testSources>
<allowPartial>true</allowPartial>
</archetype>
First of all: if you wish to customize settings.xml, do not touch the one in maven distro - instead, create a new file in $HOME/.m2/settings.xml where maven finds and uses it.
As the very first step, I recommend you to not use settings.xml at all.
Create a supersimple maven project, and try to compile it:
mvn clean install
Second step
Use very simple settings.xml:
you probably do not need proxy
servers part is needed only for publishing artifacts to a maven repository; that's not important at the beginning
here it is:
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<mirrors>
<mirror>
<id>repos</id>
<mirrorOf>*</mirrorOf>
<name>internal mirror</name>
<url>https://jenkins.web.jw.local/artifactory/repo1</url>
</mirror>
</mirrors>
<!-- TODO: the proxy part here -->
</settings>
This assumes that you use inhouse maven repository, for instance Nexus or Artifactory.
Using maven repo makes only sense if your projects are not happy with deps available in the Maven Central Repository - otherwise, you can safely go without it. (let's neglect the performance effect of repoman for now)
Now, add some java sources, dependencies etc. - and watch how new depenencies get automatically downloaded to your local repository...
Third step
Learn how to add further repositories to your repository manager (group "public" on Nexus)...
The rest is probably subject of further research.