Cobertura -java.lang.IllegalArgumentException: Class does not have a default interface - cobertura

I am using Cobertura to code coverage for Integration test. I am facing below issue while deploying instrumented jar in JBoss server.
DEPLOYMENTS IN ERROR: Deployment "vfszip:/D:/jboss-5.1.0.GA/server/test/some_jar.jar/" is in error due to the following reason(s):
java.lang.IllegalArgumentException:
Class class com.someclass does not have a default interface
Here are the steps I followed so far:
Downloaded cobertura-1.9.4.1.
Using this command obertura-instrument.bat C:\some_jar.jar I generated the .ser file and instrumented jar for some_jar.jar.
Placed the jar in JBoss server test/ folder.
Copied the .ser file to JBoss/bin folder.
Copied the Cobertura.jar to Jboss/lib folder.
Run the JBoss server.
Please let me know if I am missing any thing here.

Probably a configuration file error because you possibly have not adjusted a setting before starting for the first time.

Related

Tutorial fails for AWS Node.js

I am currently working through AWS's Node.js tutorial, but am stymied at the deployment phase. When I try to upload the provided source bundle, the build fails and I get the following error:
Unable to deploy application version: Configuration validation exception: Invalid option specification (Namespace: 'aws:elasticbeanstalk:container:nodejs:staticfiles', OptionName: '/static'): Unknown configuration setting.
Where does this error come from, and where can I look to fix it?
"The current configuration assumes that you are using Amazon Linux AMI (pre-Amazon Linux 2), but the current default image is "Amazon Linux 2" and the static file parameter has changed."
Solution:
edit .ebextensions/options.config file
change:
aws:elasticbeanstalk:container:nodejs:staticfiles:
to
aws:elasticbeanstalk:environment:proxy:staticfiles:
reference: https://github.com/aws-samples/eb-node-express-sample/pull/21/files

Connecting Java-Spring application war to AWS RDS Oracle DB instance

I have an AWS EC2 windows instance and have my application war running there on Tomcat server. Following is my db.properties file -
driverClassName=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:#whitelabeldb.cyor6spheonu.ap-south-1.rds.amazonaws.com:1521:ORCL
username=admin
password=pwc12345
initialSize=2
maxConnections=10
maxIdle=1
minIdle=1
My application-context file is reading this properties file. When i try to hit any service of my application i get the below error -
Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver'
java.lang.ClassNotFoundException: Could not load requested class : oracle.jdbc.driver.OracleDriver
I tried manually adding the ojdbc6.jar in the lib of the WAR file. By doing that, i stop getting any error in the logs but a 404 in postman. I cannot change the complete architecture of my application and convert into spring boot or something because it is a big application.
Please help me with some solution.
Add ojdbc7 jar to the pom.xml and download the dependency. If not able to add it, try to dowload from https://mvnrepository.com/artifact/com.oracle/ojdbc7/12.1.0.2 and add it to build path.
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>

Running jhipster-registry in native profile: central-config folder not rode

I am currently trying to run jhipster-registry in dev profile to serve the configurations to a jhipster microservice application.
I've followed this official jhipster registry doc and:
have built it from sources, and launched it as follow:
./jhipster-registry-3.0.0.war --spring.profiles.active=dev
And as the doc states, i have put the central-config directory containing <mymicrosericeappname>-dev.yml alongside the jhipster-registry generated war file.
When i launch jhipster-registry, everything is ok,
but when i run my microservice application, it connects to the registry (i can see it in the jhipster-registry dashboard), but i realize that it is reading the application-dev.yml file located at src/main/resources/config/ inside the microservice app.
I dont know if i misplaced the central-config folder...
That said, i really need to know what's wrong.
Thanks
The config directory is specified in bootstrap.yml in search-locations property.
spring:
cloud:
config:
server:
native:
search-locations: file:./central-config
Rather than specifying a relative path (relative to where you launched the regsitry from), you may want to specify an absolute path:
search-locations: file:/home/something/central-config
Also rather than using dev profile, you can use prod with native :
./jhipster-registry-3.0.0.war --spring.profiles.active=prod,native
Thanks to #GaelMarziou, his answer helped me found why the central-config was not being rode.
In fact the Spring Cloud Config bootstrap configuration for the "dev" profile bootstrap.yml file gives this:
cloud:
config:
server:
git:
uri: https://github.com/jhipster/jhipster-registry-sample-config
native:
search-locations: file:./central-config
So each time i ran jhipster-registry, it was pointing the git repo and not the central-config directory.
To get it work, i had to launch the registry in dev,native profile :
./jhipster-registry-3.0.0.war --spring.profiles.active=dev,native
Nevertheless the documentation states this:
Using the dev profile will run the JHipster Registry with the dev and the native profiles.
Which is not really true... considering my struggling.

