oracle.jdbc.OracleDriver not found by service bundle - apache-karaf

I'm using My batis under fuse and I have 4 bundles in my project
Model bundle which contains some beans
Dao bundle which connects to the DB by creating and using a SqlSessionTemplate bean
Service bundle which calls the Dao bundle
Web service bundle which calls the service bundle
I got a this error "org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.OracleDriver'
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver not found by service bundle"
and after importing oracle.jdbc package in the service bundle, the error dissapears
why does the service bundle load the Oracle driver? I think this is Dao bundle's responsibility.

Related

Can you deploy a message driven bean packaged as a EJB JAR on Weblogic?

Hi I am new to Weblogic and I am trying to figure out how to deploy a MDB properly. I have an EAR project that contains my Beans and config files, am I able to export that as a JAR and deploy that onto the Weblogic server?
EJB's can be deployed as JARs (see oracle docs section "Using Archived Files")
and the jar should contain the deployment descriptor xml / Annotations (e.g. #MessageDriven ) that configures the MDB.

java EE project encountered NoClassDefFoundError

I am working on a Java EE project with
jdk 1.8
wildfly 10.1.0 final
intellij idea 2016.3
The project has a web application module and an ejb module, and the structure is as follows:
And the two modules have already been deployed successfully
But when I tried to call the session bean, the ejb project went wrong and threw an error
Caused by: java.lang.NoClassDefFoundError: org/json/JSONArray
I use JSON in class DAOHelperImpl in the ejb module, and I've already add the dependency. I tried to put the jar in various packages such as /ejb/lib or /web/web/lib, but none of them are working.
What's wrong?
Move the jars libraries from /web/web/lib into
/web/web/WEB-INF/lib
By Convention the general folder for auto included jars is:
web-project-name/webContent/WEB-INF/lib
Read more here: https://blogs.oracle.com/alexismp/entry/web_inf_lib_jar_meta
I am not aware how IntelliJ handles Java EE projects.
In Eclipse the EAR and WAR are in separate projects and can be assigned to each other.
I think this error is raised due to my bad understanding of how this web application together with the ejb module works: I deploy the web module and the ejb module separately, and it seems that wildfly can only link to the lib of the web module.
The solution is to deploy only the web application to the server and add the ejb module to the web application.

How to access an EJB in an ear from a war?

I have two Projects deployed on the same weblogic server:
An ear archive with an EJB (#Local, #Stateless)
A war archive
I want to access the EJB from a class inside the war archive. Is this generally possible? How?
Interface needs #Remote
Stateless annotation of EJB class needs mappedName = "ejb/myEJB"
Lookup with "ejb.MyEJB#mypackage.MyEJBInterface"

Java service Using JarClassLoader

My Java service loads a jar file using JarClassLoader and created instance using JclObjectFactory.
1.Once the service is up and once the jar is loaded, will the jar just loaded be cached by JVM
2.Will the continuous run of the service cause memory leak issues loading the same jar again and again.?
Please clarify.

Deploying remote EJB and Web application

I have successfully deployed an EJB 3 module and a JSF WEB app which calls the EJB module's beans using netbeans IDE locally. Now when I try to deploy this in staging environment, i get the following error:
root cause
javax.servlet.ServletException: com.sun.enterprise.InjectionException: Exception attempting to inject Unresolved Ejb-Ref com.store.managedbeans.CustomerManagedBean/customerService#jndi: com.store.service.CustomerRemote#null#com.store.service.CustomerRemote#Session#null into class com.store.managedbeans.CustomerManagedBean
root cause
javax.naming.NameNotFoundException: com.store.service.CustomerRemote#com.store.service.CustomerRemote not found
I have deployed the EJB module and Web application in glassfish v2 (in the staging environment).The jar of the EJB Module is inside WEB-INF/lib folder of web application. It looks like the web app cannot find the EJB module. The classes are annotated with #Remote. And I am calling interfaces and not the bean by using #EJB. And of course, this worked find when I deployed it under Netbeans.
From the comments:
The EJB Module was referencing a JMS Queue Connection Factory. The resource hadn't been created in the staging glassfish server. Although the EJB module was allowed to be deployed, the JNDI Log from the console reveals that none of the EJBs were bound to any names because of a problem in deploying the module.

Resources