I am using JMeter version 5.0 r and I am following [this tutorial]
(https://docs.wso2.com/display/EI630/Point-to-Point+Messaging#865c10b8d4d64ac688d6a0799cfb6012),
jndiqueues.properties
# register some connection factories
# connectionfactory.[jndiname] = [ConnectionURL]
connectionfactory.QueueConnectionFactory = amqp://admin:admin#clientID/carbon?brokerlist='tcp://localhost:5675'
# register some queues in JNDI using the form
# queue.[jndiName] = [physicalName]
queue.FirstQueue = myfirstqueue
when I am running this JMS publisher I am getting error as:
Response message: javax.naming.NamingException: javax.naming.NoInitialContextException: Cannot instantiate class: org.wso2.andes.jndi.PropertiesFileInitialContextFactory [Root exception is java.lang.ClassNotFoundException: org.wso2.andes.jndi.PropertiesFileInitialContextFactory ]
This jar is already there in lib folder still I added want to add it in classpath because it was giving this error. So I edited user.properties file, like mentioned in an answer here:
user.classpath=../classes;../lib;../app1/jar1.jar;../app2/jar2.jar;../lib/andes-client-4.0.0.jar
But still I am getting same error. What am I doing wrong?
If you copied andes-client-4.0.0.jar to "lib" folder of your JMeter installation there is no need to set up user.classpath property, JMeter will automatically pick it up.
Remember that you need to restart JMeter for any property change application and when you add .jars under JMeter Classpath, otherwise the changes will not be picked up.
More information:
JMeter Properties Reference
Apache JMeter Properties Customization Guide
You can also add the libraries to JMeter Classpath at Test Plan level like:
in that case JMeter restart will not be required
try the same you did but using absolute class paths instead of relative ones
What it worked for me was to use:
<propertiesJMeter>
<search_paths>${project.basedir}/some_path</search_paths>
<user.classpath>${project.basedir}/some_path</user.classpath>
</propertiesJMeter>
Hope it helps
Related
I just started right now a new project in Intellij using Spring Boot ver 2.1.3 and Flyway 5.2.4 with Java 11.
After try to start my project i got :
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flyway' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.flywaydb.core.Flyway]: Factory method 'flyway' threw exception; nested exception is java.lang.IllegalStateException: Cannot find migrations location in: [classpath:db/migration] (please add migrations or check your Flyway configuration)
I have the following folders:
As you can see i have "db/migration" but without any migration, i just started right now. Debugging the class FlywayAutoConfiguration i got the following:
So, i tried to return all files in "classpath:", see:
Note that i just have "application.properties" file.
It is not that much useful or accurate answer.
But This issue make you frustrated so that i give this solution.
Note: Strange but it's true, Sometime it's not allow copy paste because your folder created db.migration and it expact db->migration(It's not same in this scenario). So whenever you start from scratch. Go to the resource folder -> Create DB folder -> Create migration folder -> Create database file with Version_SubVersion__Name(As defined below).
Normally this happens in following cases,
Path is not proper try using set locations param value.
db.migrate folder not contain any file.
Check name of file : V1_1__(short_desc)
Try to run using, mvn compile flyway:migrate
In my case i already place sql file over there but still it gives same error,
Basically i place this sql file using copy paste from somewhere.
When i try to add one new file on same place using IDE (Intellij : Right click on migration folder -> new -> Flyway migration -> versioned migration), then it ask me(warning) about some delicate allowance(normally we mention in database configuration i also place there still), and it start working.
Flyway requires at-least one script, disable it until u need it by using following command in application.properties file
spring.flyway.enabled=false
I believe that Flyway requires at least one migration script to initialize. Try adding a simple sql creation script into your migration folder and give it another try. Alternatively you can disable the flyway dependency until you need it.
I had a similar error, and solved it as follows: I added these commands
spring.flyway.baselineOnMigrate=true
spring.flyway.check-location=true
spring.flyway.locations=classpath:db/migration
spring.flyway.schemas=public
spring.flyway.enabled=true
to application.properties
I had the same issue. When I created the directory, I simply typed db.migration - the same way one would do with package names. InteliJ will display both db.migration and db/migration directories as db.migration, so while it may look correct in IntelliJ, flyway requires the latter.
Even when having your migration files in the db/migration folder, flyway won't detect it.
Then you will have to fix this by explicitly setting the locations in your application.properties (or appliocation.yml) by adding:
spring.flyway.locations=classpath:db/migration
N.B: Also you need to have at least one script to initialize flyway, you can even put an empty one. But you need to have at least one script
As #Guy suggested in his answer, I created an SQL file in the migration folder and left it empty. Named v1_0__mock_flyway.sql in the migration folder classpath:db/migration. Error solved.
If you have tried everything above and it still does not apply the migrations.
Be sure you have followed the steps in the previous answers
A db.migration folder exists in your resources folder
The sql scripts are named with respect to the correct naming convention, such as V1__init.sql
The following config exists in your application.properties/application.yml
spring.flyway.locations=classpath:db/migration
Do a clean build
-> mvn clean
Then restart your spring boot app, this worked for me.
I am trying to establish a JMS connection. In connectionFactory.createContext, I get an error that the ActiveMQ version loader reports that a properties file is missing:
Caused by: java.lang.RuntimeException: activemq-version.properties is not available
at org.apache.activemq.artemis.utils.VersionLoader.getVersion(VersionLoader.java:87)
I am running the project from Eclipse - so it's most likely an eclipse classpath issue, but I can't find which library is missing.
Full stacktrace:
javax.jms.JMSRuntimeException: Failed to create session factory
at org.apache.activemq.artemis.jms.client.JmsExceptionUtils.convertToRuntimeException(JmsExceptionUtils.java:88)
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createContext(ActiveMQConnectionFactory.java:262)
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createContex t(ActiveMQConnectionFactory.java:248)
at at.cone.health.dispo.online.DispoServerFacadeImpl$JMSReceiverThread.run(DispoServerFacadeImpl.java:109)
Caused by: javax.jms.JMSException: Failed to create session factory
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:727)
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createContext(ActiveMQConnectionFactory.java:255)
... 2 more
Caused by: java.lang.RuntimeException: activemq-version.properties is not available
at org.apache.activemq.artemis.utils.VersionLoader.getVersion(VersionLoader.java:87)
at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.<init>(ActiveMQClientProtocolManager.java:81)
at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManagerFactory.newProtocolManager(ActiveMQClientProtocolManagerFactory.java:49)
at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.newProtocolManager(ServerLocatorImpl.java:575)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.<init>(ClientSessionFactoryImpl.java:173)
at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:757)
at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:724)
... 3 more
The code where I try to set up the connection:
InitialContext namingContext = new InitialContext(env);
ConnectionFactory connectionFactory = (ConnectionFactory) namingContext.lookup(CONNECTION_FACTORY);
System.out.println("Got ConnectionFactory " + CONNECTION_FACTORY);
destination = (Destination) namingContext.lookup(DESTINATION);
System.out.println("Got JMS Endpoint " + DESTINATION);
final JMSContext context = connectionFactory.createContext("internal", "internal");
this.context = context;
JMSConsumer consumer = context.createConsumer(destination, "client='" + clientUID + "'", true);
// Then receive the same number of messages that were sent
The project is ANT based, so I cannot use maven dependency management. Nevertheless, the server part uses a maven build, so I have a local maven repository and an eclipse build path variable M2_REPO pointing to the .m2 directory. I tried to set up a library dependency in my eclipse project. I am running the project from eclipse, so we can - at first - ignore ANT related dependencies, and focus just on eclipse (but without maven).
I added a library dependency to the wildfly-client-all-10.0.0.Final.jar from my maven repo (using my M2_REPO variable, extended by the path). The library is correctly displayed as referenced library in the eclipse project.
I implemented a demo with same lines of codes in an eclipse maven project. Here I didn't get an exception, in the demo I was able to receive messages. So I assume it's a classpath issue.
I also searched for the missing activemq-version.properties on google and on stackoverflow, but didn't find anything related. I also didn't find a resource called activemq-version.properties, even not in the demo project (and its dependencied) where it was executed successfully.
After some more investigation, I did now identify the reason.
In the run config, I had a different classpath. This classpath remained from an elder configuration. Here, I didn't use the same jar as the maven build. The run configuration contained both the jboss-client.jar and the jboss-cli-client.jar from wildfly/bin/client directory.
This configuration was wrong, and caused an additional warning which I didn't recognize in my logs, but which was also a hint to the solution:
WARN: EJB client integration will not be available due to a problem setting up the EJB client handler
I changed it to the wildfly-client-all-10.0.0.Final.jar which is also contained in maven project runtimes, but it again didn't solve the issue.
Then I found this article: https://developer.jboss.org/thread/267824
Solution: back to the first configuration approach for the runtime config, using the JAR from wildfly\bin\client directory, but only the jboss-cli-client.jar AND NOT the jboss-client-jar.
I am trying to run the Spring 4 example given # https://spring.io/guides/gs/messaging-stomp-websocket. When I try to connect to socket, it throws me following exception. As per the example you need tomcat 7.0.50 and I checked the executable jar which has right version of tomcat. Any pointer would be helpful.
java.lang.IllegalArgumentException: No 'javax.websocket.server.ServerContainer' ServletContext attribute. Are you running in a Servlet container that supports JSR-356?
Check that you have tomcat7-websocket.jar and websocket-api.jar bundled in your executable jar - perhaps you're just getting vanilla tomcat without the extra websocket bits.
I got the same error message in another use case: I deactivated auto configuration and added WebSocketConfig manually to the configuration. Then I got the abovementioned error message.
Fixing the problem was easy: just adding WebSocketAutoConfiguration to the configuration.
I know that this is an ancient thread but I ran into this error and resolved it in modern times by adding implementation("org.springframework.boot:spring-boot-starter-tomcat") explicitly to my project.
I am working with a Web application written in cocoon framework (Java) and running on WAS 7.0.0.0.
When running on WAS 6.X.X.X everything works fine.
However, on WAS 7 during runtime I am receiving the following error:
java.lang.ClassCastException org.apache.xerces.jaxp.DocumentBuilderFactoryImpl incompatible with javax.xml.parsers.DocumentBuilderFactory
at javax.xml.parsers.DocumentBuilderFactory.newInstance
We suspect that this is a ClassLoader issue.
I have tried many steps to overcome this issue:
I have tried to add in the WAS Administration Console a new Custom properties:
Application servers -> Server Name -> Process definition -> Java Virtual Machine -> Custom properties
Name = javax.xml.parsers.DocumentBuilderFactory
Value = org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
But this did not resolve the problem!
I tried to change the WAS class loader order in the WAS Admin Console between parent first and parent last - both options did not resolve the issue.
Please let me know if you need additional information.
Because was7 must have these jars inbuilt. You need to remove these jars from your ear/war and then deploy. Multiple copies of the same jars are conflicting.
Regards,
I am trying to deploy an application on WAS 6.1 Server.
However, I am getting the below error:
java.lang.NoClassDefFoundError: org.apache.log4j.Logger
at myPackage.myClass.<clinit>(myClass.java:40)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:194)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1328)
at com.ibm.ejs.container.EJSContainer.loadBeanMetaData(EJSContainer.java:1756)
at com.ibm.ejs.container.HomeOfHomes.loadBeanMetaData(HomeOfHomes.java:1073)
at com.ibm.ejs.container.HomeRecord.getHomeAndInitialize(HomeRecord.java:454)
at com.ibm.ejs.container.EJSContainer.getHomeWrapperCommon(EJSContainer.java:1322)
at com.ibm.ejs.container.EJSContainer.getHomeInstance(EJSContainer.java:1231)
at com.ibm.ejs.container.EJSContainer.startBean(EJSContainer.java:1217)
at com.ibm.ws.runtime.component.EJBContainerImpl.startBean(EJBContainerImpl.java:3385)
at com.ibm.ws.runtime.component.EJBContainerImpl.startModule(EJBContainerImpl.java:2589)
at com.ibm.ws.runtime.component.EJBContainerImpl.start(EJBContainerImpl.java:3719)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1304)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1165)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:587)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:832)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:950)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$AppInitializer.run(ApplicationMgrImpl.java:2131)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:342)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java:579)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:414)
at java.lang.ClassLoader.loadClass(ClassLoader.java:597)
... 22 more
In
Admin Console -> Servers -> Application Servers -> myServerName -> Java and Process Management -> Process Definition -> Java Virtual Machine -> ClassPath
I have an entry as below:
${MY_JARS}\log4j-1.2.15.jar
Where in 'Custom Properties' MY_JARS key contains value as the path to the log4j jar
I did server clean and restart, republish, redeploy the application umpteen number of times. But this error is not going.
What am I doing wrong ?
To use ${MY_JARS} that way, you need to define it in Environment > WebSphere Variables, not in Custom Properties.
However I'd caution you about adding log4j in that manner. I seem to recall log4j might not work correctly if a single jar is shared across multiple apps. I think we attempted using log4j as a Shared Library (probably the more recommended way of doing what you're trying to do, BTW), but ended up needing to deploy to each application's WEB-INF/lib instead.
As dbreaux already pointed out you have to create environment variables with the correct scope. A custom property is available at runtime, but not for the server configuration level.
Within the WAS you can check what libraries are loaded. IIRC you have to click on the Application, afterwards on the Web Module and than you should be able to check the classloaders. If you open up the classloaders, you will see what libraries are loaded.
Please make sure log4j.jar is on the CLASSPATH of your application.For example; under WEB-INF\lib