I am having an issue that one of my classes are loaded by two classloaders at the same time. I am getting
Caused by: java.lang.ClassCastException:
com.mycomp.myapp.InteractiveSpec cannot be cast to
com.mycomp.myapp.InteractiveSpec
Which basically means its a classloader issue.
Now In jboss i remember, we used to put -v in the server startup JAVA OPTs and it used to give very detailed verbose server log and which class is having an issue and is from which jar (I think it also specified the class loader as well but I am not sure). It helped me debug when I had two different versions of one jar.
Does any one know how to debug in wildfly which class is coming from which jar and which class loader.
Thanks.
-verbose:class in Java OPts. I thought it was something specific to Jboss. This should work in every app server.
Related
I am attempting to create a small C++ Visual Studio Forms (via CPPCLR_WinformsProjekt) application that is essentially a browser but it also starts a local Tomcat 8.5 server with a WAR file in its web apps folder and redirects you to the localhost page. I am working on Windows.
My question precisely is - what is the best way to start the Tomcat server through C++ libraries?
Edit: The way I started solving this is by simply having the tomcat folder with the WAR file zipped within the Visual Studio project. On execution, the file gets unzipped, and I am thinking of having a system(*start tomcat command*).
NB: I know I can start Tomcat through the cmd but I need to get it working via C++.
[I am assuming you are under Windows, but on Unix-es similar ways are available.]
In a C++ program you can execute all commands that a shell can, so the easiest way to start Tomcat would be to use CreateProcess to execute catalina.bat (or startup.bat). The is also the most easily configurable way: a user can adapt setenv.bat to its needs.
Of course, if you want to omit the *.bat files you can:
either instantiate a JVM using java.exe with the appropriate parameters: you need at least bin/bootstrap.jar in the system classpath (and usually bin/tomcat-juli.jar) and call the main method of org.apache.catalina.startup.Bootstrap with a parameter of start.
or instantiate a JVM using jvm.dll through the Invocation API in a similar way as it is done by procrun.
I don't believe these methods give you any advantage over the *.bat scripts. To stop a modern Tomcat just send the kill signal.
Edit: If you plan to start only one specific web application a full-fledged Tomcat might be overkill. You might instead:
either use Tomcat Embedded, which boils up to writing on class and calling its main method instead of Boostrap#start. The advantage is, you just need to distribute a bunch of jar files and your WAR and you don't need a traditional Tomcat installation directory structure,
or user use Spring Boot.
Please forgive me since I'm rather new to this, but I'll try to explain the situation as best as I can.
The current system is running on ColdFusion 9 and ActiveMQ 5.3.1. We are trying to upgrade the system to ColdFusion 11 and I'm running into some issues. In ColdFusion 9 ActiveMQ appears to run fine on Beta and Production (we also have a local and alpha environment) however in ColdFusion 11 I get the following error: http://puu.sh/gVp1L/d77453416f.png This happens in the /CFIDE/adminapi/eventgateway.cfc:204 which of course is a file that has been abstracted to not be readable.
I have tried the following:
Three different ActiveMQ servers
Two different installs of CF11
Going step by step through the eventgateway api
When I manually try to start the Gateway Instance in CFIDE, it goes to a white page, and nothing shows up in the eventgateway log. The only error I've managed to see was actually in CF9 and it was:
Cannot instantiate class: org.apache.activemq.jndi.ActiveMQInitialContextFactory
I'm assuming that's just a goofy ActiveMQ install locally though. I did some googling on this error and it says that I might be missing a .jar file within ActiveMQ, but when I view the /lib directory I can see the file they claim must be missing. Within CF9, I can actually see errors in the eventgateway log, but like I said, I get a white screen and nothing happens in CF11.
Any ideas?
Thanks,
Nick
This was due to the activemq.jar not being including in the cfusion/lib folder for CF11, but was for CF9.
We are using hawtio to have a fancy and nice web interface for seeing JMX MBeans and Camel Route in our project. However, we have noticed that after weeks running Hawtio stops working and we are getting a Jetty error when trying to access it.
We are using hawtio in standalone mode, version 1.2.0/offline. Also I guess it worth to mention that our Camel routes are pretty heavy and consume many resources (not sure if that impacts hawtio). When trying to access we get this:
HTTP ERROR 404
Problem accessing /ourContextPath/. Reason:
Not Found
Powered by Jetty://
It seems like there is no active resource for our context path and I something went wrong like a thread stopped working or something.
Does anybody have any idea how to solve this or how to find what's causing this? Also, is this a known bug fixed in the latest version (1.2.1)?
Jetty needs a work/temp directory to operate.
Default behavior is to use whatever java.io.tmpdir points to.
However, on many unix installations, this points to /tmp, and that directory is often cleaned out by other processes.
To fix, either specify a java.io.tmpdir to be somewhere other than /tmp
$ java -Djava.io.tmpdir=/var/run/jetty -jar start.jar
or create a ${jetty.base}/work/ directory (if running Jetty 9.1+)
or create a ${jetty.home}/work/ directory (if running versions of Jetty prior to 9.1)
See the answer at Jetty: Starts in C:\Temp for more details on how this work/temp directory operates and is configured.
I have a web application mostly written by others based on JSF 2, Mybatis, Spring 3 and tens of other libraries, running on Weblogic, it works and now I have to create a distinct command line application to schedule the running of some tasks already present in the web app.
I added a class with a main method in order to maintain only one codebase with a different build process to generate an executable JAR instead of a WAR. Using Spring's ClassPathXmlApplicationContext I managed to recreate the web application context, access the database beans and use them, but I'm stuck with a WSRR call which fails.
The commands:
GraphQuery graphQuery =
(GraphQuery)DataFactory.INSTANCE.create(TypeConstants.SR_URI, TypeConstants.TYPE_GRAPHQUERY);
graphQuery.setQueryExpression("/WSRR/GenericObject[#CFT_APPLIC='DS" + param + "']");
fail with a long stack, having the root exception
Caused by: java.lang.NullPointerException
at java.util.ResourceBundle.getBundle(ResourceBundle.java:960)
at com.ibm.ws.webservices.engine.resources.ProjectResourceBundle$Context.loadBundle(ProjectResourceBundle.java:474)
at com.ibm.ws.webservices.engine.resources.ProjectResourceBundle.getBundle(ProjectResourceBundle.java:372)
at com.ibm.ws.webservices.engine.resources.ProjectResourceBundle.getBundle(ProjectResourceBundle.java:341)
at com.ibm.ws.webservices.engine.resources.MessagesConstants.<clinit>(MessagesConstants.java:93)
I found that some classes and configurations are provided at runtime by the application server, and have no idea about how to replace them outside the application server.
The IBM redbook says (pages 120-121) that is possible to access a web service using a Java client, but requires a suitable EJB runtime.
How can I replicate needed EJB parameters outside the application server? I tried to use the Eclipse debugger to follow the execution of the application and extract them, but it fails, probably because the classes are loaded by Weblogic classloader.
Play framework 1.2.5 was already setup on an ubuntu 11 server. I stopped the process, ran play clean and then deployed the new app (I have since then ran play clean a few times as well without any luck). I keep getting LinkageErrors and the application is throwing classcast exceptions for objects for different classes. Any suggestions to help pinpoint what's causing the issue and how best to resolve it - thanks in advance.
Oops: LinkageError
An unexpected error occured caused by exception LinkageError: loader (instance of play/classloading/ApplicationClassloader): attempted duplicate class definition for name: "models/testModel/TestClass"
Reference to play framework is still set up in the system path. I am using "play start" to run the application.
Try using Prod mode in application.conf and check if you receive more verbose error messages during pre-compilation. Also, replacing your deployment or even the play directory might help (though that did not resolve the issue in my case). Hope it helps.