Unquoting in Nested Macros in Racket - macros

Context
The language is #lang web-server/insta and this code will be generated inside a quasiquoted argument passed to response/xexpr
The Call
-> (define home 'home-page)
-> (make-navigation home "home-page")
Current Output
Note the ` backquote before ((href , (embed/url ...
'(p ((id "home-page")) (a `((href ,(embed/url home-page))) "home-page"))
Desired Output
Note that the ` is gone.
'(p ((id "home-page")) (a ((href ,(embed/url home-page))) "home-page"))
Current Code
(define (make-navigation uri label)
(define (make-id uri)
`((id ,(symbol->string uri))))
(define-syntax-rule (embed uri)
``((href ,(embed/url ,uri))))
`(p ,(make-id uri)
(a ,(embed uri)
,label)))
Problem Locus
The issue is probably with embed.

#lang racket
(define (make-navigation uri label)
(define (make-id uri)
`((id ,(symbol->string uri))))
(define-syntax-rule (embed uri)
'((href ,(embed/url uri))))
`(p ,(make-id uri)
(a ,(embed uri)
,label)))
(define home 'home-page)
(make-navigation home "home-page")
Output:
'(p ((id "home-page")) (a ((href ,(embed/url uri))) "home-page"))
UPDATE
(define (make-navigation uri label)
(define (make-id uri)
`((id ,(symbol->string uri))))
(define-syntax-rule (embed uri)
`((href ,(list 'unquote (list 'embed/url uri)))))
`(p ,(make-id uri)
(a ,(embed uri)
,label)))
(define home 'home-page)
(make-navigation home "home-page")
Output:
'(p ((id "home-page")) (a ((href ,(embed/url home-page))) "home-page"))

Related

Emacs Org-mode: org-agenda-custom-commands and hiding future scheduled tasks

I have set my org-agenda-custom-commands to (among others) this:
(setq org-agenda-custom-commands
`(
("x"
"Scheduled tasks with Prio"
((tags-todo "+PRIORITY={A}"
((org-agenda-overriding-header "Scheduled Prio-A TODOs")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'unscheduled))))
(tags-todo "+PRIORITY={B}"
((org-agenda-overriding-header "Scheduled Prio-B TODOs")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'unscheduled))))
(tags-todo "+PRIORITY={C}"
((org-agenda-overriding-header "Scheduled Prio-C TODOs")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'unscheduled))))
(tags-todo "+PRIORITY={D}"
((org-agenda-overriding-header "Scheduled Prio-D TODOs")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'unscheduled))))
(agenda)))
;; snip
Now I would like to hide all tasks scheduled in the future. I can do this via
(progn
(setq org-agenda-todo-ignore-scheduled 'future)
(setq org-agenda-tags-todo-honor-ignore-options t))
But this affects all of my other org-agenda-custom-commands. I would like to limit it to just one custom command.
So how can I modify my custom command so that it hides the future tasks?
The doc string for org-agenda-custome-commands says, among other things, the following:
...
settings A list of option settings, similar to that in a let form, so like
this: ((opt1 val1) (opt2 val2) ...). The values will be
evaluated at the moment of execution, so quote them when needed.
...
You can also define a set of commands, to create a composite agenda buffer.
In this case, an entry looks like this:
(key desc (cmd1 cmd2 ...) general-settings-for-whole-set files)
...
So all you need to do is add your settings at the end of the custom command:
(setq org-agenda-custom-commands
`(
("x"
"Scheduled tasks with Prio"
((tags-todo "+PRIORITY={A}"
((org-agenda-overriding-header "Scheduled Prio-A TODOs")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'unscheduled))))
(tags-todo "+PRIORITY={B}"
((org-agenda-overriding-header "Scheduled Prio-B TODOs")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'unscheduled))))
(tags-todo "+PRIORITY={C}"
((org-agenda-overriding-header "Scheduled Prio-C TODOs")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'unscheduled))))
(tags-todo "+PRIORITY={D}"
((org-agenda-overriding-header "Scheduled Prio-D TODOs")
(org-agenda-skip-function
'(org-agenda-skip-entry-if 'unscheduled))))
(agenda))
;; settings for the above composite custom command
((org-agenda-todo-ignore-scheduled 'future)
(org-agenda-tags-todo-honor-ignore-options t)))
;; snip
;; other commands
...
))

Having a problem with org-roam-dailies-capture-today

Having a problem with org-roam-dailies-... functions. My org-roam-capture-template is
(setq org-roam-dailies-capture-templates
'(
("d" "default" entry
#'org-roam-capture--get-point
"* %?"
:file-name "daily/%<%Y-%m-%d>"
:head "#+title: %<%Y-%m-%d>\n\n")
("l" "lab" entry
#'org-roam-capture--get-point
"* %?"
:file-name "daily/%<%Y-%m-%d>"
:head "#+title: %<%Y-%m-%d>\n"
:olp ("Lab notes"))
("j" "journal" entry
#'org-roam-capture--get-point
"* %?"
:file-name "daily/%<%Y-%m-%d>"
:head "#+title: %<%Y-%m-%d>\n"
:olp ("Journal"))
("w" "words" entry
#'org-roam-capture--get-point
"* %?"
:file-name "daily/%<%Y-%m-%d>"
:head "#+title: %<%Y-%m-%d>\n"
:olp ("Words"))
))
When I call org-roam-dailies-capture-today, using the 'l' (lab-notes) hotkey, it complains...
heading not found on level 1: Lab notes.
That makes perfect sense, in the context of vanilla org-capture, because the file hasn't been created yet, so it isn't going to have any headings in it. But the point of this function is to create the file. So it has to create these headings itself and then the sub-headings and then navigate to the proper location in the file.
If I create a file using the `default' template, then go in an add the other headings, then call org-roam-capture-dailies-today and use the 'l','j' or 'w' templates, it works fine.
Am I just missing something (which is entirely possible)
BTW. the 'default', 'lab','journal' entries in my capture template are copy-and-pastes out of the org-roam info file (org-roam is v1.2.3, as installed by emacs package manager from melpa (IIRC) ). The `words' template is based on those, and, as I said, works fine so long as a use the work-around discussed.
TIA
whd
p.s. I don't have the reputation to use org-roam... tags, and I need at least one tag. So, I used `emacs'. A bit vague, but what else could I do?
I don't know if you still need this. The question is 7 months old and is about org-roam v.1. But in any case.
You need to provide the headers you will use when you create the file. This can be done through the :head parameter.
(setq org-roam-dailies-capture-templates
(let ((header (concat "#+title: %<%Y-%m-%d>\n\n"
"* Lab notes\n\n"
"* Journal\n\n"
"* Words\n\n")))
`(("d" "default" entry
#'org-roam-capture--get-point
"* %?"
:file-name "daily/%<%Y-%m-%d>"
:head ,header)
("l" "lab" entry
#'org-roam-capture--get-point
"* %?"
:file-name "daily/%<%Y-%m-%d>"
:head ,header
:olp ("Lab notes"))
("j" "journal" entry
#'org-roam-capture--get-point
"* %?"
:file-name "daily/%<%Y-%m-%d>"
:head ,header
:olp ("Journal"))
("w" "words" entry
#'org-roam-capture--get-point
"* %?"
:file-name "daily/%<%Y-%m-%d>"
:head ,header
:olp ("Words")))))

Invalid BSONObj size: 1651340622 (0x4E756D62) first element: rNegativePattern: ?type=101

I am getting error from server when querying server with below error
Error occurred from mongo operation: {0} MongoDB.Driver.MongoQueryException: QueryFailure flag was Invalid BSONObj size: 1651340622 (0x4E756D62) first element: rNegativePattern: ?type=101 (response was { "$err" : "Invalid BSONObj size: 1651340622 (0x4E756D62) first element: rNegativePattern: ?type=101", "code" : 10334 }).
at MongoDB.Driver.Internal.MongoReplyMessage`1.ReadHeaderFrom(BsonBuffer buffer)
at MongoDB.Driver.Internal.MongoReplyMessage`1.ReadFrom(BsonBuffer buffer)
at MongoDB.Driver.Internal.MongoConnection.ReceiveMessage[TDocument](BsonBinaryReaderSettings readerSettings, IBsonSerializer serializer, IBsonSerializationOptions serializationOptions)
at MongoDB.Driver.Operations.QueryOperation`1.GetFirstBatch(IConnectionProvider connectionProvider)
at MongoDB.Driver.Operations.QueryOperation`1.Execute(IConnectionProvider connectionProvider)
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
at MongoDB.Driver.MongoCollection.FindOneAs[TDocument](FindOneArgs args)
Coming randomly .
Sever version is 2.2.0.

No Persistence provider for EntityManager in RCP Pulgin Project

I am getting a
No Persistence provider for EntityManager for named X
in an RCP Plugin application I am working on. I have used hibernate as ORM and javax.persistence. I am using Derby for my database. I have grouped all the hibernate Jar and supporting jars into a plugin and added to the current project i am woking on. I am at my wits end. Any help would be appreciated. i have as of now looked at different places for answers but not found any.
I have placed the Persistence.xml file in the classpath under/META-INF/persistence.xml. I have tried placing the persistence.xml at these location - /RCMSecond/src/persistence.xml and /RCMSecond/src/META-INF/persistence.xml and /RCMSecond/META-INF/persistence.xml still the RCP project is throwing the same error stacktrace.
persistence.xml
<?xml version="1.0" encoding="UTF-8" ?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="RCMSecond" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>entity.ColumnMeta</class>
<class>entity.DataBase_CompositeID</class>
<class>entity.Files</class>
<class>entity.Database</class>
<class>entity.LookUpCols</class>
<class>entity.Project</class>
<class>entity.QueryEntity</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect" />
<property name="hibernate.archive.autodetection" value="class, hbm" />
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
<property name="javax.persistence.jdbc.url" value="jdbc:derby:simpleDB;create=true" />
<property name="javax.persistence.jdbc.user" value="root" />
<property name="javax.persistence.jdbc.password" value="root" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.logging.level" value="SEVERE" />
<property name="show_sql" value="true" />
<property name="format_sql" value="true"></property>
</properties>
</persistence-unit>
</persistence>
GenericDAOImpl.java
package daoImpl;
import java.io.Serializable;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import javax.persistence.TypedQuery;
import org.hibernate.Criteria;
import org.hibernate.Session;
import dao.GenericDAO;
import exceptions.EntityNotPresent;
public class GenericDAOImpl < T, ID extends Serializable > implements GenericDAO < T, ID > {
protected EntityManager entityManager;
protected EntityTransaction entityTransaction;
public GenericDAOImpl() {
super();
EntityManagerFactory factory = Persistence.createEntityManagerFactory("RCMSecond");
this.entityManager = factory.createEntityManager();
entityTransaction = this.entityManager.getTransaction();
}
#
Override
public T save(T t) {
entityTransaction.begin();
entityManager.persist(t);
entityManager.flush();
entityTransaction.commit();
return t;
}
#
SuppressWarnings({
"unchecked", "rawtypes"
})# Override
public List < T > readAll(String namedQueryName, Class clazz) {
TypedQuery < T > query = entityManager.createNamedQuery(namedQueryName, clazz);
return query.getResultList();
}
#
SuppressWarnings("unchecked")# Override
public T readById(#SuppressWarnings("rawtypes") Class clazz, ID id) {
entityTransaction.begin();
T t = (T) entityManager.find(clazz, id);
entityTransaction.commit();
return t;
}
#
Override
public T update(#SuppressWarnings("rawtypes") Class clazz, ID id, T updated) throws EntityNotPresent {
if (isEntityExists(clazz, id)) {
entityManager.merge(updated);
return updated;
} else {
throw new EntityNotPresent("Entity Not found, So Could not be updated");
}
}
#
Override
public void delete(#SuppressWarnings("rawtypes") Class clazz, ID removeId) {
if (isEntityExists(clazz, removeId)) {
T old = readById(clazz, removeId);
entityTransaction.begin();
entityManager.remove(old);
entityTransaction.commit();
}
}
#
SuppressWarnings("unchecked")# Override
public boolean isEntityExists(#SuppressWarnings("rawtypes") Class clazz, ID id) {
return entityManager.find(clazz, id) != null;
}
#
SuppressWarnings("unchecked")# Override
public T getFirstRecord(Class <? > clazz) {
entityTransaction.begin();
Session session = entityManager.unwrap(Session.class);
Criteria queryCriteria = session.createCriteria(clazz);
queryCriteria.setFirstResult(0);
queryCriteria.setMaxResults(1);
T t = (T) queryCriteria.list().get(0);
entityTransaction.commit();
return t;
}
#
Override
public List < T > getByQuery(String queryExecute, Object[] pars, #SuppressWarnings("rawtypes") Class clazz) {
entityTransaction.begin();#
SuppressWarnings("unchecked")
TypedQuery < T > query = entityManager.createQuery(queryExecute, clazz);
for (int i = 0; i < pars.length; i++) {
query.setParameter("arg" + i, pars[i]);
}
List < T > results = query.getResultList();
entityTransaction.commit();
return results;
}
}
StackTrace
org.eclipse.e4.core.di.InjectionException: javax.persistence.PersistenceException: No Persistence provider
for EntityManager named RCMSecond
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java: 68)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java: 898)
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java: 121)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java: 345)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java: 264)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java: 162)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java: 104)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java: 73)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java: 55)
at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java: 129)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java: 971)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java: 640)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java: 746)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java: 717)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java: 711)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java: 42)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java: 695)
at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java: 1306)
at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer$1.handleEvent(LazyStackRenderer.java: 72)
at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java: 40)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java: 186)
at org.eclipse.swt.widgets.Display.syncExec(Display.java: 4761)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java: 211)
at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java: 36)
at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java: 197)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java: 197)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java: 1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java: 230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java: 148)
at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java: 135)
at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java: 78)
at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java: 39)
at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java: 85)
at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java: 59)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java: 374)
at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java: 171)
at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java: 108)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java: 658)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java: 746)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java: 717)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java: 711)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java: 42)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java: 695)
at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java: 71)
at org.eclipse.e4.ui.workbench.renderers.swt.SashRenderer.processContents(SashRenderer.java: 151)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java: 654)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java: 746)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java: 717)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java: 711)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java: 42)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java: 695)
at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java: 71)
at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveRenderer.processContents(PerspectiveRenderer.java: 49)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java: 654)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java: 746)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java: 717)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java: 711)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java: 42)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java: 695)
at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.showTab(PerspectiveStackRenderer.java: 82)
at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer$1.handleEvent(LazyStackRenderer.java: 72)
at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java: 40)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java: 186)
at org.eclipse.swt.widgets.Display.syncExec(Display.java: 4761)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java: 211)
at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java: 36)
at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java: 197)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java: 197)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java: 1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java: 230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java: 148)
at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java: 135)
at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java: 78)
at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java: 39)
at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java: 85)
at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java: 59)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java: 374)
at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java: 135)
at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java: 1)
at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java: 108)
at org.eclipse.e4.ui.workbench.renderers.swt.PerspectiveStackRenderer.postProcess(PerspectiveStackRenderer.java: 63)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java: 658)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java: 746)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java: 717)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java: 711)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java: 42)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java: 695)
at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java: 71)
at org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer.processContents(WBWRenderer.java: 614)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java: 654)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java: 746)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java: 717)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java: 711)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java: 42)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java: 695)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java: 1057)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java: 337)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java: 1018)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java: 156)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java: 159)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java: 196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java: 134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java: 104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java: 380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java: 235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 669)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java: 608)
at org.eclipse.equinox.launcher.Main.run(Main.java: 1515)
at org.eclipse.equinox.launcher.Main.main(Main.java: 1488)
Caused by: javax.persistence.PersistenceException: No Persistence provider
for EntityManager named RCMSecond
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java: 61)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java: 39)
at daoImpl.GenericDAOImpl. < init > (GenericDAOImpl.java: 30)
at daoImpl.DatabaseDAOImpl. < init > (DatabaseDAOImpl.java: 14)
at com.view.FirstView.createControls(FirstView.java: 31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java: 56)
...112 more
I have tried placing the persistence.xml at these location - /RCMSecond/src/persistence.xml** and **/RCMSecond/src/META-INF/persistence.xml still the RCP project is throwing the same error stacktrace.
https://docs.oracle.com/javaee/7/tutorial/persistence-intro003.htm
The JAR file or directory whose META-INF directory contains
persistence.xml is called the root of the persistence unit. The scope
of the persistence unit is determined by the persistence unit's root.
Persistent units can be packaged as part of a WAR or EJB JAR file or
can be packaged as a JAR file that can then be included in an WAR or
EAR file.
• If you package the persistent unit as a set of classes in an EJB JAR
file, persistence.xml should be put in the EJB JAR's META-INF directory.
• If you package the persistence unit as a set of classes in a WAR file,
persistence.xml should be located in the WAR file's
WEB-INF/classes/META-INF directory.
• If you package the persistence unit in a JAR file that will be
included in a WAR or EAR file, the JAR file should be located in either
- the WEB-INF/lib directory of a WAR Or
- the EAR file's library directory
Check configuration. Your Eclipse should be able to map resource files and build all packages. check Project->Properties->Build Path in order to configure project dependencies.
offtopic tips:
You are trying to obtain the EntityManager by injection:
#PersistenceContext
protected EntityManager entityManager
Then to obtain the EntityManager from the EntityManagerFactory instance:
EntityManagerFactory factory = Persistence.createEntityManagerFactory("RCMSecond");
this.entityManager = factory.createEntityManager();

No implementation of method: :as-file of protocol: #'clojure.java.io/Coercions found for class: clojure.lang.PersistentVector

Getting a java.lang.IllegalArgumentException: No implementation of method: :as-file of protocol: #'clojure.java.io/Coercions found for class: clojure.lang.PersistentVector
when i run lein test or lein repl from terminal on MAC OS X. Though lein repl works well in eclipse (with counterclockwise plugin)
My Project file is:
(defproject cmp "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[lib-noir "0.5.0"]
[compojure "1.1.5"]
[ring-server "0.2.7"]
[clabango "0.5"]
[korma "0.3.0-RC5"]
[clj-json "0.5.3"]
[mysql/mysql-connector-java "5.1.6"]
[com.taoensso/timbre "1.5.2"]
[com.taoensso/tower "1.5.1"]
[com.postspectacular/rotor "0.1.0"]
[markdown-clj "0.9.19"]
[clj-pdf "1.11.1"]
[dk.ative/docjure "1.6.0"]
[com.cemerick/friend "0.1.5"]
[ring-basic-authentication "1.0.2"]
[org.clojure/data.csv "0.1.2"]
[clojure-csv/clojure-csv "2.0.1"]
[clj-time "0.6.0"]
[log4j "1.2.15"
:exclusions
[javax.mail/mail
javax.jms/jms
com.sun.jdmk/jmxtools
com.sun.jmx/jmxri]]]
:plugins [[lein-ring "0.8.3"]]
:ring {:handler cmp.handler/war-handler
:init cmp.handler/init
:destroy cmp.handler/destroy }
:profiles {
:production {
:ring {:open-browser? false
:stacktraces? false
:auto-reload? false}}
:dev {:dependencies [[ring-mock "0.1.3"]
[ring/ring-devel "1.1.8"]]}}
:java-source-paths [["src/cmp/java"]]
:min-lein-version "2.0.0")
The entry under :java-source-paths in your project.clj is a nested vector. It should be a plain vector of strings. Try replacing
:java-source-paths [["src/cmp/java"]]
with:
:java-source-paths ["src/cmp/java"]