sapjco3.dll already loaded in another classloader - sapjco3

I'm using Tomcat 9 with jdk8.I have only 1 webapp deployed on the Tomcat server. Sapjco3.jar and dll placed in WEB-INF\lib of webapps or in Tomcat\lib folder.
Come what may this error doesn't go?
What can be the cause? Tried all the options found on stackoverflow questions.
Nothing works.

Sometimes the answer is within the product's documentation itself.
In the JCo 3.1.3 installation documentation it says:
When using JCo within an application server, you need to ensure that
the JCo library is only loaded once. This is achieved best by putting
the sapjco3.jar file into the system classpath or into the startup
classpath of the application server itself. If JCo is loaded twice by
different classloaders, this also results in the JCo native library to
be loaded twice, which will fail. As a consequence, an application
must never package JCo within its own deployment unit. It has to
presume that it is already installed and provided in the respective
runtime.

Related

Eclipse Jetty keeps asking for webdefault.xml

I'm deploying all necessary Jetty bundles to an OSGi-container and launch a server instance. Yet although I'm deploying jetty-webapp and the corresponding jar contains the file org\eclipse\jetty\webapp\webdefault.xml, at startup I'm presented the error
java.io.FileNotFoundException: D:\eclipse\org\eclipse\jetty\webapp\webdefault.xml
(D:\eclipse is the eclipse installation I'm launching from)
Why isn't Jetty using the file it comes with? When I copy the file from the jar to the requested location, Jetty runs fine - but that can't be a feasible solution.
I wouldn't mind having to provide the file, but then again I don't know how to pass the path to Jetty. The launch happens directly from within an eclipse launch configuration, no maven involved.
If you use jetty-osgi-boot.jar, than you have to set the following system properties:
-Djetty.home.bundle=org.eclipse.jetty.osgi.boot
-Djetty.port=8080
The value is the symbolic name of the osgi-boot bundle that contains a default configuration.
More info in the documentation of jetty: http://www.eclipse.org/jetty/documentation/current/framework-jetty-osgi.html
Alternatively you can use the org.apache.felix.http.jetty bundle. You can find information about it here: http://felix.apache.org/documentation/subprojects/apache-felix-http-service.html
Or you can use Pax Web: https://ops4j1.jira.com/wiki/display/paxweb/Advanced+Jetty+Configuration
I used the jetty-osgi before. Nowadays I use the felix stuff as it can be configured via configadmin. Pax-web can also be used via configAdmin. I have not tried it yet but as much as I heard it has its benefits (e.g. better servlet context handling with HTTPService)

GWT Appliaction with 3rd Party Library works in Development mode but not Deployed mode

I am working on a GWT application and I am using 3rd party Java-R wrapper library. This will be converted into Java Bytecode and (I guess) call some methods via the R libraries.. I was able to successfully get it to work on eclipse development mode.
In order to get it to work, I had to add the .jar to the classpath, and add to the java path (Under Run-Configurations->Environment Variables) variable to add location of the folder containing several .dll which are required for the execution of the program.
Everything seems to work fine in development mode but stuff seems to break when I deploy it via Tomcat 7. Is there anything else I need to do when I modify the environment variables in GWT?
Initially the Tomcat server would crash because of
May 06, 2013 4:08:22 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/r] is still processing a request that has yet to finish. This is very likely to create a memory leak. You can control the time allowed for requests to finish by using the unloadDelay attribute of the standard Context implementation.
I changed the code a little differently and now the it just entered what appears to be an infinite while loop. These details seem unimportant to my question, however.
I assume there's two ways of using third party libraries for GWT
It's just a Jar that you just include (as well as in your web-inf/lab) and everything works
You use a Jar and a bunch of other .dlls whose path you set in the Enviroment Variables for the project. this what I did and, again, it works in development mode but not in deployed mode.
Any and all feedback/advice is GREATLY appreaciated. Thanks!
The jar you are including in the classpath are not available in the server runtime, If you do not want to put them explicitly in WEB-INF/lib, you can try by copying those jars into tomcat's server/lib folder
Since you have .dlls also they need to set by passing the jvm argument
java -Djava.library.path=/dlls.folder
for tomcat you can edit the bin/startup.sh (or .bat) and modify java.library.path variable, in some systems you might need to set LD_LIBRARY_PATH variable too
see similar discussion here

How to View Classpath While Debugging in Eclipse

