Is there anyone on planet earth who know SocialAuth - SocialAuth throws java.lang.reflect.InvocationTargetException with no message - facebook

I am using SocialAuth libraries to authenticate against Facebook in my jsf application. I am getting java.lang.reflect.InvocationTargetException exception with no message from org.brickred.socialauth.SocialAuthManager
The probable statement causing this is:
String providerUrl = manager.getAuthenticationUrl(Common.FACEBOOK_AS_ID, Common.SOCIAL_AUTH_REDIRECT_URL);
Any clue guys. Any helps will be greatly appreciated.

I just encountered the same issue today trying to authenticate via Facebook with socialauth-4.0.
The solution is really simple, just make sure that the three jars (openid4java.jar, json-20080701.jar, commons-logging-1.1.jar) that are inside the folder dependencies (inside the zip archive of socialauth) are available at runtime.
In my case I had to put them in the lib folder of my tomcat installation.

This exception is throw if the method called threw an exception.
Just unwrap the cause within the InvocationTargetException and you'll get to the original one.
try{
String providerUrl = manager.getAuthenticationUrl(Common.FACEBOOK_AS_ID, Common.SOCIAL_AUTH_REDIRECT_URL);
}catch (InvocationTargetException ex) {
System.out.println("oops! "+ ex.getCause()) ;
}
This will tell you the actual problem, so you can resolve that issue.

Related

error.CannotStartupOSGIPlatform issue when running birt

I'm in the midst of implementing Birt 4.6.0 into my gwt application. Unfortunately whenever I run a specific section of the program, I get the following error:
org.eclipse.birt.core.exception.BirtException:
error.CannotStartupOSGIPlatform at
org.eclipse.birt.core.framework.Platform.startup(Platform.java:81)
I've done some searching and one thread mentioned a permissions error but I am not sure what that entails. What does this mean?
EDIT Just read another article that suggests that it may be an issue with my classpath but I already added all the jar files from ReportEngine/lib to my buildpath. Anyone know what jar files I am supposed to include?
the offending code:
public static synchronized IReportEngine getBirtEngine(ServletContext sc) {
if (birtEngine == null) {
EngineConfig config = new EngineConfig();
java.util.HashMap map = config.getAppContext();;
map.put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, SegnalazioniDbManager.class.getClassLoader());
config.setAppContext(map);
IPlatformContext context = new PlatformServletContext(sc);
config.setPlatformContext(context);
try {
Platform.startup(config); //problem begins here
.....
}
[1]: http://developer.actuate.com/community/forum/index.php?/topic/20933-errorcannotstartuposgiplatform/
Yes it is indeed a permission error.
The relevant file is:
WEB-INF/platform/configuration/org.eclipse.osgi/.manager/.fileTableLock
You need to give access to the Birt user.

"ERROR: 'Premature end of file.' " happens when generating snippets using Spring Restdocs

I am using Spring Restdocs for documentation. Here's my code:
RestDocumentationResultHandler document = document("{class-name}/{method-name}",
preprocessRequest(prettyPrint()),
preprocessResponse(prettyPrint()));
String authHead = TestUtils.performLogin(mockMvc, "user", "pass");
mockMvc
.perform(get("/svc/service")
)
.andExpect(status().is(200))
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$.childs").isArray())
.andDo(document);
}
.adoc files are successfully generated and af there's an error that I am struggling to solve it.
[Fatal Error] :1:1: Premature end of file.
ERROR: 'Premature end of file.'
I think the problem comes from
preprocessResponse(prettyPrint())
Since i commented it out, the error disappears. But JSON response is NOT formated as i expected. I really appreciate your help. Thanks in advance.

Proper format for log4j2.xml RollingFile configuration