Error opening zip file or JAR manifest missing : jrebel.jar

When configuring JRebel on my remote server (JBoss on linux) I have configured the JVM arg as
-javaagent:/home/user/jrebel.jar" -Drebel.remoting_plugin=true
The jrebel.jar is absolutely definitely in that location, yet the server fails to start with the error:
Error opening zip
file or JAR manifest missing : /home/user/jrebel.jar Error occurred
during initialization of VM agent library failed to init: instrument
So the arg is oviously being passed to the JVM correctly, but for the life of me I can't work out why it can't find the jar. I've been through every Zero Turnaround article I can find + looked at the solutions that have resolved it for other people, but no luck. Any ideas?
Turned out to be a permissions problem - the JBoss user didn't have the permissions to access the directory that I had placed jrebel.jar into.
Would have been nice to have a more meaningfull error - e.g. 'permissions denied'. Shows my lack of Linux knowledge though I guess.
After the jar was moved to a directory within the JBoss installation + the jar owner was changed to the JBoss user and Read/Write/Execute permissions added, all is well.
Yes , the permission is the reason that this error happens to me when I tried to open PHPSTORM and that error was :
Error opening zip file or JAR manifest missing : ${JetbrainsIdesCrackPath}
Error occurred during initialization of VM
agent library failed to init: instrument
so before running PHPSTORM I had to run the command : sudo -i to get the root permission to run the program.

Is that the 'path to war' which I am giving wrong? If yes,how do I do a rollback?

I have been trying to use the command to rollback the last process of deploying the website which was interrupted due to a network failure.
The generic command that I am using while inside the bin directory of server's SDK (On Linux) is :
./appcfg.sh rollback /path_to_the_war_directory_that_has_appengine-web.xml
Is this the way we do a rollback ? If not please tell me the method.
_(I was asked to make a directory war in the project directory and place the WEB-INF folder in that with appengine-web.xml inside it. It may be wrong)_
I am fully convinced that I am making a mistake while giving the path to my app .
Shot where my .war file is there :
Now the command that I am using is (while inside the bin directory of the server's SDK) :
./appcfg.sh rollback /home/non-admin/NetbeansProjects/'Personal Site'/web/war
The following is the representation of the path to war directory :
Where am I wrong ? How should I run this command so that I am able to deploy my project once again ?
On running the above command I get this message :
Unable to find the webapp directory /home/non-admin/NetbeansProjects/Personal Site/web/war
usage: AppCfg [options] <action> [<app-dir>] [<argument>]
NOTE : I have duplicated the folder WEB-INF. There is still a folder named WEB-INF inside the web directory that contains all other xml files.
The error tells you that the folder /home/non-admin/NetbeansProjects/Personal Site/web/war does not exist. If you look carefully the name of the folder is NetBeansProjects (the filesystem in Linux is case-sensitive).
So, you should run instead the command:
./appcfg.sh rollback /home/non-admin/NetBeansProjects/'Personal Site'/web/war
and just to make sure that the directory exists run first
ls /home/non-admin/NetBeansProjects/'Personal Site'/web/war

Resources