Wrap resources inside custom class and invoke class? - nginx

I am using Puppet 3.0. I tried to use the existing NGINX module but encountered one issue which no answer seems to exist. I have moved to implementing NGINX module myself which handles my exact requirements.
Each package/service/file resource works as expected and now I am moving the code out of init.pp into a /manifest/nginx.pp fileas a class:
class company_nginx {
... Various resources
}
Now I am trying to include this class inside the init.pp
include company_nginx
An it returns an error:
Error: Could not find class nginx for localhost on node localhost
What step or concept am I missing? How do I invoke this "class" in the init.pp file to get the resources invoked and configuring a system???

Manifest file names and the classes defined within them must exactly match. If you want to have a class names company_nginx then it must be in a file names company_nginx.pp.
This required comes from the puppet autoloader.

Your class names must be qualified for Puppet to be able to pick them up.
class nginx::company_nginx { ... }
This class will be loaded from module nginx file manifests/company_nginx.pp.
Doing include company_nginx will make Puppet assume that there is an actual module names company_nginx with the class defined in init.pp.

Related

xquery error library modules cannot be evaluated or no namespace declared

When I deploy modules in JBoss, I'm getting errors:
Library modules cannot be evaluated.
Function 'hello' is in reserved namespace.
No namespace declared for 'm:hello'.
xquery version "3.0" encoding "utf-8";
import module namespace m = 'http://basex.org/modules/Hello' at 'HelloWorld2.xq';
m:hello("Universe")
I already had Helloworld2.xq file in my src/main/resources. It is not recognizing or showing as duplicate namespace. Can anyone help me with this?
Unless you are the owner of the domain "basex.org", you should probably use a different namespace for functions you write. Create a namespace in a part of URI space for which you actually do have some naming rights. That should clear at least the second error.
What relative URI to use to find a module appears to be a frequent source of confusion; if you are using BaseX, be sure to read the BaseX documentation on configuring BaseX via web.xml.

trying to use log4j.xml file within WinRun4j

has anyone tried to use a log4j.xml reference within a WinRun4j service configuration. here is a copy of my service.ini file. I have tried many configuration combinations. this is just my latest attempt
service.class=org.boris.winrun4j.MainService
service.id=SimpleBacnetIpDataTransfer
service.name=Simple Backnet IP DataTransfer Service
service.description=This is the service for the Simple Backnet IP DataTransfer.
service.startup=auto
classpath.1=C:\Inbox\DataTransferClient-1.0-SNAPSHOT-jar-with-dependencies.jar
classpath.2=WinRun4J.jar
classpath.3=C:\Inbox\log4j-1.2.16.jar
arg.1=C:\Inbox\DataTransferClient.xml
log=C:\WinRun4J-Service\SimpleBacnetIpDataTransfer\NBP-DT-service.log
log.overwrite=true
log.roll.size=10MB
[MainService]
class=com.shiftenergy.ws.App
vmarg.1=-Xdebug
vmarg.2=-Xnoagent
vmarg.3=-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
vmarg.4=-Dlog4j.configuration=file:C:\Inbox\log4j.xml
within the log4j.xml file, there is reference to a log file for when the application runs. if I run the java -jar -Dlog4j.configuration=file:C:\Inbox\log4j.xml ...., the log file is created accordingly. if I register my service and start the service, the log file does not get created.
has anyone had success using the -D log4j configuration, using winrun4j?
thanks
I think that you provided the vmarg.4 parameter incorrectly. In your case it has to be like:
vmarg.4=-Dlog4j.configurationFile=[Path for log4j.xml]
I am also using the same and in my case, it is working perfectly fine. Please see below example:
vmarg.1=-Dlog4j.configurationFile=.\log4j2.xml
Have you tried setting the path in your code instead:
System.setProperty("log4j.configurationFile", "config/log4j.xml");
I'm using a relative path to a folder named config that contains log4j.xml. An absolute path is not recommended, but may work as well.
Just be sure to set this before making any calls to log4j, including any log4j config settings or static method calls!
System.setProperty("log4j.configurationFile", "config/log4j.xml");
final Logger log = Logger.getLogger(Main.class);
log.info("Starting up");
I didn't specify the log4j path in the ini file, only placed log4j.xml file at the same place the jar was placed.
Also without specify the
System.setProperty("log4j.configurationFile", "config/log4j.xml");
In the Java project it was stored in (src/main/resources) and will be included in the jar, but it will not be that one used if placed outside the jar.

why application context cannot be loaded?

can any body explain why should i getting the following error message "Failed to load ApplicationContext" while testing my test cases
mvn test
If your using the Spring framework, you can specify the location of your applicationContext.xml file using the #ContextConfiguration annotation:
#RunWith(SpringJUnit4ClassRunner.class)
#ContextConfiguration(locations = { "/path/to/your/applicationContext.xml" })
public class MyTest {
}
Check your #ContextConfiguration. Quote from the Spring documentation:
A plain or relative path — for example "context.xml" — will be treated
as a classpath resource that is relative to the package in which the
test class is defined. A path starting with a slash is treated as an
absolute classpath location, for example "/org/example/config.xml". A
path which represents a resource URL (i.e., a path prefixed with
classpath:, file:, http:, etc.) will be used as is.
So I suppose you have to use "/applicationContext.xml" instead of "/src/test/resources/applicationContext.xml" as the file will be placed at the root level in your classpath.
Since I can't see your configuration you could just change your Test to use the following class level annotations. This should help find the application context as long as it is in the classpath.
#RunWith(SpringJUnit4ClassRunner.class)
#ContextConfiguration({ "classpath:applicationContext.xml" })

executing jar file

I'm trying to get my class "lzw.java" deployed as a jar file ,
I made a manifest.txt , compiled and got all .class files ,put the manifest file along with the created .class files , and entered the command
jar -cvmf manifest.txt lzw.jar *.class
a .jar was created , when I double click it , it gives me "Java Exception error has occured",
having tried to execute it through cmd it gave me " java.lang.NoClassDefFoundError
note : the manifest file contains just a "Main-Class: LZW" followed by new line character
Since you use lzw.java, class and LZW interchanging, I suspect it might be a spelling problem.
lzw.java is the source file, not a class. The class should have the name lzw in this case.
The class file should be lzw.class - if it is not, the name of your class will be like the file-name without dot-class. Of course you choose the right class name in the manifest file.
Post the whole errormessage, not just parts, if this isn't the source of your problem.
Btw.: I suspect you didn't use a package name for your class? And do you know the convention, to user Uperrcase for class names, which would be Lzw in your case - maybe LZW if it is a well established acronym.
This exception means that the JRE is unable to locate the main Java class you are trying to reach. Make sure you are providing the correct class path when running the command.

could not resolve <local:Item> to a component implementation

I am trying to implement item rendere example from TourdeFlex application. However, when I tried to run the application its giving me " could not resolve to a component implementation" error message beside the local items. I also added the assets folder and verified the visualization.swc.
Please let me know the solution to fix the issue.
THanks in advance.
Serenity.
local is XML namespace declared at the top of example, its like import in ActionScript. "Could not resolve" means referenced class is not found. Look at that namespace to determine where it must be placed. For example, xmlns:gui="gui.*" declares namespace gui which references classes from folder "gui".
Edit: xmlns:local="*" means "import all files from src directory". In src should be file Item.mxml or Item.as and it is missing (or failed to compile).

Resources