mule anypoint studio class not found exception - mule

If I run the application in server, which is working fine, but If i run application in anypoint studio doesn't run. Here is the error message for loading oracle driver.
error message:
2015-02-04 11:18:34 WARN DriverManagerDataSource:107 - Could not load driverClass oracle.jdbc.OracleDriver
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
I have placed all jdbc and other jars under studio->project->properties->libraries.

This is caused by the Studio's classloading policies. The workaround is to copy the JDBC Driver .jar to ${studio.home}/plugins/org.mule.tooling.server.${mule.version}.ee_${mule.version}.${release.date}/mule/lib/user

Hi there actually that's kind of a hack :P though it works.
The more proper way to deal with this is, when coding your application (that's why one should use Mule Studio), to place the jars like drivers in a particular folder, like a /lib in the root of you project.
Then add these jars to the classpath.
I know what you did is the way it should be done when running on Mule stand alone in order to share such jars but try this one if you can ;)

I was also facing the same problem. As the application runtime fails to locate the jdbc driver jar in classpath So It is unable to load the same.
the simple and easiest way to handle this error is just put your lib folder containing the ojdbc jar file inside the app resource (src/main/app) of the project. During the building of project it will automatically be place in classpath.
I have tried the same approach and It works for me.
Hope this helps.

The way I fixed the problem was removing the .classpath / .project files from my project root folder. I re-imported the project and then I saw a bin folder created. I removed this bin folder then right-click on the project -> Refresh and then Run As -> Mule Application.

Related

Weblogic server - Getting NoClassDeffError for TIFFImageReader even when the library is in classpath

I am working on TIFF to JPEG conversion program. I am using the TIFF implementation from jai-imageio-core.1.3.1.jar, which is available in the classpath.
Everything works fine in my local environment in eclipse (running on tomcat server). However, when I deploy the same in Weblogic, I am getting the following error. Weblogic server is unable to recognize the TIFF implementation classes. I am unable to find the missing link. Please help.
java.lang.NoClassDefFoundError: com/github/jaiimageio/impl/plugins/tiff/TIFFImageReader
at com.github.jaiimageio.impl.plugins.tiff.TIFFImageReaderSpi.createReaderInstance(TIFFImageReaderSpi.java:118)
at javax.imageio.spi.ImageReaderSpi.createReaderInstance(ImageReaderSpi.java:320)
at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:529)
at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:513)
at javax.imageio.ImageIO.read(ImageIO.java:1443)
at javax.imageio.ImageIO.read(ImageIO.java:1308)
I will answer my own question. The issue is resolved. The problem was with the the jai-imageio-core.1.3.1.jar file present in multiple places. It was present in my application war file in WEB-INF/lib folder. however, the same jar file was also present outside the war in the weblogic adm root directory. (my bad)
I guess weblogic clearly expects the jar file only in 1 place (especially java SPI implementation jar)
It is also a good idea to search all directories under weblogic to make sure there are no additional jar files of the same name.
I had only one jai-imageio-core.1.3.1.jar file (in WAR file) and caught this error. Weblogic managed server restart helped me.

IntelliJ Spring Boot: How to create an executable jar

