connection errors in the grinder - java

I am trying to use the grinder load testing tool to reproduce the navigation recorded on a .har file using chrome dev tools.
I have generated this test script using har2grinder.
The script looks faily simple, just a bunch of get/post invocations and their headers.
I launch the grinder console:
java -classpath lib/grinder.jar net.grinder.Console
And then the agent processes, using this properties file:
java -classpath lib/grinder.jar net.grinder.Grinder grinder.properties
Then I start the whole thing from the console and all I can get is this output, showing 1000 errors on each of the 2 pages visited:
The web server (tomcat) log doesn't show any hits, and I don't see any grinder logs with any further details. How can I trace the problem?

Cant access the properties file :(
You need to look into the properties first and get the logs working ,
Please check grinder.logDirectory value , the logs will contain information .
Secondly check whether grinder.useConsole is set or not and the value of grinder.consolePort grinder.consoleHost have been edited to something other than default .Usually this change is not required.
Also set grinder.processes ,grinder.thread and grinder.run to 1 so that there is only one process with one thread and executes once will be easier to debug .
Next if you are NOT running against localhost then probably check that its not getting blocked across firewall since Grinder is really fast and can send many request in a small time .However these type of errors will get recorded in grinder logs and are very self explanatory.

Related

Windows could not start service, Error 1053: The service did not respond to the start or control request in a timely fashion

I have created a Java program then I need to install it as windows service.
First I run the jar directly from console and it ran as I wish, then I compile the jar to exe and I ran it as Admin ran OK.
But when I run it from windows service I got following error,
Error 1053: The service did not respond to the start or control request in a timely fashion
I also tried to set Account and password on Log On Tab, but not resolved yet.
It's not possible to resolve the actual problem with the information given by you, so I will provide you the steps necessary to debug the problem.
Use logging in your application to see what causes the error: Apache Log4j
You can use the Windows Event Viewer to see what happens when you start your Windows Service. This is very useful if the problem happens before the start of the application itself.
Click on Start / Windows symbol, type Event Viewer and press Enter. In the left hand tree-menu, click Windows Logs and then Application.

Functional Testing in Jmeter

I am new to JMeter and I wish to do a functional test on a website. I have added an HTTP request default and added a recorder and I successfully recorded my usecase. When I run the script it shows as executing in the view record table listener. There are a few errors along the way but the script does execute.
After the script terminates execution I logged into the website and the use-case has not got executed. I am confused as to what is going on.
As per 4 Things You Should Never Do with Your JMeter Script article:
2. Don’t run the script exactly as you recorded it
After recording your script, there is still some work to do before you run it. It’s necessary to correlate variables, parameterize and add elements, to faithfully simulate users.
First of all add a HTTP Cookie Manager to your Test Plan, most web applications use cookies for authentication and cookie support is a vital part of JMeter web test plan.
Record your test one more time and compare 2 recorded scripts. If there are differences - you will need to correlate the corresponding values, i.e. extract them from the previous response using one of JMeter's Post-Processors and substitute recorded "hard-coded" values with the appropriate JMeter Variables
Add View Results Tree listener to your Test Plan and re-run your test scenario carefully inspecting request and response details. The fact that request is not failing doesn't necessarily mean the fact your test is doing what it is supposed to be doing as you might be hitting login page all the time and JMeter simply treats HTTP Status Code 200 as successful.

How to execute MSDOS Command from browser (PHP or Java)

I have a USB line display, similar to the ones that are used in store point of sale systems.
To print ABC to this line display, I run the following command:
echo ABC > \\.\LCLD9\
This prints ABC to the line display.
I'm trying to figure out how to control this output from a website, if possible, although I am not sure if it would be possible, as I can see security issues with being able to run arbitrary commands form web pages.
I'm trying to figure out how to control this output from a website, if possible, although I am not sure if it would be possible, as I can see security issues with being able to run arbitrary commands form web pages.
This is indeed not possible on an unmodified system. There is no way for a web page to run an arbitrary command on the user's machine -- that is the definition of a security vulnerability.
If you can get the user to install software ahead of time, you could use a Chrome extension with the serial, usb
or nativeMessaging APIs to expose this functionality to web pages.
Check out function shell_exec. http://php.net/manual/en/function.shell-exec.php
There are several ways to do this. One way is to simply have your website store the current text somewhere and then build a script on the local PC that asks your website for the current text and updates the display. You can schedule that script to run periodically using the Task Scheduler.
This script can be as simple as this (assuming PHP is installed on your local PC):
<?php
$text = file_get_contents('https://example.com/current_text.php');
shell_exec('echo "' . $text . '" > \\.\LCLD9\');
If you don't have PHP installed and don't want to install it, you can probably do something similar in a Powershell script or in a plain old batch file.
Note that you probably want to add some extra checks to this, you don't want to accidentally clutter your display with a 404 error page, a 500 internal server error or a network error.

unable to start jenkins after editing matrix based security

I deployed latest jenkins war in tomcatrunning on my W$7 machine.During my first log in i configured something in matrix based security as explained here.After adding a user in the matrix, ia m unable to load the jenkins. The following error stack is shown. For complete stack trace please visit here..
Now, When i go to the login page, i could see the login form. Do we have any default login to proceed ?
Note: as described in that article i don't see create an account tab in the login page. Hence i am unable to proceed.
Stack trace :
hudson.security.AccessDeniedException2: anonymous is missing the Overall/Read permission
at hudson.security.ACL.checkPermission(ACL.java:54)
at hudson.model.Node.checkPermission(Node.java:418)
at jenkins.model.Jenkins.getTarget(Jenkins.java:3680)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:612)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:799)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:587)
at org.kohsuke.stapler.Stapler.service(Stapler.java:218)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:96)
Edit:
I have also, redeployed the war.The issue was still there.
So then, i have downloaded the fresh war file from the JenKins site and deployed in the tomcat of xampp. When ever, i navigate to the jenkins app , the Java SE crashes.
It looks like you locked yourself out. Here are the lock picker instructions:
Securing Jenkins
...
Disabling Security
One may accidentally set up security realm / authorization in such a way that you may no longer able to reconfigure Jenkins.
When this happens, you can fix this by the following steps:
Stop Jenkins (the easiest way to do this is to stopthe servlet container.)
Go to $JENKINS_HOME in the file system and find config.xml file.
Open this file in the editor.
Look for the <useSecurity>true</useSecurity> element in this file.
Replace true with false
Remove the elements authorizationStrategy and securityRealm
Start Jenkins
When Jenkins comes back, it will be in an unsecured mode where everyone gets
full access to the system.
If this is still not working, trying renaming or deleting config.xml.
I followed the steps in below source.But still faced the same issue.
https://wiki.jenkins-ci.org/display/JENKINS/Disable+security
Finally, I tried to unistall and install the jenkins in another directory which help me to start working.
Hope it will help some one.
All the above answers are wonderful, but nobody mentions the elephant - which is HOW does one get matrix security to work? I went round and round with this until I happened upon what I think is the answer.
Here's what I did:
Disable security, as above
Go in to the 'configure global security' page
Select matrix security, and immediately enable all for anonymous
Add your users and set their permissions, making sure there is at least one administrator (I assume with all permissions).
Save, and make sure you are now logged in as an administrator.
Go back and turn off all but view permissions on anonymous (or whatever your 'anonymous access rules' are).
Save.
Done.
I believe the trick for getting past the 'Anonymous must have ' error is to be sure you are logged in BEFORE turning off anonymous admin privs.
you can do one thing
stop the jenkins (using tomcat)
go to config.xml present in JENKINS folder.
Look for the <useSecurity>true</useSecurity> element in this file.
Replace true with false.
Remove the elements authorizationStrategy and securityRealm
Start Jenkins
When Jenkins comes back, it's in the unsecured mode where everyone gets full access to the system
Fixed by two simple steps:
Go to Jenkin Home
rename config.xml
Try launch the Jenkin

