magento 2 Notice: Undefined index: modules - magento2

Anybody please tell me how to write the below code under config tag.
<modules>
<Tagalys_MerchandisingPage>
<version>0.1.0</version>
</Tagalys_MerchandisingPage>
</modules>

etc/module.xml can be defined as below
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Tagalys_MerchandisingPage" setup_version="0.1.0">
</module>
</config>
and registration.php is as below:
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Tagalys_MerchandisingPage',
__DIR__
);

Related

Use .targets to replace file in NuGet package

I have a NuGet package that depends on another NuGet package but I want to replace one of the unmanaged DLLs with one of mine. This works well, but now I'm trying to add support for both x86 and x64 using a .targets file. When my target application builds, it pulls down the original version, not the replacement.
Here's my .nuspec:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>MyPackage</id>
<version>2.0.0</version>
<dependencies>
<group targetFramework=".NETFramework4.5.2">
<dependency id="YourPackage" version="1.0.0" />
</group>
</dependencies>
</metadata>
<files>
<file src="MyPackage.targets" target="build\net452" />
<file src="..\lib\x86\thepackage.dll" target="lib\net452\x86" />
<file src="..\lib\x64\thepackage.dll" target="lib\net452\x64" />
</files>
</package>
Here's my .targets:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="PlatformCheck" BeforeTargets="InjectReference"
Condition="(('$(Platform)' != 'x86') AND ('$(Platform)' != 'x64'))">
<Error Text="$(MSBuildThisFileName) does not work correctly on '$(Platform)' platform. You need to specify platform (x86 or x64)." />
</Target>
<Target Name="InjectReference" AfterTargets="ResolveAssemblyReferences">
<ItemGroup Condition="'$(Platform)' == 'x86' or '$(Platform)' == 'x64'">
<Reference Include="MyPackage">
<HintPath>$(MSBuildThisFileDirectory)$(Platform)\thepackage.dll</HintPath>
</Reference>
</ItemGroup>
</Target>
</Project>
What am I doing wrong?
EDIT: If I change the .nuspec...
<file src="..\lib\x86\thepackage.dll" target="lib\net452" />
<file src="..\lib\x64\thepackage.dll" target="lib\net452" />
... then it pulls down my version but uses x86 for both x86 and x64 builds.
I solved it by putting the files in the build folder and then simply copying the target file.
.nuspec:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>MyPackage</id>
<version>2.0.0</version>
<dependencies>
<group targetFramework=".NETFramework4.5.2">
<dependency id="YourPackage" version="1.0.0" />
</group>
</dependencies>
</metadata>
<files>
<file src="MyPackage.targets" target="build\net452" />
<file src="..\lib\x86\thepackage.dll" target="build\net452\x86" />
<file src="..\lib\x64\thepackage.dll" target="build\net452\x64" />
</files>
</package>
.targets:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="PlatformCheck" BeforeTargets="InjectReference"
Condition="(('$(Platform)' != 'x86') AND ('$(Platform)' != 'x64'))">
<Error Text="$(MSBuildThisFileName) does not work correctly on '$(Platform)' platform. You need to specify platform (x86 or x64)." />
</Target>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)$(Platform)\thepackage.dll">
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

Configuration of aws-messaging:annotation-driven-queue-listener

I have configured as shown but get
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aws-messaging:annotation-driven-queue-
listener'.
context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aws-context="http://www.springframework.org/schema/cloud/aws/context"
xmlns:aws-messaging="http://www.springframework.org/schema/cloud/aws/messaging"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/cloud/aws/context
http://www.springframework.org/schema/cloud/aws/context/spring-cloud-aws-context.xsd
http://www.springframework.org/schema/cloud/aws/messaging
http://www.springframework.org/schema/cloud/aws/messaging/spring-cloud-aws-messaging.xsd">
<aws-messaging:annotation-driven-queue-listener/>
</beans>
In the pom I have
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-aws</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>
I have configured as shown but get
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aws-messaging:annotation-driven-queue-
listener'.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aws-context="http://www.springframework.org/schema/cloud/aws/context"
xmlns:aws-messaging="http://www.springframework.org/schema/cloud/aws/messaging"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
ht tp://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/cloud/aws/context
http://www.springframework.org/schema/cloud/spring-cloud-aws-context.xsd
http://www.springframework.org/schema/cloud/aws/messaging
http://www.springframework.org/schema/cloud/spring-cloud-aws-messaging.xsd">

