I'm running integration tests from MVN with Wildfly 10 and Arquilliain. I get the following error:
WARN ArchiveDeployer - Cannot undeploy:
144976d2-382b-438f-8b8a-2007db7b53c2.war
org.jboss.as.controller.client.helpers.standalone.ServerDeploymentHelper$ServerDeploymentException:
java.lang.Exception: "WFLYCTL0216: Management resource
'[(\"deployment\" => \"144976d2-382b-438f-8b8a-2007db7b53c2.war\")]'
not found" at
org.jboss.as.controller.client.helpers.standalone.ServerDeploymentHelper.undeploy(ServerDeploymentHelper.java:114)
at
org.jboss.as.arquillian.container.ArchiveDeployer.undeploy(ArchiveDeployer.java:55)
at
org.jboss.as.arquillian.container.CommonDeployableContainer.undeploy(CommonDeployableContainer.java:152)
at
org.jboss.arquillian.container.impl.client.container.ContainerDeployController$4.call(ContainerDeployController.java:205)
at
org.jboss.arquillian.container.impl.client.container.ContainerDeployController$4.call(ContainerDeployController.java:185)
at
org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:271)
Here's my Arquillian (identical to another project that works, so I don't think this is the issue, all the ports are right):
<?xml version="1.0" ?>
<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">
<engine>
<property name="deploymentExportPath">target</property>
</engine>
<!--
<container qualifier="wildfly-managed" default="true">
<configuration>
<!– <property name="serverConfig">standalone.xml</property> Does not work, use -DjbossHome=.....–>
<property name="outputToConsole">true</property>
<property name="javaVmArguments">-Djboss.socket.binding.port-offset=100</property>
<property name="managementPort">10090</property>
</configuration>
</container>
-->
<container qualifier="wildfly-remote" default="true">
<protocol type="Servlet 3.0">
<property name="host">192.168.3.70</property>
<property name="port">8180</property>
</protocol>
<configuration>
<property name="managementPort">10090</property>
<property name="username">mike</property>
<property name="password">mike</property>
<property name="managementAddress">192.168.3.70</property>
</configuration>
</container>
<extension qualifier="transaction">
<property name="manager">java:jboss/UserTransaction</property>
</extension>
</arquillian>
My deployment is built like so:
#Deployment
public static WebArchive createDeployment() {
WebArchive wa = ShrinkWrap.create(WebArchive.class).addPackage(Baby.class.getPackage())
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource("jboss-deployment-structure.xml", "jboss-deployment-structure.xml")
.addAsResource("test-persistence.xml", "META-INF/persistence.xml")
.addAsResource("arquillian.xml", "arquillian.xml").addAsResource("log4j.xml", "log4j.xml")
.addAsLibrary(Maven.resolver().loadPomFromFile("pom.xml").resolve("joda-time:joda-time:2.9.3")
.withTransitivity().asSingleFile())
.addAsLibraries((Maven.resolver().loadPomFromFile("pom.xml")
.resolve("com.fasterxml.jackson.datatype:jackson-datatype-hibernate5:2.7.4").withTransitivity()
.asFile()));
The app works fine, and if I launch it as a managed container on a local WF installation it works. For some reason, the remote container is failing.
Any ideas?
EDIT:
I also added this to web.xml and it did not change the issue:
<context-param>
<param-name>antiJARLocking</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>antiResourceLocking</param-name>
<param-value>true</param-value>
</context-param>
Related
I'm struggling for a few days about this error.
When I try to deploy from ide(IntelliJ-eclipse), it works correct.
But when I try to deploy from WebLogic console, I got these errors;
Error Unable to access the selected application.
Error Unable to invoke Annotation processoror.
Error Unable to invoke Annotation processoror.
For more information, I checked logs and errors from stack trace.
It looks like the main error is: javax.persistence.PersistenceException: No Persistence provider for EntityManager named.
In debug, throwing from this code; Persistence.createEntityManagerFactory("persistanceUnitName");
Persistence classes are coming from javaee-web-abi-7.0.jar.
Everything looks fine in persistence.xml.
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="persistanceUnitName"
transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>dataSource</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.target-database" value="Oracle" />
<property name="eclipselink.logging.parameters" value="true" />
<property name="eclipselink.logging.logger" value="DefaultLogger" />
<property name="eclipselink.logging.level" value="WARNING" />
<property name="eclipselink.refresh" value="true" />
<property name="eclipselink.query-results-cache" value="false" />
<!-- <property name="eclipselink.ddl-generation" value="create-or-extend-tables" />-->
</properties>
</persistence-unit>
</persistence>
persistance.xml located in /WEB-INF/classes/META-INF
We got a case like that: we have a test and prep environment. In test, it works, in prep doesn't work, in local doesn't work (from WebLogic console). Unfortunately, I can't see test server configs. But I expect the same options with prep. Anyway forget other environments, firstly I need to deploy successful from local.
Could you pls help me, I really don't know what I miss. Read every topic, tried everything
It looks like a classpath issue. Check your weblogic classpath.
If you are using eclipselink library must be loaded first when you are deploying.
Check this.
Add eclipselink into your project with scope provided:
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.0</version>
<scope>provided<scope>
</dependency>
add same dependency into your weblogic classpath:
$WEBLOGIC_HOME/user_projects/domains/base_domain/lib
Then, add below to your weblogic.xml to use eclipselink library.
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>org.eclipse.persistence.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
I am working on a project in spring boot and I need to add Spring integration poller for polling files from a location and run spring batch on that file to process it.
I have used spring batch integration for this(Document Reference below.)
http://docs.spring.io/spring-batch/trunk/reference/html/springBatchIntegration.html
In spring boot, I have succesfully configured my poller in #Configuration file as below
#Bean
#InboundChannelAdapter(value = "fileInputChannel", poller = #Poller(
fixedRate = "1000"), autoStartup = "true")
public MessageSource<File> filesScanner() {
CompositeFileListFilter<File> filters = new CompositeFileListFilter<File>();
filters.addFilter(new SimplePatternFileListFilter("*.xml"));
filters.addFilter(new AcceptOnceFileListFilter<File>());
filters.addFilter(getLastModifiedFileFilter());
FileReadingMessageSource source = new FileReadingMessageSource();
source.setDirectory(new File("F:/DataInput/"));
source.setFilter(filters);
return source;
}
This poller is defined in java configuration whereas the channels are defined in xml as below.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/file
http://www.springframework.org/schema/integration/file/spring-integration-file.xsd">
<int:channel id="ticketingResponse" />
<int:channel id="mailFailureTicketData" />
<int:channel id="moveSuccessTicketingFile" />
<int:channel id="moveFailureTicketingFile" />
<int:channel id="ticketingFileInput" />
<int:channel id="ticketingJobParameters" />
<!-- <int-file:inbound-channel-adapter id="filePoller"
channel="inboundFileChannel"
directory="file:/tmp/myfiles/"
filename-pattern="*.csv">
<int:poller fixed-rate="1000"/>
</int-file:inbound-channel-adapter> -->
<bean id="earliestTicketingFileSelecter" class="com.avios.integration.iqcx.FilesSortingComparator" />
<bean id="compositeFilesFilter"
class="org.springframework.integration.file.filters.CompositeFileListFilter">
<constructor-arg>
<list>
<bean
class="org.springframework.integration.file.filters.RegexPatternFileListFilter">
<constructor-arg name="pattern" value="${ticketing.input.file.pattern}" />
</bean>
<bean class="org.springframework.integration.file.filters." />
<bean
class="org.springframework.integration.file.filters.LastModifiedFileListFilter">
<property name="age" value="${ticketing.input.file.age}" />
</bean>
</list>
</constructor-arg>
</bean>
<bean id="ticketingFilesScanner"
class="org.springframework.integration.file.FileReadingMessageSource">
<property name="filter" value="compositeFilesFilter" />
<property name="directory" value="/tmp/myfiles/" />
</bean>
<int-file:inbound-channel-adapter id="filePoller"
channel="inboundFileChannel"
directory="file:/tmp/myfiles/"
filename-pattern="*.csv">
<int:poller fixed-rate="1000"/>
</int-file:inbound-channel-adapter><!-- <int-file:inbound-channel-adapter
directory="${ticketing.input.file.path}" channel="ticketingFileInput"
comparator="earliestTicketingFileSelecter" auto-startup="true" filter="compositeFilesFilter" >
<int:poller ></int:poller>
</int-file:inbound-channel-adapter> -->
<int:transformer id="iqcxFilesToJobParameters" ref="jobParameterTransformer"
input-channel="ticketingFileInput" method="addTicketingFileToJobParameter"
output-channel="ticketingJobParameters" />
<int:outbound-channel-adapter channel="ticketingJobParameters"
ref="iqcxJobLaunchingGateway" method="handleMessage" />
</beans>
I am getting the below error in my XML configuration file.
cvc-complex-type.3.2.2: Attribute 'fixed-rate' is not allowed to appear in element 'int:poller'.
I checked this on google and found only the below link which wasn't much of use as i am getting exact same error.
Using Spring Boot & Spring Integration with database backed Configuration
Attribute 'fixed-rate' is not allowed to appear in element 'int:poller'
Spring boot version i am using is as below.
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.6.RELEASE</version>
Spring integration jar in library - Spring-integration-core-4.2.8.RELEASE.jar
I also tried excluding integration jar from batch-integration dependency and adding it separately as below but that didn't work either.
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-integration</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.integration/spring-integration-core -->
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
</dependency>
Also checked the XSD http://www.springframework.org/schema/integration/spring-integration.xsd and it has the attribute fixed-delay in poller. Any suggestions for resolving this?
Read the important note in the online schema:
+++++ IMPORTANT +++++
This schema is for the 1.0 version of Spring Integration Core. We cannot update it to the current schema
because that will break any applications using 1.0.3 or lower. For subsequent versions, the unversioned
schema is resolved from the classpath and obtained from the jar.
Please refer to github:
https://github.com/spring-projects/spring-integration/tree/master/spring-integration-core/src/main/resources/org/springframework/integration/config/xml
for the latest schema.
In the old schema, fixed-rate was part of a periodic trigger child element on the poller.
The 4.2 schema is here.
If this is just an IDE error, you can ignore it, or configure your IDE to be "spring aware".
Spring finds the actual schema on the classpath.
With STS, enable "spring nature" on the project.
sometimes it could be due to missing spring-boot-starter-integration & spring-integration-file dependency in pom.xml. So check if actually spring-integration-file dependency is available in your project when you are using spring integration.
I tried to create a little Java-web-project, while using Spring MVC Framework.
To build my project, I use ant.
The compiling process seems to work, but unfortunately my controller class( and method) is never been called.
Here are my solution files.
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>HelpMe</display-name>
<servlet>
<servlet-name>mvc</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc</servlet-name>
<url-pattern>/test/</url-pattern>
</servlet-mapping>
</web-app>
mvc-servlet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.please.help.me" />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
Controller-class:
package com.please.help.me;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
#Controller
public class WelcomeController {
#RequestMapping("/page1")
public String showWelcomePage1() {
System.out.println("show page 1...");
return "page1";
}
#RequestMapping("/page2")
public String showWelcomePage2() {
System.out.println("show page 2...");
return "page2";
}
}
ant-build-file: (build.xml)
<project name="HelpMeProject" default="compile" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
Build file for not working project
</description>
<!-- set global properties for this build -->
<property name="src" location="src" />
<property name="build" location="build" />
<property name="lib" location="lib" />
<property name="classes" location="${build}\WEB-INF\classes" />
<path id="project-classpath">
<fileset dir="${build}\WEB-INF\lib" includes="*.jar" />
<fileset dir="${src}" />
</path>
<target name="compile" description="compile the source" >
<delete dir="${lib}" />
<delete dir="${build}" />
<mkdir dir="${lib}" />
<!-- Do ivy retrieve -->
<ivy:retrieve pattern="${lib}/[type]/[artifact]-[revision].[ext]" />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<mkdir dir="${build}\WEB-INF\lib" />
<mkdir dir="${classes}" />
<copy todir="${build}\WEB-INF\lib">
<fileset dir="${lib}\jar" />
<fileset dir="${lib}\bundle" />
</copy>
<copy todir="${build}">
<fileset dir="web" />
</copy>
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${classes}" classpathref="project-classpath" debug="true" />
</target>
</project>
and finally my tomcat deployment descriptor: (helpme.xml)
<?xml version='1.0' encoding='utf-8'?>
<Context crossContext="true" docBase="c:\..myPath..\HelpMe\build\" path="/helpme">
</Context>
After running the compile-ant-script, everything seems fine. Tomcat starts as it should do, but it doesn't matter which URL I call -the controller won't be touched.
This is what I tried:
localhost:8080/
localhost:8080/test
localhost:8080/test/page1
localhost:8080/page1
I looked for similiar topics, but did not find an solution for that problem. Maybe you can help me.
Thanks a lot.
In your case if you have any request mapping as /test/ in controller then
localhost:8080/test/
it will will work.
If you want any url after /test/ needs to be work like :
localhost:8080/test/page1
you need to map it in web.xml as :
/test/*
as I commented.
in url /test/*, the * means any thing after /test/
Change
<url-pattern>/test/</url-pattern>
to
<url-pattern>/</url-pattern>
then localhost:8080/page1 at least should work fine
is this a maven project? If so you can you show us the pom.xml ?
Most people start their webapp with Requestmapping "/"
If you want a quick start to Spring MVC Programming no junk or setup use STS (spring tools suite) although someone gave me a hard time because I like the tool saying it came with a pre-setup tomcat therefore lessening the experience while that is true but eventually you will need to near how to deploy manually to tomcat anyway.
I want to test my war file on remote server but it is not working and giving me error:
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream cannot be cast to com.itextpdf.text.pdf.codec.Base64$InputStream
I dont know what i am doing wrong.I am new to arquillian and have checked almost all the links available but still not got any solution over this..
Here is my arquillian.xml
<?xml version="1.0" encoding="UTF-8"?>
<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">
<!-- Uncomment to have test archives exported to the file system for inspection -->
<!-- <engine> -->
<!-- <property name="deploymentExportPath">target/</property> -->
<!-- </engine> -->
<!-- Force the use of the Servlet 3.0 protocol with all containers, as it
is the most mature -->
<defaultProtocol type="Servlet 3.0" />
<!-- Example configuration for a remote JBoss EAP 6 instance -->
<container qualifier="jboss" default="true">
<!-- By default, arquillian will use the JBOSS_HOME environment variable.
Alternatively, the configuration below can be uncommented. -->
<configuration>
<!-- <property name="jbossHome">/opt/jboss7</property> --> <!-- <property name="managementAddress">197.242.148.253</property> <property
name="managementPort">22000</property> <property name="username"></property>
<property name="password"></property> -->
<property name="managementAddress">197.242.148.253</property>
<property name="managementPort">22000</property>
<property name="username">abc</property>
<property name="password">aabc123</property>
</configuration>
</container>
</arquillian>
This is my test class
public class ArqTest extends Arquillian{
//creates war and deploys it
#Deployment(testable = true)
public static WebArchive createNotTestableDeployment() {
final WebArchive war = ShrinkWrap.create(WebArchive.class, "USSD.war")
.addClasses(ShowConversations.class)
.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
System.out.println("deployed");
System.out.println(war.getName());
return war;
}
#RunAsClient
#Test(dataProvider = Arquillian.ARQUILLIAN_DATA_PROVIDER)
public void Test() throws IOException {
URL url = new URL("http://197.242.148.253");
InputStream is = (InputStream) url.openStream();
BufferedReader br = new BufferedReader(new
InputStreamReader(is));
String result = br.readLine();
System.out.println(result+"hello");
br.close();
}
}
Can any body provide me some help over this
Try to add at the configuration node the next property:
<property name="allowConnectingToRunningServer">true</property>
Dunno if this will solve your error but I think you need it because, if not, arquillian tries to create a new jBoss instance instead of using the remote running one.
I am using PMD plugin (version 4.0.2) for Eclipse (Eclipse Kepler Java EE). I have configured a naming rule: ShortVariable.
This works fine except for parameters like "id" and "e". I want PMD to ignore these. So I searched for a way to ignore certain parameters. I found this link (although it's for phpmd) and tried it, yet I can't seem to get it working. My config file looks like this (XML):
<?xml version="1.0"?>
<ruleset name="My PMD ruleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
My PMD
</description>
<rule ref="rulesets/java/naming.xml/ShortVariable">
<property name="exceptions" value="id" />
</rule>
</ruleset>
When I try to import this ruleset using the eclipse plugin, it shows no possible rules to import.
Any ideas?
I found a solution to my problem here.
The resulting xml looks like this:
<?xml version="1.0"?>
<ruleset name="My PMD ruleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
My PMD
</description>
<rule ref="rulesets/java/naming.xml/ShortVariable">
<properties>
<property name="xpath">
<value>
//VariableDeclaratorId[(string-length(#Image) < 3) and (not (#Image='id'))]
[not(ancestor::ForInit)]
[not((ancestor::FormalParameter) and (ancestor::TryStatement))]
</value>
</property>
</properties>
</rule>
</ruleset>
To be able to ignore more variable names, repeat the following part:
and (not (#Image='myVariableToIgnore'))
The folowing XML is valid for PHP tool PHPMD 2.2.3
<?xml version="1.0"?>
<!DOCTYPE ruleset>
<ruleset
name="My PMD ruleset for symfony 2.5"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd"
>
<rule ref="rulesets/unusedcode.xml" />
<rule ref="rulesets/codesize.xml" />
<rule ref="rulesets/cleancode.xml" />
<rule ref="rulesets/controversial.xml" />
<rule ref="rulesets/design.xml" />
<rule ref="rulesets/naming.xml">
<exclude name="ShortVariable" />
</rule>
<rule ref="rulesets/naming.xml/ShortVariable">
<properties>
<property name="exceptions" value="id,em" />
</properties>
</rule>
</ruleset>
Update xml
<rule ref="category/java/codestyle.xml/ShortVariable">
<properties>
<property name="xpath">
<value>
//VariableDeclaratorId[(string-length(#Image) < 3) and (not (#Name='id'))]
[not(ancestor::ForInit)]
[not((ancestor::FormalParameter) and (ancestor::TryStatement))]
</value>
</property>
</properties>
</rule>