Apache POI and OSGi class loading issue - java

I originally was looking at this answer to create charts in Powerpoint and had an additional question as below:
Thanks for the above. Your example standalone works fine for me and I see the generated PPTX file ok. But when I try integrate it into my proper application I see the below exception at runtime.
Schemas (.xsb) for CTTable can't be loaded - usually this happens when
OSGI loading is used and the thread context classloader has no
reference to the xmlbeans classes - use
POIXMLTypeLoader.setClassLoader() to set the loader, e.g. with
CTTable.class.getClassLoader()*
When I googled I found mention of this issue: It shows in the code this comment:
// Pesky XmlBeans bug - see Bugzilla #49934
// it never happens when using the full ooxml-schemas jar but may happen with the abridged poi-ooxml-schemas
Did you have any similiar issues to this? Can you tell me what versions of "poi-ooxml" (I'm using v3.17) and "poi" (I'm using v3.17) your using, or indeed share your pom.xml would be great.
If anyone could give any guidance, that would be great.
Thanks - Ro

Related

Generate Java Classes From API XSDs

I'm currently working on the a Flight API integration on my company platform and I'm facing some issues.
I need to use a data binding plugin in order to generate Java classes based on the provided XSD files. Nevertheless, I have tried many plugins such as ADB, CXF or JIBX and I got binding errors with all of them.
I have been able to fix these errors by modifying the XSDs in order to "eliminate" the errors but I think I'll get issues later due to these changes.
So my question is quite simple, has anybody of you been able to find a good plugin which is able to handle the XSDs ?
Thanks !
You need to use JAXB to generate java classes from XML schema ,please check this SO question .
If you want specific plugin for your IDE please check this for IntelliJ IDEA and Eclipse.

Exactly which JOGL files to use for windows

I don't know Exaclty wich file I should get. I think I finally found the site but there like a list of 500 different types of files on there.
I'm using NetBeans IDE for my programming, so that's Java code and I would like a step by step (Clear to understand) tutorial on exactly which files I should currently download(Include exact link if need be), How to set it up(the jars if there are any because I tend to see a lot of zip files w/ no jars in them), and how to set it up in Netbeans.
If anyone has an Idea, write the solution down below.
The instructions to setup JOGL for Netbeans IDE with some screen captures and some detailed explanations are on our wiki:
http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE#NetBeans_IDE
It's a lot better than tinkering our JARs on Maven Central with the risk of using the wrong files.
Ok, so after more in depth digging, I found not only the JOGL jars, but every single jar out there in one site. To top it off, more than 75% of the jars had a modified date in 2015, so there all up to date here's the website,
http://search.maven.org/#search|ga|1|jogamp
Caution Be sure to really read what your downloading b/c cause on potential mismatch and you could potentially screw up your computer!

Import Neo4J API in Netbeans

For a project I am building a Java GUI from which queries can be sent to Neo4j, to make it easier to do particular analyses. To get this all working, I have downloaded a .jar folder containing all relevant classes (neo4j-javadocs-2.1.7-javadoc.jar). I have loaded the library through the project->properties->libraries->Add JAR, but I can't seem to import the classes I want to use in my GUI (neither automatically nor manually).
I am dabbling in Java, so it is probably a basic oversight that I am making, but with the help from tutorials online and trying different commands (like entering the path of the .jar file) I can't get it working. One of these tutorials is specific on the Neo4j library, so I am very confused. That tutorial is written for Eclipse, instead of NetBeans which I am working with, but as far as my knowledge goes that shouldn't matter for the commands
I don't have enough reputation to post direct images, but this link contains a screenshot. If more information is required, let me know. http://i.stack.imgur.com/lUytK.png
Additionally, when I normally add a class that is not imported, there is an automatic function to import the class. This option is missing for my specific class, so maybe I added the library in an incorrect way?
http://i.stack.imgur.com/QeDX4.png
Edit: Issue resolved thanks to a colleague that came in. Apparently I loaded the Javadoc where I should have loaded to individual classes from the lib directory.
It really should work.
Try to save all changes. NetBeans reparses the classes when you save them.
Try to build your project manually from command line using Ant build script
Use Maven, Ivy or Gradle for Dependency Management then you can depend on the Neo4j artifacts.
For sending queries to the server you actually don't need Neo4j artifacts.
You can also use the JDBC driver, see http://neo4j.com/developer/java

JavaMail not able to display html body

I am having trouble getting the SimpleClient sample app that comes with JavaMail, to work. Emails with plain text bodies display just fine in the viewer. But for html bodies it fails to find the appropriate content viewer. It's the line Object bean = dh.getBean(ci); at around line 205 in MessageViewer.getBodyComponent(), that results in bean getting assigned a null pointer, that causes the problem.
Earlier today I asked for help finding the source for javax.activation, hoping I could figure out the problem. But unfortunately when I step into that code, it goes to the wrong line in the source file, meaning I can't for the life of me figure out what is going wrong!
[I know nothing about Java Beans; this could be my problem. Please feel free to recommend that I do some learning about this technology :-) I haven't yet, for the simple reason that I have other things to do with my time. If, however, it's necessary, then I'll do it :-) ]
Has anyone else had this problem and how did you solve it?
The JavaBeans Activation Framework (JAF) has been included in the JDK since JDK 1.6. You can find the source code in the OpenJDK repository for recent versions.
When JAF was included in the JDK, none of the sample viewers were included. You can download the standalone JAF 1.1.1 release, which includes the sample viewers, and include it in your CLASSPATH.
And, just to be really clear, these are sample viewers, perhaps good enough for the JavaMail sample programs, but not good for much else. In particular, the text viewer displays all text as if it were plain text. You could get the same effect by changing the simple.mailcap file included with the SimpleClient to use "text/*".

Which JAR contains the weblogic.servlet.security.ServletAuthentication class?

I trying to create a servlet to logout from multiple JSF applications running on Oracle Glassfish. I tried the following code,
weblogic.servlet.security.ServletAuthentication.logout(request);
weblogic.servlet.security.ServletAuthentication.invalidateAll(request);
weblogic.servlet.security.ServletAuthentication.killCookie(request);
but I am not able to find the JAR file containing the required class in order to get the code to compile. I downloaded Oracle WebLogic and tried various of its JARs, but no one of them made the code to compile.
Which JAR does contain the required class and where can I find it?
The class you are looking for is in a jar named wls-api.jar.
However, you're probably searching for the wrong thing because if you are developing applications to run on Glassfish you should stick with the standard techniques (e.g. JSR-196 described here or here).
Because it isn't obvious what you are trying to implement I can't give any further detailed advice but there is plenty of documentation available about Java EE Security.
I think u need this jar file:
<JDeveloper Home>\Middleware\wlserver_10.3\server\lib\weblogic.jar
The file is located at <WLS_HOME>\middleware\wlserver\server\lib\wls-api.jar

Categories