How to force wildfly-8.2.1.Final to load .class from a directory rather than war?

I want load .class file from a given directory so, i put compiled file inside the directory /opt/wildfly-8.2.1.Final/modules/packagename/ and also server load the classes from the same directory rather than war(WEB-INF/classes/packagename/).
I haven't tried this method myself, but you must:
Move /opt/wildfly-8.2.1.Final/modules/packagename/ to
/opt/wildfly-8.2.1.Final/modules/custom-classes/main/packagename/
Add file module.xml to
/opt/wildfly-8.2.1.Final/modules/custom-classes/main/
Add file jboss-deployment-structure.xml to your war.
Undeploy the war, restart the server and then redeploy the war.
Content of module.xml:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="custom-classes">
<resources>
<resource-root path="."/>
</resources>
</module>
Contents of jboss-deployment-structure.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="custom-classes" />
</dependencies>
</deployment>
</jboss-deployment-structure>
Edit: If you want to add jars as well as non-jared classes to your module you must not only copy jars to /opt/wildfly-8.2.1.Final/modules/custom-classes/main/, but also list jars in module.xml like this:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="custom-classes">
<resources>
<resource-root path="."/>
<resource-root path="dependency1.jar"/>
<resource-root path="dependency2.jar"/>
<!-- and so on for other jars -->
</resources>
</module>
Resources:
Class Loading in WildFly
How to write jboss-deployment-structure.xml
How to ad directory to JBoss classpath

Build folder stays empty

Hi Im trying to follow the tutorial here regarding Struts. I have followed the tutorial exactly but am getting an HTTP 404 error. I know this error basically means that the resource can't be found be the the IDE.
I noticed that the 'Build' folder is actually completely empty - so I'm guessing that it should have automatically created a runnable project based on my project specifics and this is actually where the server looks in order to run an application.
So how do I go about manually generating this file? Should I drag all the resources in? Java classes, JSP files and so? If not how do I configure it to automatically build?
Cheers
EDIT
Have added what I think will be necessary to help solve this:
Web.xml Located in the WEB-INF folder, next to lib
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Struts2 Application</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>Login.jsp</welcome-file>
</welcome-file-list>
Struts.xml Located in a src folder called resources in the Java Resources folder
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts.custom.i18n.resources" value="ApplicationResources" />
<package name="default" extends="struts-default" namespace="/">
<!--
If we changed from the default execute() method, which struts looks for
to say authenticate(), then we would have to specify this in the action
method below like this:
<action
name="login"
method="authenticate"
class="net.viralpatel.struts2.LoginAction">
</action>
-->
<action name="login" class="net.viralpatel.struts2.LoginAction">
<result name="success">Welcome.jsp</result>
<result name="error">Login.jsp</result>
</action>
</package>

JBoss AS 7 modules: can do a module with all libraries in a directory?

I want to define a module with a resource-root like this:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mymodule">
<resources>
<resource-root path="libs"/>
</resources>
<dependencies />
</module>
The directory contains all the libraries I need.
I've tried it and it not work, but if I put it this way it work:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mymodule">
<resources>
<resource-root path="libs/lib1.jar"/>
<resource-root path="libs/lib2.jar"/>
<resource-root path="libs/lib3.jar"/>
<resource-root path="libs/lib4.jar"/>
........
</resources>
<dependencies />
</module>
Is there a way to do it the first?
Try and use libs.* in your first implementation
UPDATE:
This feature is not currently available, though its under R&D
If you need to include multiple jars in a module, you will need to instantiate each indivisually
I know this one is old, but I just had the same problem on EAP-7 and solved it as follows:
You may want to create the module using the JBoss CLI. My problem was to supply multiple resources as it was yours. I am using the attribute resource-delimiter and provide my list of resources as follows:
module add --name=my.module --resource-delimiter=, --resources=libA.jar,libB.jar,libC.jar --dependencies=my.dep.a,my.dep.b
This generates the following module.xml in the respective JBoss folder:
<?xml version="1.0" ?>
<module xmlns="urn:jboss:module:1.1" name="my.module">
<resources>
<resource-root path="libA.jar"/>
<resource-root path="libB.jar"/>
<resource-root path="libC.jar"/>
</resources>
<dependencies>
<module name="my.dep.a"/>
<module name="my.dep.b"/>
</dependencies>
</module>
Hope it helps.