No provider available for resource-env-ref in OpenEJB - ejb

I have 2 EJBs, EJB-2 is EJB 2.0, EJB-3 is EJB 3.0. The use case is EJB-3 needs to call EJB-2, it works on WebLogic 11g. But I get the exception "No provider available for resource-env-ref" exception in OpenEJB.
error message:
org.apache.openejb.OpenEJBException: No provider available for resource-env-ref 'EJB-2' of type 'javax.ejb.SessionBean' for 'EJB-3'.
weblogic-ejb-jar.xml of EJB-3
<weblogic-enterprise-bean>
<wls:ejb-name>EJB-3</wls:ejb-name>
<resource-env-description>
<resource-env-ref-name>EJB-2</resource-env-ref-name>
<jndi-name>EJB-2</jndi-name>
</resource-env-description>
</weblogic-enterprise-bean>
ejb-jar.xml of EJB-3
<resource-env-ref>
<resource-env-ref-name>EJB-2</resource-env-ref-name>
<resource-env-ref-type>javax.ejb.SessionBean</resource-env-ref-type>
</resource-env-ref>
Is there any advise for this issue? I use both OpenEJB 3.1.3 and 4.0 beta 1

Related

How to deploy EJB and War modules at same time in NetBeans 8.2 and GlassFish 4.1.1

I have a problem to deploy EJB and WAR modules at the same time in NetBeans 8.2 on GlassFish 4.1.1. The following message is shown:
[[ Exception Occurred :Error occurred during deployment: Exception while preparing the app : Could not resolve a persistence unit corresponding to the persistence-context-ref-name [ejb.NewMessage/em] in the scope of the module called [TestEJB-ejb]. Please verify your application.. Please see server.log for more details.]]
When I checked server.log file of GlassFish server, I faced with the following erreor message:
[2018-07-28T12:59:45.406+0430] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=427 _ThreadName=admin-listener(7)] [timeMillis: 1532766585406] [levelValue: 1000] [[
Exception while preparing the app : Could not resolve a persistence unit corresponding to the persistence-context-ref-name [ejb.NewEntityFacade/em] in the scope of the module called [TestEJB-ejb]. Please verify your application.]]
Is there any solution for that?
Thanks for your help.
If you did not start to create your app or if you did not choose your programming framework, you can switch to Java Spring with less headache!
Read the first paragraph of the following link:
https://en.wikipedia.org/wiki/Spring_Framework

Worklight 6.2, SQL Adapter (Oracle 11g) JNDI error, Tomcat 7

I'm running Worklight 6.2, Oracle 11g, and Tomcat 7. If I hardcode the username/password in the adapter.xml, it works fine:
adapter.xml
<connectionPolicy xsi:type="sql:SQLConnectionPolicy">
<dataSourceDefinition>
<driverClass>oracle.jdbc.OracleDriver</driverClass>
<url>jdbc:oracle:thin:#d1chd1d3.xyz.com:1522/D1CHD</url>
<user>MY_USER</user>
<password>MY_PASS</password>
</dataSourceDefinition>
</connectionPolicy
However if I use a JNDI name in the adapter, it does not work on Tomcat 7.
adapter.xml
<connectionPolicy xsi:type="sql:SQLConnectionPolicy">
<dataSourceJNDIName>jdbc/MyDatabase</dataSourceJNDIName>
</connectionPolicy>
When using the JNDI name in the adapter, I get the following error:
"Runtime: Datasource jdbc/MyDatabase not found in jndi"
I'm not sure if the backslash in the error message above is significant.
I ran the following command to display the JNDI entries Tomcat knows about and it seems to indicate the JNDI entry exists:
http://localhost:8080/manager/text/resources?type=javax.sql.DataSource
OK - Listed global resources of type javax.sql.DataSource
jdbc/MyDatabase :org.apache.tomcat.dbcp.dbcp.BasicDataSource
server.xml
<Resource
name="jdbc/MyDatabase"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:#d1chd1d3.xyz.com:1522/D1CHD"
username="MY_USER"
password="MY_PASS"
maxActive="20"
maxIdle="10"
maxWait="-1"/>
context.xml
<ResourceLink
name="jdbc/MyDatabase"
global="jdbc/MyDatabase"
type="javax.sql.DataSource" />
I am able to use a JNDI name when running the adapter, from Eclipse, using the built-in Liberty server. The problem only exists when running on Tomcat.
Any ideas why this is occurring? Is it possible to use a JNDI name from Tomcat 7 and connect to an Oracle 11g database?
I'm being told that it is possible that the dataSourceJNDIName element in the connectionPolicy node in the adapter XML is configured incorrectly.
Try it with the following instead:
<connectionPolicy xsi:type="sql:SQLConnectionPolicy">
<dataSourceJNDIName>java:comp/env/jdbc/MyDatabase</dataSourceJNDIName>
</connectionPolicy>

