JNDI lookup fails in Glassfish - java

I am working on a web project using maven.When I run the server on net-beans 6.8,the build is succes,but when deploying to server I am getting lookup failed exception.Please find the server log in the following url http://pastie.org/1997218. Let me know What I have missed here. The stack trace for the error is
SEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
java.lang.RuntimeException: javax.naming.NamingException: Lookup failed for 'jdbc/deliver' in SerialContext [Root exception is javax.naming.NameNotFoundException: deliver not found]
at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init> (PersistenceUnitInfoImpl.java:111)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:130)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:96)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:121)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:644)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:296)
...

As it seems your production server is missing the database resource jdbc/deliver your application needs. You have configured it properly for your test instance in NetBeans. Have a look at the Services tab in NetBeans and make sure you have a similar database set up on your server.

Related

Getting error to failed to look up JNDI DataSource in WebLogic

I'm using WebLogic 12.2.1.4, I have already created the datasource with the name "jdbc/TESTDataSource but still getting the below error. Is there are any additional steps that I'm missing here. Please help.
Caused by: org.springframework.jdbc.datasource.lookup.DataSourceLookupFailureException: Failed to look up JNDI DataSource with name 'java:comp/env/jdbc/TESTDataSource'; nested exception is javax.naming.NameNotFoundException: While trying to look up comp/env/jdbc/TESTDataSource in /app/webapp/TEST.war/1431676420.; remaining name 'comp/env/jdbc/TESTDataSource'

Deploying maven project on glassfish using deploy command

I have a java ee application with maven, when i build the project then deploy the ear generated on target folder, i try to signup to the application so i have to call a locale EJB Session (ConfigUser) , i get the following error:
javax.naming.NamingException: Lookup failed for 'java:global/myproject-ear/myproject-ejb-1.0/UserFacade!myproject.service.ConfigUser' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: myproject-ear] at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518) at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455) at javax.naming.InitialContext.lookup(InitialContext.java:411) at javax.naming.InitialContext.lookup(InitialContext.java:411) at org.apache.jsp.index_jsp._jspService(index_jsp.java:79) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111) at javax.servlet.http.HttpServlet.service(HttpServlet.java:770) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411) at
I tried deploying using the command call asadmin --host localhost --user admin deploy --force "C:\myproject\target\myproject-ear-1.0.ear", i also tried deploying from glassfish administration console, but the problem persist.
It works fine when i deploy from netbeans, knowing that the project is structured in the pom file like this:
<modules>
<module>myproject-ear</module>
<module>myproject-ejb</module>
<module>myproject-web</module>
</modules>
This is the jsp page :
Context c = new InitialContext();
ConfigUser configUser = (ConfigUser) c.lookup("java:global/myproject-ear/myproject-ejb-1.0/ConfigUser!myproject.service.ConfigUser");
Since there was no answer to this problem, i'm answering my own question, after research i've found the reason to the javax.naming.NamingException: Lookup failed problem, the EJB ConfigUser that i was looking for was not correctly mapped to the JNDI name, so after the deploy i checked the server log and the JNDI name was :
java:global/myproject-ear-1.0/myproject-ejb-1.0/ConfigUser!myproject.service.ConfigUser
instead of :
java:global/myproject-ear/myproject-ejb-1.0/ConfigUser!myproject.service.ConfigUser

ConnectorRuntimeException: Invalid resource

I am creating an enterprise java application using netbeans 8.0.1 java EE6 and glassfish server 4.1.1 attached with netbeans.
When I have created the db in mysql and connected successfully and created entity class from database and session bean for that entity class and I am going to deploy the application it gives this error:
Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : java:module/custordermgt__pm
at org.glassfish.jdbcruntime.service.JdbcDataSource.validateResource(JdbcDataSource.java:81)
at org.glassfish.jdbcruntime.service.JdbcDataSource.setResourceInfo(JdbcDataSource.java:62)
at org.glassfish.jdbcruntime.JdbcRuntimeExtension.lookupDataSourceInDAS(JdbcRuntimeExtension.java:136)
at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(ConnectorRuntime.java:589)
What caused this exception?
This is probably due to a NetBeans bug. Take a look at the solution here: https://stackoverflow.com/a/56921913/1429984

ClassLoader classcastexception with activemq client

I have been struggling with this problem for a while now, decided to ask the community, hoping to get some hints/answers.
I am using tomcat 7.0.54 as my J2EE container which has a WAR deployed with dependency on activemq-all.
Along with the above, I'm also placing a jar in the classpath to register a listener programmatically, by implementing the ServletContainerInitializer interface. This initializes a simple implementation of an active mq client, JvmMessageProducerImpl (I have activemq-client as a dependency in the pom).
With the above setup, when i try to start tomcat, i get the below exception. It seems that instead of loading the classes independently, the listener which is called when the web application starts, is finding an existing instance of TcpTransportFactory and throwing the ClassCastException. I have read the classloader manual for tomcat multiple times, and my understanding is that each of the war files should have independent Class loaders - but dont completely understand why the exception is being thrown?
javax.jms.JMSException: Could not create Transport. Reason: java.io.IOException: Transport scheme NOT recognized: [tcp]
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:36)
at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:317)
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:330)
at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:251)
at com.monitoreverywhere.jvmmon.mq.JvmMessageProducerImpl.setup(JvmMessageProducerImpl.java:66)
at com.monitoreverywhere.jvmmon.mq.JvmMessageProducerImpl$Runner.run(JvmMessageProducerImpl.java:163)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.IOException: Transport scheme NOT recognized: [tcp]
at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27)
at org.apache.activemq.transport.TransportFactory.findTransportFactory(TransportFactory.java:181)
at org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:63)
at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:315)
... 5 more
Caused by: java.lang.ClassCastException: org.apache.activemq.transport.tcp.TcpTransportFactory cannot be cast to org.apache.activemq.transport.TransportFactory
at org.apache.activemq.transport.TransportFactory.findTransportFactory(TransportFactory.java:178)
... 7 more

javaURLContextFactory ClassNotFound

We are trying to get InitialContext using a listener in web.xml of our application and getting below error:
SEVERE: Unable to init UserDataCachejavax.naming.NoInitialContextException: Cannot instantiate class: org.apache.naming.java.javaURLContextFactory [Root exception is
java.lang.ClassNotFoundException: org.apache.naming.java.javaURLContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:17)
This class is present in catalina.jar.
Java version used is jdk1.6.0_02
Tomcat version is tomcat 7
Please let us know if any one has faced this error or is it related to security manager on server?

Categories