Win a copy of Emmy in the Key of Code this week in the General Computing forum!

Armen Arzumanyan

Greenhorn
+ Follow
since Jun 18, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Armen Arzumanyan

how can i fill cells from List or Vector?
10 years ago
How can I analize Excel file with Apache POI?
I have excel file with a lot of cell values, some values must be ignored some cells must be split into two part,


this code read all strings and numbers, but I need split it into different blocks ............................
[ November 28, 2008: Message edited by: Martijn Verburg ]
Good example, if you have additional examples or codes for reading/writing excel document please publish, API examples not enough! I really need
Read excel file from JSF datatable. Give list to datatable............

THANKS
10 years ago
Hello, I found a few examples from internet about navigation handler, I am interested one simple but full example about navigation as in

http://www.jsftutorials.net/jsfNavigation/jsf-login-navigation-redirect.html

but it is a not full.

Or If you have PhaseListener example for login/logout please provide with simple description.

Thanks.
11 years ago
JSF
Here is my lookup under JBoss.....

Hashtable environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
environment.put(Context.URL_PKG_PREFIXES, "org.jboss.naming rg.jnp.interfaces");
environment.put(Context.PROVIDER_URL, "jnp://some_IP:1099");
InitialContext context = new InitialContext(environment);
BeanRemote bean = (BeanRemote) context.lookup("ejb/MyBean/remote");
I have JSF/EJB3 application what work in my localhost, but when I want call ejb3 beans from another comuter I got errors ....

javax.naming.CommunicationException [Root exception is java.rmi.NoSuchObjectException: no such object in table]
13:12:55,921 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:780)
13:12:55,921 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
13:12:55,921 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:351)
Hello people, I want to use console for JPQL I found
https://jpaquerytool.dev.java.net/how-to.html
and install it, but then I added my-app.jar and persistence unit name, after run I have one warning -
"could not load persistance unit
check your database classpath"....
and
Message Stack:
No Persistence provider for EntityManager named TestPU: Provider named org.hibernate.ejb.HibernatePersistence threw unexpected exception at create EntityManagerFactory:
javax.persistence.PersistenceException
javax.persistence.PersistenceException: org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:252)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:110)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at org.morgade.jpaquerytool.core.EntityFinder.<init>(EntityFinder.java:33)
at org.morgade.jpaquerytool.gui.tasks.CreateEntityFinderTask.doInBackground(CreateEntityFinderTask.java:47)
at org.jdesktop.swingworker.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.jdesktop.swingworker.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.hibernate.ejb.packaging.PersistenceXmlLoader.loadURL(PersistenceXmlLoader.java:70)
at org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:79)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:212)
... 12 more


Provider named oracle.toplink.essentials.PersistenceProvider threw unexpected exception at create EntityManagerFactory:
oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Local Exception Stack:
Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@11b86e7
Internal Exception: Exception [TOPLINK-30004] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing persistence.xml from URL: file:/E:/projects/wn/wn-ejb/dist/wn-ejb.jar
Internal Exception:
(1. cvc-complex-type.2.4.a: Invalid content was found starting with element 'persistence'. One of '{"http://java.sun.com/xml/ns/persistence" ersistence-unit}' is expected.)
(2. XML document structures must start and end within the same entity.)
at oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:143)
at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:169)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:110)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at org.morgade.jpaquerytool.core.EntityFinder.<init>(EntityFinder.java:33)
at org.morgade.jpaquerytool.gui.tasks.CreateEntityFinderTask.doInBackground(CreateEntityFinderTask.java:47)
at org.jdesktop.swingworker.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.jdesktop.swingworker.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: Exception [TOPLINK-30004] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing persistence.xml from URL: file:/E:/projects/wn/wn-ejb/dist/wn-ejb.jar
Internal Exception:
(1. cvc-complex-type.2.4.a: Invalid content was found starting with element 'persistence'. One of '{"http://java.sun.com/xml/ns/persistence" ersistence-unit}' is expected.)
(2. XML document structures must start and end within the same entity.)
at oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException.exceptionProcessingPersistenceXML(PersistenceUnitLoadingException.java:134)
at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:161)
at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:99)
at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcessor.java:89)
at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:236)
at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:255)
at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:155)
... 11 more
Caused by:
(1. cvc-complex-type.2.4.a: Invalid content was found starting with element 'persistence'. One of '{"http://java.sun.com/xml/ns/persistence" ersistence-unit}' is expected.)
(2. XML document structures must start and end within the same entity.)
at oracle.toplink.essentials.internal.ejb.cmp3.xml.parser.XMLExceptionHandler.error(XMLExceptionHandler.java:52)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:151)
... 16 more


