Fixing "XMLGregorianCalendarImpl is internal proprietary API and may be removed in a future release"
Background: I wrote some code that required an XMLGregorianCalendar so when I poked around with code completion, the first thing I found was a constructor on com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl. This got my code working but when you build with Maven, you get given a warning (and rightly so): XMLGregorianCalendarImpl is internal proprietary API and may be removed in a future release The fix: The correct way to get something that conforms to the XMLGregorianCalendar interface is to call this factory:
The problem We developed a Spring MVC controller that needs to know who the client is. We achieved this using a HttpServletRequest parameter and then calling getRemoteAddr() on it. The challenge then was how to test this because we need to be able to mock this value. The fix The Spring test helpers don’t provide a way to set this value with a helper method but they do provide an extension point that we can use to do it ourselves.
The problem You’re trying to build an Eclipse update site project, specifically <packaging>eclipse-repository</packaging>, with maven and you’re getting the following error: This error message is specific to this environment block that you would have defined in your POM: <environment> <os>linux</os> <ws>gtk</ws> <arch>x86</arch> </environment> For the sake of making this post easier to find for people Googling for error messages, you might get one of the following error messages for other common environments:
Fixing "The default package '.' is not permitted by the Import-Package syntax." with maven-bundle-plugin
Overview I found this problem when I was trying to bundle a maven project as an OSGi bundle to use with Tycho. The bundle I was trying to make was effectively a shaded/uber JAR that has all the dependencies inlined inside of the final artifact JAR. The cause This problem is caused by a Java class file existing in the default/unamed package. It could come from anywhere in the dependency chain, including your own project, but in this case it came from one of my dependencies; JDOM.
Problem The Xtext project I’m working with had, what I assume is, the default project structure where all the java source code lives in a src directory and the generated code goes into src-gen. I wanted to change the structure to a more maven-like structure and have the java code living under src/main/java. I wasn’t too fussed about the src-gen directory, that can stay where it is. I Googled for a while but I couldn’t find anyone asking the same question as me so hopefully this will help any others (and my future self).
Note: I’m working in Eclipse with Spring 3 and using jUnit for my tests. Background I was writing a unit test for a file upload method on a controller that looks like: mockMvc.perform(fileUpload("/fileUpload") .param("description", "blah") ) .andExpect(status().isOk()); The test was failing with the message: java.lang.AssertionError: Status expected:<200> but was:<400> This isn’t super helpful because I wasn’t sure why I was getting the 400. I tried changing the URL that I was testing and the error code changed to a 404 so I knew the request was trying to get to the right controller method.
Note: this was done on a rooted Android. It may work on Apple devices but you definitely require root on Android. Background I’ve become a bit addicted to this game and in the course of playing it, I’ve had it rip me off a few times. This happened when I’d open the game after, it’d been sitting for a while, but then it would crash a few seconds after and when I relaunched it, the extra money I’d earned wouldn’t be there.
The problem As some background, I’m running the following: Jersey 1.15 Apache Tomcat 7 The specific error that we’re going to fix is: SEVERE: The following errors and warnings have been detected with resource and/or provider classes: SEVERE: Missing dependency for method public au.com.your.package.YourResponse au.com.your.package.YourClass.someMethod(au.com.your.package.YourRequest) at parameter at index 0 SEVERE: Method, public au.com.your.package.YourResponse au.com.your.package.YourClass.someMethod(au.com.your.package.YourRequest), annotated with GET of resource, class au.com.your.package.YourClass, is not recognized as valid resource method.
How to clear the APT cache to fix failing updates.
I came across this problem the other day and thought I’d post up the fix because it’s simple to fix but a show stopper if you can’t. I’m running Linux Mint 64-bit Cinnamon and Postgres 9.1 as a refenece in case you can’t copy-paste my commands. Basically, when I copied an already running version of postgres to a new box and it failed to start. When I took a look in the postgres log for when you try to start it, I could see that it was complaining about a missing locale.