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.
Related
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
I have a vert.x maven project using the vertx-jdbc-client version 3.6.0 and according to the vertx jdbc docs there are some basic c3p0 configs you can specify in the config object passed in when creating a JDBCClient, but for the rest you need to use a c3p0.properties file on the classpath. I placed the c3p0.properties file in src/main/resources/c3p0.properties with:
initialPoolSize=1
acquireRetryAttempts=1
I verified that the c3p0.properties file is in target/classes after the build, the log output even changes on startup, where it used to say
10:52:57.388 [vert.x-eventloop-thread-0] DEBUG com.mchange.v2.cfg.MConfig - The configuration file for resource identifier '/c3p0.properties' could not be found. Skipping.
It no longer says this with the file there, so it seems it is finding it. But the values are not being respected, I still get the default initial pool size (3) and retry attempts (30).
What am I doing wrong? Any solutions for advanced c3p0 configurations in a maven vertx project?
I'm trying to setup flyway-migration on Websphere server.
My project consists of the modules:
--projectwar.war
--projectsql.jar
--java
--MyFlywayUtil.class
-- resources
-- myscripts
--projectmodel.jar
--java
--MyRiskDataSourceConfig.class
MyRiskDataSourceConfig contains flyway migration declaration:
#Bean(initMethod = "migrate")
public Flyway flyway(#Qualifier("myDataSource") DataSource dataSource) {
Flyway flyway = new Flyway();
flyway.setBaselineOnMigrate(true);
flyway.setClassLoader(MyFlywayUtil.class.getClassLoader());
flyway.setLocations("classpath:"+"myscripts");
flyway.setDataSource(dataSource);
return flyway;
}
When executed under Tomcat using bootRun comand, migration works fine and location is found.
However under Websphere I receive the following:
com.ibm.ws.classloader.CompoundClassLoader#bb6f8b91[app]
Local ClassPath
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/cell01/project.ear/project.war/WEB-INF/classes
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/cell01/project.ear/project.war/WEB-INF/lib/projectmodel.jar
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/cell01/project.ear/project.war/WEB-INF/lib/projectsql.jar
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/cell01/project.ear/project.war
Parent com.ibm.ws.classloader.ProtectionClassLoader#c26663d6 Delegation Mode PARENT_FIRST)
On WebSphere an empty file named flyway.location must be present on the classpath location for WebSphere to find it!
o.f.c.i.u.s.classpath.ClassPathScanner Unable to resolve location classpath myscripts
I've tried configuration with and without flyway.setClassLoader();
Any help would be appreciated.
Did you also add an (empty) file with the name flyway.location to the folder(s) containing your migrations, in my cases this fixed the problem.
Because of the way the IBM class-loader works this file has to be added as a workaround, see also the source
And of course the warning which is given:
On WebSphere an empty file named flyway.location must be present on the classpath location for WebSphere to find it!
According to this git issue, the problem was fixed in flyway 4.0.1
15:28:38.716 [qtp1588771273-32] WARN o.e.jetty.servlet.ServletHandler - /tp/gremlin/execute
java.lang.IllegalArgumentException: Could not resolve dependency of type:javax.transaction.TransactionManager
at org.neo4j.graphdb.DependencyResolver$Adapter$1.select(DependencyResolver.java:87) ~[neo4j-kernel-2.2.9.jar:2.2.9]
at org.neo4j.kernel.extension.KernelExtensions.resolveDependency(KernelExtensions.java:112) ~[neo4j-kernel-2.2.9.jar:2.2.9]
This is from Neo4j 2.x (the Gremlin plug-in). The package, when built and deployed as instructed at https://github.com/thinkaurelius/neo4j-gremlin-plugin, does contain the jar-file which describes this class, and Maven did download it and did install it there. But, when the server attempts to load and execute the extension, nothing is resolved.
Why?
I'm using Jenkins 1.6.20 (Git Client Plugin 1.18.0, Git Plugin 2.4.0) to get the Java application code from bitbucket.org and deploy it to Apache Tomcat 8.0.23.
The error appears while deploying and looks like:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/spr$
public java.util.List by.ipps.accounting.ws.PositionWS.getEmployeePost(java.lang.Long)
to {[/positionListJson/{id}],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}: There is already 'resourceWS' bean method
public by.ipps.accounting.model.Employee.EmployeePost by.ipps.accounting.ws.ResourceWS.getEmployeePost(java.lang.Long) mapped.
bla-bla-bla ... so many errors ...
Caused by: java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'positionWS' bean method
public java.util.List by.ipps.accounting.ws.PositionWS.getEmployeePost(java.lang.Long)
to {[/positionListJson/{id}],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}: There is already 'resourceWS' bean method
public by.ipps.accounting.model.Employee.EmployeePost by.ipps.accounting.ws.ResourceWS.getEmployeePost(java.lang.Long) mapped.
The problem is that the class (with annotation #Controller) PositionWS with method getEmployeePost was renamed to ResourceWS a week ago, so exists no more, so I should not get this error.
To fix this I have to create a blank PositionWS controller (with no methods in it), commit & push that to bitbucket (and delete (cus i really don't need it) later and commit & push).
It seems to be like a bug in any of the applications I use. I can't find out in which app there is a bug to report it. Tell me please, if anyone faced such problems.
The heart of the issue was in incorrect configuration of Jenkins, it was my fault.
When I was configuring Jenkins I set maven goal as "install", but it must be "clean install". According to this Jenkins never deleted old files and kept them, so got a lot of issues of different kinds and with different log messages.
Due to Jenkins working specialty it downloads project files and try to assemble it on path /var/lib/jenkins/jobs/<projectName>/workspace/target/.
So I've drop the data in this folder and afterwards set maven goal to "clean install" and that fixed the issue.