I'm trying to troubleshoot a GWT-based app I'm writing in Eclipse. It currently uses Spring Framework 3.1.1 and Hibernate 4.1.6 on the back-end side. I'm currently having troubles with the dreaded "javax.validation.ValidationException: Unable to find a default provider" that seems to plague a lot of folks but is caused by different problems. I've tried the various solutions of using different versions of the JSR 303 implementation (e.g. diff. versions of Hibernate Validator) but it doesn't seem to make a difference.
And after debugging, I'm seeing why. Once execution gets to javax.validation.Validation.getValidationProviders():317 (in validation-api-1.0.0.GA), the app (running on an Eclipse internal Jetty server) attempts to read the META-INF/services/javax.validation.spi.ValidationProvider resource from the classpath and comes back empty. I am absolutely certain that the different validator implementations I've put (e.g. hibernate-validator-4.3.0.Final.jar) have that resource and it does contain a value (e.g. org.hibernate.validator.HibernateValidator), but is not appearing to the classloader in question. The way I've included the JAR in the classpath is by adding it to the project's Build Path which seems to add it to the Jetty runtime when I execute the applications.
My question is: Is there a way to view the classpath in Eclipse debug mode visible to a certain classloader? Secondly, does anyone know why the Hibernate Validator's resource is not first and foremost in the classloader that Validation is using?
The webapp classpath is composed by the directory WEB-INF/classes and by all the jars in WEB-INF/lib. If you want a jar to be available at runtime, you must NOT add it to the build path, but to WEB-INF/lib.
Dropping a jar in WebContent/WEB-INF/lib in Eclipse will make it automatically part of the buid path of your webapp, and available at runtime.

How can you develop bottom-up JAX-WS web services referencing classes contained in separate jar files?

I am developing a Java EE 6 bottom-up JAX-WS to expose an EJB3.1 stateless session bean. The web service in a WAR is failing to install on deployment because it references an external jar (or shared library) which one can assume is not loaded yet.
The common suggestion is to include the jars in the /lib folder, which does fix the issue, however the jars need to remain in this external shared library location and NOT in the ear file, because they amount to 30MB.
What are some techniques to get around this issue in a Websphere (WAS v.8) environment or any server environment.
Some suggestions I have found include:
1. define classpath in META-INF file.
2. define the resources in deployment.xml
3. alter class loading order
4. (from ibm) In the case where the jars are part of a Shared Library configured on WebSphere Application Server, then a User Library must be used to configure the project for development before generating the WebService.
However, I have been unsuccessful to find any help online in these areas. Is there another technique or does anyone know anything about accomplishing this? Thanks in advance.
EDIT: If I specify the libraries in the META-INF using class-path, they are loaded before extensions, shared libraries..etc, but they are still loaded after the WAR which is not good. Again, this isn't a runtime issue because the web services are created at deployment on the fly.
I submitted a ticket to IBM. The libraries referenced by the web service are needed during deployment and must be bundled into the Ear in some fashion. I threw them in the web-inf/lib folder. However, if the referenced libraries then depend on additional libraries, these can be placed in the Shared Libraries. Seems odd to me too, but let's all just admit "shared libraries" are a hack anyways.
If you still have issues, just make sure your class loading is set to parent_last.

Java EE, GWT, NoClassDefException

I have an app, built on GWT (google web toolkit) and JPA (eclipselink 2.3). it's not using GAE (app engine).
when I finished application, I ran 'google->gwt compile' menu in eclipse and then uploaded /war content to the tomcat directory...
application is running, but when I try to do one specific action in gui, I get an error message and Tomcat log contains this exception: http://paste2.org/p/1879857 (java.lang.NoClassDefFoundError)
during development of the application, I encountered this kind of exception several times, it was always caused by absence of library .jar file in the war/WEB-INF/lib/... anytime it has occurred, I stored .jar to the folder and it worked... but not this time...
this class is located in gwt-dev.jar (yes, it is there - have searched the archive) and it didn't help me to store archive to the lib/ folder...
it is also included in classpath, and compiler had no problem... compilation finished without errors (so compiler can see the class).
do you have any idea, how to make tomcat to see the class?
thanks
gwt-dev.jar shouldn't be in WEB-INF/lib/, it is the GWT compiler, and shouldn't be needed or used at runtime. At the same time, that HashSet (com.google.gwt.dev.util.collect.HashSet, part of dev mode) shouldn't be used outside the compiler - use java.util.HashSet instead.
Change the HashSet import in GroupImpl.java from com.google.gwt.dev.util.collect.HashSet to java.util.HashSet. You shouldn't need gwt-dev.jar to run your application.