J2EE Java server side error debug interview

In a recent job interview I was asked a J2EE debugging question. The question was As Follows:
"You are not getting same data as expected from your server how do you debug it?"
What or how should I answered this question that would make the interviewer happy??
Please suggest....
On the top of my head, usually you would
check the request and compare it with API - is the request being done correctly
check the logs for any problems on the server
confirm that the version of server application matches the one expected
check the database data status
if else fails, try to reproduce the problem locally or in a lower environment or step through the server app execution path with a debugger. Increasing the log level or hooking up to debug interface might be relevant as well.
When you have to debug code to server there is a common way on how to debug the code. You see server logs. Now, if you cannot find any errors, you have to see what the API returns at every single step. If you have not logs for every step, put log.debug("Some text that means something"); and rerun. If something is unusual, then you have to check the specific step.
The question is too general and opens a way for you to literally bombard the interviewer with questions and that's probably what he expects you to do.
Usually when sh. hits the fan I want to know: does the user receive any data at all? If not, app log, server log and db log is where I look. Some apps we use got app log located on the disk where the app is running, some are using db based logs and some are using the default log which can be accessed through admin console on the server (Glassfish for example).
On the other hand if the user received incorrect data I start tracking through the app how the data is "made" which usually means going through several db queries and such where I'm trying to determine what's going on. After that I compare the result I expect with the result user received and according to the difference I decide what went wrong.
But hey this question is too general in this environment so you either let the interviewer specify the problem or create your own scenario for him.

Categories