I'm trying to create an executable jar from IntelliJ.
First I got the Java Security Exception and I changed sqljdbc4-4.0 to unsigned. First problem solved.
Then I got Manifest not found. Added META-INF dir to output. Second problem solved.
Next I got the BeanCreationException (unsolved):
Caused by: org.springframework.beans.factory.BeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath.
In IntelliJ it is working.
I think the resources are not in the output. (application.properties, ...)
In which way do I add the resources or where are they stored in the jar.
I'm using gradle and on the spring boot homepage are only instructions for maven.
You should use spring-boot-maven-plugin or spring-boot-gradle-plugin, depending on your preferred build system.
EDIT:
Just run ./gradlew build
I suggest to dive into this getting started guide. It clarifies a lot of stuff for beginners.
A typical Spring boot project is a Maven project or a Gradle-Project (I only know how to do it with Maven, for Gradle see [luboskrnacs answer][1]). So you just need to run the maven targetpackageand pick the jar form the (created)target` folder
use a shell, go to the project root directory (where the pom.xml file is) and type
mvn clean package
cd target
the there is the xxx.jar file.

Groovy + Vaadin + IntelliJ IDEA: Works fine until I reference a custom jar

I have successfully created an IntelliJ IDEA Groovy + Vaadin project that works great until I try to reference another jar that I wrote. I've added the jar to lib/ and web/WEB-INF/lib/ and included both in my Modules/Dependencies:
I even promoted the lib/ instance to be a "global library" so I could add it to my Artifacts like so:
IntelliJ builds fine and launches Tomcat, but when I try to view my app in a browser, I receive HTTP Status 500 with the error:
The server encountered an internal error that prevented it from fulfilling this request
...and my Tomcat logs state:
javax.servlet.ServletException: Failed to load application class: com.qview.client.QueueViewApplication
Is there any way that I can gain insight into why QueueViewApplication failed to load? Any ideas on a fix?
The issue dealt with how I was building my custom jar.
In IntelliJ IDEA, under Project Structure » Artifacts » [+] » Jar » From modules with dependencies... I was selecting extract to the target jar
This bundles QueueUpdater.jar's dependency jars into one massive QueueUpdater.jar for convenient import.
But, when I changed my selection to copy to the output directory and link via manifest, I was able to add the individual jars to web/WEB-INF/lib/ and run the Vaadin application without error.

Unable to load dialect 'org.drools.rule.builder.dialect.mvel.MVEL DialectConfiguration:mvel

I am using drools for processing rules. Web-service calls a method in a class which is in jar included in lib directory of web-service. And this method in turn uses drools. Now the problem is web-service is able to find jar that is using drools but not the drools-compiler jar which is residing in same lib directory. And it gives Unable to load dialect 'org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration:mvel' error. It works if I copy all jars in web-service.aar/lib to axis2/WEB_INF/lib. I also tried to set classpath in a way to take web-service.aar/lib jars first then the one's in axis2/WEB_INF/lib by setting classpath in setenv.sh and catalina configurations. But that didn't help either.
What can be the reason/solution?
You probably need to add a newer version of the mvel jar. I added the mvel-1.3.3-java1.5.jar and it did the trick for me, but just remember to restart your IDE.

How does Intellij deploy to JBoss?

I finally have my application in IntelliJ and deploying to JBoss. I'd like to get hot deploy working but it looks like I need to understand how IntelliJ and JBoss interact.
When I build my project in IntelliJ and then start JBoss, the ear file does not appear in the deploy directory so I assume that there is some magic that IntelliJ does so that JBoss reads from a different folder. What is happening during this step?
Thanks :)
I know this is an old and apparently answered question, but unfortunately the links provided in the accepted answer didn't give me the simple details I was looking for. For anyone also trying to understand how IntelliJ IDEA deploys your exploded war to JBoss without copying files to the deployments folder, here's what I've found while deploying locally from IDEA 14 (EAP) to JBoss 7.1.1.Final:
After you've created an "exploded war" artifact for your project (or it has automatically been created for you), IDEA will build your provided sources and place the output in the directory set in the artifact options (you can change this setting to place the output inside the deployments folder inside your jboss installation).
IDEA will update your JBoss configuration file (/standalone/configuration/standalone.xml) and add a "deployment" node inside the deployments section. This entry simply defines a name, a runtime name and the exploded war root folder for your project, which will point to the output directory of your artifact set in IDEA.
When JBoss is started (either manually or from your run/debug configuration in IDEA), it will automatically deploy your artifact. Be warned that if your files are in the output directory of your project and you clean it, JBoss will still try to find the directory, thus encountering errors in your next attempt to start it: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Failed to mount deployment content, Failed to process phase STRUCTURE of deployment and java.io.FileNotFoundException to name a few.
Please refer to the documentation.
Basically, you need an exploded Artifact configuration with the directory name ending with .ear.
Build | Make performs hot deployment as well as Update action (which is configurable and can update only resources, resources and classes, optionally redeploy or restart the server).
Instead of copying your application to JBoss, IDEA runs it with appropriate parameters so that it uses Artifact directory instead. Configuration is very flexible and you can just change the artifact directory location to reside under JBoss directory.