I am getting the following exception in my glassfish 4 application that uses log4j2:
SEVERE: ERROR StatusLogger Invalid URL C:/glassfish4/glassfish/domains/domain1/config/log4j2.xml java.net.MalformedURLException: Unknown protocol: c
I have the following section in my log4j2.xml:
<RollingFile name="RollingFile" fileName="C:/glassfish4/glassfish/domains/domain1/logs/ucsvc.log"
filePattern="C:/glassfish4/glassfish/domains/domain1/logs/$${date:yyyy-MM}/ucsvc-%d{MM-dd-yyyy}-%i.log">
I understand that if it's looking for a URL, then "C:/glassfish4/..." is not the correct format.
However, the rolling file part actually works: I see a log file and the rolled log files where I expect them.
If I change to a URL (e.g. file:///C/glassfish4/...) that doesn't work at all.
So should I ignore the exception? (everything seems to be working ok). Or can someone explain the correct format for this section of the configuration?
I have not yet fully determined why it is that the config file works for me as well as the OP, but, I can confirm that changing the path reference to a file:// url solves the problem (ie: gets rid of the error/warning/irritant).
In my IntelliJ Run/Debug configurations, for VM options, I have:
-Dlog4j.configurationFile=file://C:\dev\path\to\log4j2.xml
I can confirm that '\' are translated to '/' so, no worries there.
EDIT:
Okay, the whole thing works because they (the apache guys) try really hard to load the configuration and they do, in fact, load from the file as specified via the c:\... notation. They just throw up a rather misleading exception before continuing to try.
In ConfigurationFactory::getConfiguration:
**source = getInputFromURI(FileUtils.getCorrectedFilePathUri(config));**
} catch (Exception ex) {
// Ignore the error and try as a String.
}
if (source == null) {
final ClassLoader loader = this.getClass().getClassLoader();
**source = getInputFromString(config, loader);**
The first bolded line tries to load from a URL and fails, throwing the exception. The code then continues, pops into getInputFromString:
try {
final URL url = new URL(config);
return new ConfigurationSource(url.openStream(), FileUtils.fileFromURI(url.toURI()));
} catch (final Exception ex) {
final ConfigurationSource source = getInputFromResource(config, loader);
if (source == null) {
try {
**final File file = new File(config);
return new ConfigurationSource(new FileInputStream(file), file);**
Where it tries to load the config again, fails and falls into the catch, tries again, fails and finally succeeds on the bolded lines (dealing with a File).
Okay, the code lines I wanted in emphasize with bold are actually just wrapped in **; guess the site doesn't permit nested tags? Anyway, y'all get the meaning.
It's all a bit of a mess to read, but that's why it works even though you get that nasty-looking (and wholly misleading) exception.
Thanks Jon, i was searching all over.. this helped!
This is on Intellij 13, Tomcat 7.0.56
-Dlog4j.configurationFile=file://C:\Surendra\workspace\cmdb\resources\elasticityLogging.xml
The problem is not the contents of your log4j2.xml file.
The problem is that log4j2 cannot locate your log4j2.xml config file. If you look carefully at the error, the URL that is reported as invalid is C:/glassfish4/glassfish/domains/domain1/config/log4j2.xml: the config file.
I'm not sure why this is. Are you specifying the location of the config file via the system property -Dlog4j.configurationFile=path/to/log4j2.xml?
Still, if the application and logging works then perhaps there is no problem. Strange though. You can get more details about the log4j configuration by configuring <Configuration status="trace"> at the top of your log4j2.xml file. This will print log4j initialization details to the console.

Entity Framework issue when creating unit tests

I am specifically getting the following error:
"The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid."
[TestMethod()]
public void salesOrderFillListTest()
{
SalesOrderController_Accessor target = new SalesOrderController_Accessor();
string orderNumber = "1954120";
SalesOrderData result;
result = target.FillingOrder(orderNumber);
Assert.AreEqual(null, result.ErrorMessage);
Assert.AreEqual(32, result.LineItems.Count);
Assert.AreEqual("WRA-24-NFL-CLEV", result.LineItems[7].ItemNumber);
Assert.AreEqual(2, result.LineItems[7].OrderQuantity);
Assert.AreEqual(1, result.LineItems[7].FillingFilledQty);
Assert.AreEqual(1, result.LineItems[7].FillingRemainQty);
}
The error is coming up on the line:
result = target.FillingOrder(orderNumber);
I'm a junior developer and haven't had much experience with the many possible causes for this error. My App.config page contains the appropriate connection strings. Any ideas where to look for this one?
Thanks!
I was able to successfully run tests found in another test project in the same solution. After looking more carefully I found that there were a few differences between the two connection strings in each project. The data in the failing test project had become antiquated. I updated the connection string and error resolved.
Thanks.

NullPointerException in Jasper Reports?

When I export a report using jasper report (version 1.2.4), it throws NPE. And I cant find any solution to the problem online. Can anyone help me in this regard please?
If I remove one problematic column in my report and export it, it exports fine. Couldn't find whats the problem with that column as it contains large data.
Many Thanks in Advance !
Posting the exception below :
java.lang.NullPointerException|
at java.awt.font.TextLayout.getBaselineFromGraphic(Unknown Source)|
at java.awt.font.TextMeasurer.initAll(Unknown Source)|
at java.awt.font.TextMeasurer.<init>(Unknown Source)|
at java.awt.font.LineBreakMeasurer.<init>(Unknown Source)|
at java.awt.font.LineBreakMeasurer.<init>(Unknown Source)|
at net.sf.jasperreports.engine.fill.TextMeasurer.renderParagraph(TextMeasurer.java:259)|
at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:220)|
at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:528)|
at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:501)|
at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:345)|
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:311)|
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:275)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1291)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:631)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:248)|
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:132)|
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:750)|
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:666)|
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)|
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)
You can get the exact same error using pure JRE code, like this:
#Test
public void testText()
{
String text = "\uFFFF\u0300";
JTextArea textArea = new JTextArea(text);
JOptionPane.showMessageDialog(null, textArea);
}
Because of this, I have been assuming it's a JRE bug and already submitted it to Oracle. The workaround is presumably to cull whatever character sequence is causing it, but I obviously don't know what you are feeding in.
This is likely either (1) a bug in the version of the JRE you're using, or (2) a threading bug. We've had the same top five lines in stack traces in a project I work on.