I am trying to build a jax-rs web service using Jersey2.8. When I put a jar like jersey-media-json-jackson-2.8.jar or jersey-media-moxy-2.8.jar under WEB-INF/lib folder, the exception "The resource configuration is not modifiable in this context" will occur on the browser.
Why this issue happens and how could i fix this?
Related
My web application will be deployed to Weblogic application servers on Windows and Linux/Unix in different environments. The log file location, appenders and log levels will vary between the different deployments and we would like to be able to change the logging configuration during runtime (by exchanging the config file), so I cannot embed a log4j2.xml (or whatever other config file) into my deployment. And since I'm running on Application servers I cannot control, I've got no chance to add environment variables to point to another configuration Location.
Currently, my log4j2.xml resides in the classpath of my application and is being packaged into my war file. Is there any way to tell Log4J2 to use a configuration file e. g. relative to the application root (like Log4J's configureAndWatch(fileLocation) method)?
I found lots of examples of how to configure Log4J2, but everything I found about the config file location points to the applications class path.
I finally found a solution for my problem. I added a file named
log4j2.component.properties
to my project (in src/main/resources). This file contains a property pointing to the location of my log4j2 configuration file:
log4j.configurationFile=.//path//on//my//application//server//someLog4j2ConfigFile.xml
This causes log4j2 to read that file and configure itself from it's content.
I have a non-asp, not asp, not .NET, not ASP.NET website (Web Site, not Web Application). I am indeed using a Visual Studio Solution, but it is empty and I have added an "Existing Website". There are no DLL's or anything involved. The only purpose of the Solution is so it can load in Visual Studio and be Source Controlled in certain manners.
When I deployed the site to Azure, using Deployment Options, I received the error:
Could not load file or assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Again, This is not MVC. This is a regular HTML Website.
Somebody had accidentally sync'd the wrong repository to Azure previously, an ASP.NET Website. In that case, the slot believes the site is an ASP.NET Site no matter what, and tries to build it as such. So what I had to do is open up the console in Azure, cd to the "site" directory, and I did rmdir for the four folders there... wwwroot, deployments, repository... and some other one. Azure automagically re-added wwwroot and deployments. I disconnected the deployment source and re-added the correct one. After that, it didn't try to build it like a .NET Application.
I imported my Bluemix application into Eclipse. When I open it, I get a JSON error. What do I have to do to not get this error? Is there a tutorial for this?
EXAMPLE
That's not a JSON error actually. Most likely the IDE is not able to find the JSONObject class during the project build. If you leave the mouse pointer on the JSONObject class name you will read the error (actually I suggest you to enable the problems view to see all the errors: Windows->Show View->Problems).
You need to make the class JSONObject available to DemoServlet fixing the project java build path.
I guess you are using personality-insights-java. I've just tried to import it in a blank Eclipse project and I managed to build it correctly.
I am assuming that you have a local instance of Liberty server on which you want to run the application. If not see here. Go to step 2 only when you have a local working application server in Eclipse
double check that the project Java Build Path (right click on the project->Properties->Java Build Path) contains Liberty libraries (Libraries->Add Library->Server Runtime->WebSphere Application Server Liberty)
If the auto-build is not enabled, manually clean and build the project (Project->Clean)
data-config.xml
I add some setting infomation to solrconfig.xml,but show some error here:
how to set requestHandler???pls tell me how to set.thanks.
I don't know why shows this error.
"point:
org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:
RequestHandler init failure"
Check to see if your RequestHandler class files are packaged properly in .jar file and they are located in the lib directory of your core or at the standard library location.
Make sure it's path is resolvable by the servlet container.
Check for other exceptions piled while initializing your RequestHandler.
Check for the log files inside the WebServer, for apche tomcat it is there in 'apache-tomcat-7.0.37\logs'.
Make sure you are not missing any dependencies to be included.
Paste your whole exception list for better glance of your problem.
I'm forced to use custom closed source lib in my web app deployed in tomcat 6. It is logging a lot of exceptions in my stdout log (catalina.out) via printStackTrace and then rethrowing them for me to handle. Is there a way to prevent or reroute logging of exceptions from a specific package deployed in webapp?
e.printStackTrace prints to the console similar to System.err
In Tomcat, the catalina.sh has this line which redirects all console errors to catalina.out
This applies for the Tomcat server as a whole.
"$CATALINA_BASE"/logs/catalina.out 2>&1 &
So in short, if you cant tinker with the source code to use log4j, you could try sending this to another file within the catalina.sh, but again this would not be package specific as you want.
And this would just bloat another file in a similar manner.
How about calling that segment within a try/catch segment, thus catching the exception before your app dies, adding it to log4j (or any other logging mechanism)