Getting error Named query not found: UnescalatedDeadlines - jboss

I'm trying to create a jbpm human task web application and deployed it in jboss as 7.
Adhering to the deployment structure i have placed the orm.xml in resources META-INF folder along with persistent.xml and it's having the required unescalateddealines named query. But still im getting the exception
Caused by: java.lang.IllegalArgumentException: Named query not found: UnescalatedDeadlines
at org.hibernate.ejb.AbstractEntityManagerImpl.createNamedQuery(AbstractEntityManagerImpl.java:108) [hibernate-entitymanager-3.4.0.GA.jar:]
at org.jbpm.task.service.TaskService.<init>(TaskService.java:109) [jbpm-human-task-5.1.0.Final.jar:]
at org.jbpm.task.service.TaskService.<init>(TaskService.java:92) [jbpm-human-task-5.1.0.Final.jar:]
at com.sample.taskserver.HumanTaskStartupServlet.init(HumanTaskStartupServlet.java:52) [classes:]
In nutshell, the orm.xml file is not being identified by hibernate.
what's the configuration that im missing or what could be the problem.
kindly help me in this regard.

It's probably best to add direct references to the orm files you're using, to make sure they are being picked up. For example, in your persistence.xml you could add the following:
<mapping-file>META-INF/Taskorm.xml</mapping-file>

Do you have multiple orm.xml files inside your application? Probably JBoss AS is just picking one. Usually if you merge those files it will work.
Cheers

I had the same problem, but I solved it.
My jbpm version is 5.3.
I deployed and set it up according to the guide.
I used two persistent-unit, one for jbpm/process and one for task.
I have this taskorm.xml, but in some situation jbpm will only search jbpm persistent-unit.
but taskorm.xml is defined in task unit.
You need to combine it into one.

For me I am using jbpm 5.4.0.FINAL but referred to the example with bundled presistence.xml having only orm.xml
Added Taskorm.xml resovled the problem

Related

Ecore EMF PackageNotFoundException

I have to work with a project I didn't wrote myself. It uses Ecore EMF (I have no experience with this) and I can't figure out how to solve this error:
At some point the program loads a .xmi file with this function: org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI()
And this results in this error:
org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'platform:/plugin/Animals/model/Animals.ecore' not found. (file:/C:/Users/model917.xmi, 2, 193)
It seems like the file model917.xmi exists and is not the origin of this error. I think the problem is caused because the Animals.ecore file is not found. In the model917.xmi file I found this statement:
xmlns: Animals ="platform:/plugin/Animals/model/Animals.ecore
So I think the model in file model917.xmi uses another model defined in Animals.ecore which can't be found and causes the error.
I have access to the Animals.ecore file and found out that EMF/ecore uses something like a registry to find such files. So it seems like I have to add the Animals.ecore file to this registry and I found some answers online which didn't work and I run out of ideas what to try next. Can someone give me an easy way to register this file so it will be found? I am using Eclipse if this is relevant/maybe there is an easy way to do it with Eclipse.
Usually, EMF-based softwares should rely on the so-called "namespace URI" (nsURI) of EPackages, which are usually of the form "http://foo/bar/Animals".
"http://foo/bar/Animals" should be registered in the EMF Registry and dispatch depending on your actual runtime situation to a URI that looks like "platform:/plugin/bar.foo/Animals.ecore" (when file Animals.ecore is deployed in an Eclipse plugin for an Eclipse-based application), or "platform:/resource/bar.foo/Animals.ecore" (when file Animals.ecore is deployed in the workspace of the running Eclipse-based application) or even "file:///path/to/Animals.ecore" (anywhere on the filesystem).
Technically you can use any of those URI forms as long as they are correctly resolved at runtime, but you must understand that not all URIs make sense in all contexts, for instance "platform:/" URIs only make sense in Eclipse-based context. nsURIs are supposed to be resolveable in all contexts (thanks to the registry!)
Is your code meant to be running in the context of an Eclipse-based application ? Then the project containing Animals.ecore should be deployed as a plugin, and I am guessing it is currently not.
Is your code meant to be standalone? Then the reference in your xmi file, to the ecore file, should not be of the form "platform:/..." but rather of the form "http://foo/bar/Animals" (the nsURI of the EPackage that is the root element of Animals.ecore)

How to use matlabcontrol api and jboss