Configure Message Driven Bean using ejb-jar.xml

I am trying to configure Message Driven Bean using ejb-jar. I am using EJB 3.1, Netbeans 7.3 and Glassfish 3.1.2, but I am getting exception:
Exception while deploying the app: org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 29; Deployment descriptor file META-INF/ejb-jar.xml in archive [classes]. Element type "messaging-type" must be declared.. Please see server.log for more details.
Where do I make mistake?
You say that you are using Glassfish 3.1.2, but you validate your ejb-jar-xml file with ejb-jar_2_0.dtd. Instead you must use XSD validation for Glassfish 3.1.2. Here is the xsd:
http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd

boss migration 4.3 to 5.1 : ORA-01017: invalid username/password; logon denied

We are in the Process of migrating jboss 4.3 to jBoss 5.1 We are using EJB 1.1 in the current systems.We fixed a lot of issues to make the server up and finally we are not able to see the Home Page due to Db connection.We are getting Below error:
[org.hibernate.connection.DatasourceConnectionProvider] (main) Using datasource: java:/oradbds
2012-10-11 18:27:59,493 WARN [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] (main) Throwable while attempting to get a new connection: null
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: ORA-01017: invalid username/password; logon denied
)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:225)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:195)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:639).
I Guess error may be due to Db connection related Jar like ojdbc14.jar which is incompatible for jboss5.1.
Let me know if you need some more info . Please provide a solution.
first of all: which JDK do you use? IMHO you should use JDK 6 and ojdbc6.jar. Why do you want to use your old EJB 1.1 based app?
It seems that the DB-credentials are not correct ...
Best Regards,
Sascha

tomcat eclipse mssql driver demanding Java 1.6

I started writing my servlet in Java 1.6 for tomcat 7, but then I later needed to roll back to Java 1.5 for tomcat 6. I'm using eclipse. For some reason though, when I try to run my servlet it gives me the following error:
SEVERE: Java Runtime Environment (JRE) version 1.6 is not supported by this driver. Please use the JDBC 4 driver (sqljdbc4.jar) instead.
Jun 20, 2011 12:33:40 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Auth threw exception
java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.6 is not supported by this driver. Please use the JDBC 4 driver (sqljdbc4.jar) instead.
Now originally I had sqljdbc4.jar in my WEB-INF/lib directory but I swapped it out for sqljdbc.jar so that it would be 1.5 compatible. That's when I started getting the error. Hunting around in the properties panels, I saw that JVM 1.6 was still in the Build Path libraries so I deleted those. But now it can't find HTTPServlet!
I added back a servlet.jar file I had but it just gives me the "version 1.6 is not supported by this driver" message. Curiously, I also have to use the oracle jdbc driver for this servlet and it is not giving me these errors when I backgraded the project and the driver jar to the 1.5 compatible version.
How do I get the eclipse project to not think it is 1.6?
You may need to change the Java facet from 1.6 to 1.5:
Project properties → Project Facets → Java → 1.5

Resources