Provider named oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider threw unexpected exception at create EntityManagerFactory:
oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Local Exception Stack:
Exception [TOPLINK-30005] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@11b86e7
Internal Exception: Exception [TOPLINK-30004] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing persistence.xml from URL: file:/E:/projects/wn/wn-ejb/dist/wn-ejb.jar
Internal Exception:
(1. cvc-complex-type.2.4.a: Invalid content was found starting with element 'persistence'. One of '{"http://java.sun.com/xml/ns/persistence" ersistence-unit}' is expected.)
(2. XML document structures must start and end within the same entity.)
at oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:143)
at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:169)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:110)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at org.morgade.jpaquerytool.core.EntityFinder.<init>(EntityFinder.java:33)
at org.morgade.jpaquerytool.gui.tasks.CreateEntityFinderTask.doInBackground(CreateEntityFinderTask.java:47)
at org.jdesktop.swingworker.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.jdesktop.swingworker.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: Exception [TOPLINK-30004] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing persistence.xml from URL: file:/E:/projects/wn/wn-ejb/dist/wn-ejb.jar
Internal Exception:
(1. cvc-complex-type.2.4.a: Invalid content was found starting with element 'persistence'. One of '{"http://java.sun.com/xml/ns/persistence" ersistence-unit}' is expected.)
(2. XML document structures must start and end within the same entity.)
at oracle.toplink.essentials.exceptions.PersistenceUnitLoadingException.exceptionProcessingPersistenceXML(PersistenceUnitLoadingException.java:134)
at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:161)
at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:99)
at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcessor.java:89)
at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:236)
at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:255)
at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:155)
... 11 more
Caused by:
(1. cvc-complex-type.2.4.a: Invalid content was found starting with element 'persistence'. One of '{"http://java.sun.com/xml/ns/persistence" ersistence-unit}' is expected.)
(2. XML document structures must start and end within the same entity.)
---------------------------------
All this for all my persistance units!

If you know cause of this problem please help me, or
provide other JPQL or JPA query tool.
More Thanks
Can enyone provide me simple example login from jsf managed bean to mysql using session bean by email and password.

jsf->managed-bean->remote-interface->session bean with methods->entytybean.....

I can not wrote right methods.
11 years ago
JSF
What can I do with this error

javax.persistence.NoResultException: No entity found for query
[ removed suggestion to download illegal copy of book - we don't support that here ]
[ June 18, 2008: Message edited by: Jeanne Boyarsky ]
here is a my method


when I call this I see errors

2:23:44,843 ERROR [STDERR] javax.ejb.EJBException: javax.persistence.NoResultException: No entity found for query
12:23:44,843 ERROR [STDERR] at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
12:23:44,843 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
12:23:44,843 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
12:23:44,843 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
12:23:45,281 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
12:23:45,281 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

I want write method for login by email and password, also I want search email with entity beans, but I have this errors, what is it?

Can you provide me working methods?

Thanks.
Instead @EJB you must use lookup

here is a working example

private BeanRemote remote;//remote interface of your session bean

public String start() throws NamingException {
String navigation = "null";
try {
Hashtable environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
environment.put(Context.URL_PKG_PREFIXES, "org.jboss.naming rg.jnp.interfaces");
environment.put(Context.PROVIDER_URL, "jnp://localhost:1099");
InitialContext context = new InitialContext(environment);
remote = (BeanRemote) context.lookup("wn/Bean/remote"); // wn project name , Bean - name of session bean
System.out.println("-->> lookup object successfully");
wnUser = new WnUser();/// ----------> your entity bean

this.wnUser.setEmail(email);
this.wnUser.setPassword(password);
this.wnUser.setFirstname(firstname);
this.wnUser.setLastname(lastname);
this.wnUser.setGender(gender);
this.wnUser.setBirthday(birthdate);
this.wnUser.setMobilePhone(mobilePhone);
this.wnUser.setCreateDatetime(createDatetime);
this.wnUser.setCreateDatetime(createDatetime);
remote.create(wnUser); (calling method from remote interface ....