thanks in advance for attention.
It's the first time i am writing on this site (quite newbie :) )
I previously read question of a user asking for my same problem. Although i read a lot i could not find a solution.
Problem:
I am trying to use MatlabControl jar (http://code.google.com/p/matlabcontrol/) to "call" matlab within my java code.
When i try this api within a normal java application to try it (including matlabcontrol.jar in the buildpath) everything works perfectly.
My issue is to make it work on an ejb module with jboss 5 AS:
i can deploy the ejb module and i can see classes of the matlabcontrol.jar (which i put in server/default/lib folder), but it is not working and is returning me the following exception:
Caused by: java.lang.NullPointerException
at java.io.File.<init>(File.java:251)
at matlabcontrol.Configuration.getSupportCodeLocation(Configuration.java:227)
at matlabcontrol.RemoteMatlabProxyFactory.createProcess(RemoteMatlabProxyFactory.java:278)
at matlabcontrol.RemoteMatlabProxyFactory.requestProxy(RemoteMatlabProxyFactory.java:116)
at matlabcontrol.RemoteMatlabProxyFactory.getProxy(RemoteMatlabProxyFactory.java:134)
at matlabcontrol.MatlabProxyFactory.getProxy(MatlabProxyFactory.java:81)
that lead me to the following lines:
URL url = Configuration.class.getProtectionDomain().getCodeSource().getLocation();
File file = new File(url.toURI().getPath()).getCanonicalFile();
The very strange thing is that very very rarely, after restarting jboss and re-deploying the ejb module, the system works!.
I really don't know if i have to modify the source code of these last 2 lines (as if it is a problem of not properly getting the location of the jar code) or to set some configuration files of jBoss to set the classpath differently.
Thanks again in advance.
Any help would be very appreciate.
The mistake was in the code to find the location of the jar at runtime.
I printed the path, which ended with "!" and double slash, so I removed these chars and I was finally able to make this API work.

Enterprise lib 5.0 not detecting app.config

I have a Solution which contains a Web project and a Class Library project. The Class library project contains Enterprise library 5.0 and app.config. When I try to perform a Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write, I get the following exception:
Resolution of the dependency failed,
type =
"Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter",
name = "(none)". Exception occurred
while: while resolving. Exception is:
InvalidOperationException - The type
LogWriter cannot be constructed. You
must configure the container to supply
this value.
----------------------------------------------- At the time of the exception, the
container was: Resolving
Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter,(none)
If I move all the class files to the web project and have the Enterprise library configuration in the Web.config, everything works fine. I guess the issue is that the Enterprise library is not detecting the app.config which contains all the configuration.
Kindly help me with this regard.
Thanks in advance.
.NET dlls don't have config files. AppDomains do. You cannot put any configuration in a dll's "app.config" file and expect it to get automatically picked up. This is the way .NET config files work; it's not that "entlib is not automatically detecting" it, it's doing what the .NET framework defines the behavior of config files to be.
The answer is to leave the code in the library, but put the configuration in the web app's web.config file. Then everything will just work.
There are more advanced things you can do like manually loading the config file, but they're fairly advanced and, particularly with logging, can cause admin headaches later.

Is there any class similar to ProvidersHelper but not for web?

Is there any class similar to ProvidersHelper but not for web?
I want to instantiate a collection of providers. Actually I'm using CodeSmith & Nettiers, and the db provider is Oracle. It generated a provider section to be added at app.config, and i dont know why it uses System.Web.Configuration classes or why at this section it says SQLClient instead of OracleClient.
The error that I'm getting is:
"An unhandled exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Web.dll
Additional information: Could not load file or assembly 'LLPA.Data.OracleClient' or one of its dependencies. The system cannot find the file specified."
Any idea or solution is appreciated.
It is probably a bug if it refers to SQL Server and you are using Oracle. I'd recommend logging a bug on the .netTiers issue tracker. I'd recommend taking a look at all of the LLPA.Data.OracleClient project references are being built and ensure that they are in your bin directory of your compiled application.
Check the DLL LLPA.Data.OracleClient is in the bin folder or the GAC. If that doesn't work look into using Fuslogvw.exe.
I hadn't had added the reference of LLPA.Data.OracleClient to my application, that's why it couldn't find it.

Declaring a JNDI variable in JBoss 4.0.5

I want to declare a new JNDI variable in the JBoss 4.0.5 server. Can someone please explain how this can be done?
waiting for your replies.
Thanks.
Found these two links that can help...
create a file called filename-service.xml under $CATALINA_BASE$/deploy directory with contents as indicated in these links
http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/Server_Configuration_Guide/Additional_Naming_MBeans-JNDI_Binding_Manager.html
check a jboss jira, JBPAPP-2809 for correction in xmlns:jndi
Have a look here and specifically here. You need to add an entry in the ejb-jar.xml file of your application.
I am facing this probelm too today. Looks like to add a simple jndi entry on the app server, in JBoss one will have to create a new file $CATALINA_BASE/conf/context.xml and invoke a MBean to add the variable and its value.
In server like websphere you can pass new values in jndi.properties, which jboss 5.0.0 upwards does not like.
Very Bad that there is absolutely NO DOCUMENTATION in jboss/docs that indicate anything on this topic.