[EJB3] - EJB java.lang.NoClassDefFoundError: javax/persistence/EntityManager
by marco squarcini
marco squarcini [https://community.jboss.org/people/squarcio] created the discussion
"EJB java.lang.NoClassDefFoundError: javax/persistence/EntityManager"
To view the discussion, visit: https://community.jboss.org/message/826760#826760
--------------------------------------------------------------
Hello to all,
I'm new to javaEE and JBoss AS and i'm trying to learn developing EJB applications but i have a problem i don't know how to solve.
I use NetBeans 7.3 and JBoss AS 7.1.1.
I have been …
[View More]created an EJB 3.1 module with an entity bean and a session bean with remote interface that performs the database operations using the entity bean.
After i have been created a java application to access the EJB module:
1. inside the library of the project i put the jboss-client.jar and the EJB module.jar files
2. i have been created a config package with the jboss-ejb-client.properties file
3. i lookup the bean with the method :
public static ControllerPrenotazioniRemote lookupRemoteControllerPrenotazioni() throws NamingException {
final Hashtable jndiProperties = new Hashtable();
jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
final Context context = new InitialContext(jndiProperties);
final String appName = "";
final String moduleName = "EJBModule1";
final String distinctName = "";
final String beanName = ControllerPrenotazioni.class.getSimpleName();
final String viewClassName = ControllerPrenotazioniRemote.class.getName();
System.out.println("Looking EJB via JNDI ");
System.out.println("ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName);
return (ControllerPrenotazioniRemote) context.lookup("ejb:/EJBModule1/ControllerPrenotazioni!"
+ ControllerPrenotazioniRemote.class.getName() + "?stateful");
}
I deploy the EJB module less problems,but when i try to run the java application i see thi error in the output tab of NetBeans:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/persistence/EntityManager
at controllers.ControllerPrenotazioni.trovaPrenotazione(ControllerPrenotazioni.java:133)
at principale.Main.main(Main.java:22)
Caused by: java.lang.ClassNotFoundException: javax.persistence.EntityManager
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more
Java Result: 1
I do not know where I'm wrong!Someone can help me to solve this problem?
Thank you to all in advance....
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/826760#826760]
Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
[View Less]
11 years, 7 months
[jBPM] - Custom JuelScriptEngine
by Marcos Sousa
Marcos Sousa [https://community.jboss.org/people/marcos.sousa] created the discussion
"Custom JuelScriptEngine"
To view the discussion, visit: https://community.jboss.org/message/826736#826736
--------------------------------------------------------------
This is a prodution problem.
We copy paste the orginal JuelScriptEngine from jBPM, so we can create new functions.
We are getting issues in productions using decisions.
To reproduce the issue we create 2 threads invoking …
[View More]startProcessInstante (after task we put decision) then we see what was happen in the code, surprised we found:
1. jBPM creates for those 2 threads our JuelExtendedScriptEngine
2. The ELContext creates 1 new JuelExtendedScriptEngine and use this for those 2 threads - Why? How can I put ELContext to reuse the JuelExtendedScriptEngine created by jBPM?
I see that inside the JuelExtendedScriptEngine every value fits ok. But the evaluation of our new function instead of use the JuelExtendedScriptEngine previous created by jBPM it uses that one created by ELContext.
Remember that the code is the same as the original jBPM 4.3 JuelScriptEngine.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/826736#826736]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
[View Less]
11 years, 7 months
[jBPM] - Is jBPM the right tool for what I'm trying to achieve?
by Egor Kolesnikov
Egor Kolesnikov [https://community.jboss.org/people/eskape] created the discussion
"Is jBPM the right tool for what I'm trying to achieve?"
To view the discussion, visit: https://community.jboss.org/message/826702#826702
--------------------------------------------------------------
Hi everyone,
I've been researching jBPM in on-again-off-again mode since, well, pre-v3 times, circa 2005. Every time it happened to be "not quite what I need", or there was a feature promised "in a future …
[View More]release" and I usually moved on to something else - usually some simple homebrew workflow solutions that nevertheless did their job fine.
Now that it's 2013 and jBPM is at 5.4.0, I kinda started thinking that I may not understand the very purpose of it.
If we take on something as simple as bug tracking or ticketing system - there are tons of possible configurable workflows that just scream "use jBPM dammit!"
Let's start with email confirmation after registration: Start -> call "registration email" service -> human task (wait for email link to be clicked) -> call "confirm registration" service -> End. Loops for "re-send confirmation mail" are optional.
Now after I've added maven dependencies for jbpm-bpmn2 and jbpm-human-task-core, there are already TONS of transi
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/826702#826702]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
[View Less]
11 years, 7 months
[EJB3] - Test EJB3 using Junit 4 in Glassfish 3.1.1
by Sharma Ragav
Sharma Ragav [https://community.jboss.org/people/ragav] created the discussion
"Test EJB3 using Junit 4 in Glassfish 3.1.1"
To view the discussion, visit: https://community.jboss.org/message/826697#826697
--------------------------------------------------------------
Hi,
I am using Glassfisg 3.1.1 server and test EJB3 class using junit4.
Below are the code written in setUp() in test class.
Getting below exception:
javax.ejb.EJBException: No EJBContainer provider available: no provider names …
[View More]had been found.
at javax.ejb.embeddable.EJBContainer.reportError(EJBContainer.java:216)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:146)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
@Before
public void setUp() throws Exception {
System.out.println("Inside setUp");
InitialContext context = null;
Properties prop = new Properties();
prop.put("org.glassfish.ejb.embedded.glassfish.instance.root",
"");
prop.put(EJBContainer.MODULES, new File("/classes/"));
EJBContainer container =EJBContainer.createEJBContainer();
settingEJB = (SettingsBean) container.getContext().lookup("java:global/SettingsEJB");
}
Added glassfish-embedded-static-shell.jar in classpath.
Anything missed?
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/826697#826697]
Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
[View Less]
11 years, 7 months
[EJB3] - Custom principal is not propagated to ejb session context (resteasy3 + oauth)
by Marcel Rovira
Marcel Rovira [https://community.jboss.org/people/marcel.rovira] created the discussion
"Custom principal is not propagated to ejb session context (resteasy3 + oauth)"
To view the discussion, visit: https://community.jboss.org/message/826545#826545
--------------------------------------------------------------
Hello,
I'm using resteasy 3.0.1 Final with oauth in JBoss 6.1 EAP and my custom principal class is not propagated to sessioncontext in an EJB3.
Oauth is configured as …
[View More]BearerTokenAuthenticator
My login-module configuration in standalone.xml to use extended login module
<login-module code="es.gc.epsilon.secure.api.shared.resources.MyDatabaseServerLoginModule" flag="required">
<module-option name="dsJndiName" value="java:jboss/datasources/EpsilonXADS"/>
<module-option name="principalsQuery" value="select PASSWORD from EP_USER where name=?"/>
<module-option name="rolesQuery" value="select ROLE_NAME, 'Roles' from EP_USER_ROLE where USER_NAME = ?"/>
<module-option name="hashAlgorithm" value="MD5"/>
<module-option name="hashEncoding" value="base64"/>
<module-option name="unauthenticatedIdentity" value="guest"/>
</login-module>
My DatabaseServerLoginModule:
public class MyDatabaseServerLoginModule extends DatabaseServerLoginModule {
@Override
protected java.security.Principal createIdentity(String username) throws Exception {
System.out.println("createIdentity BEGIN");
MyCustomPrincipal p = null;
if (principalClassName == null) {
p = new MyCustomPrincipal(username);
} else {
p = (MyCustomPrincipal) super.createIdentity(username);
}
return p;
}
...
My custom principal
public class MyCustomPrincipal extends SimplePrincipal implements Serializable {
private static final long serialVersionUID = 1L;
private String tenant;
public MyCustomPrincipal(String name) {
super(name);
// TODO Auto-generated constructor stub
}
...
My oauth server configuration:
*jboss-web.xml*
<jboss-web>
<security-domain>java:/jaas/jaasEpsilon</security-domain>
<valve>
<class-name>org.jboss.resteasy.skeleton.key.as7.OAuthAuthenticationServerValve</class-name>
</valve>
</jboss-web>
My api rest configuration project:
*web.xml*
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>jaasEpsilon</realm-name>
</login-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>All resources</web-resource-name>
<description>Protects all resources</description>
<url-pattern>/api/secure/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
<role-name>employee</role-name>
</auth-constraint>
</security-constraint>
<context-param>
<param-name>resteasy.role.based.security</param-name>
<param-value>true</param-value>
</context-param>
*jboss-deployment-structure*
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.jboss.resteasy.resteasy-jaxrs" services="import"/>
<module name="org.jboss.resteasy.resteasy-jackson-provider" services="import"/>
<module name="org.jboss.resteasy.skeleton-key"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
*jboss-web.xml*
<jboss-web>
<valve>
<class-name>org.jboss.resteasy.skeleton.key.as7.BearerTokenAuthenticatorValve</class-name>
</valve>
</jboss-web>
>From an EJB I extract principal info as
@Resource(name = "sessionContext")
private SessionContext sctx;
...
Principal principal = sctx.getCallerPrincipal();
if (!(principal instanceof MyCustomPrincipal)) {
System.out.println("I expected a " + MyCustomPrincipal.class.getName() + " but got a "
+ principal.getClass().getName() + " instead !!!!!!");
and the result is:
I expected a es.gc.epsilon.secure.api.shared.resources.MyCustomPrincipal but got a org.jboss.resteasy.skeleton.key.SkeletonKeyPrincipal instead
Is this a bug, is there another way to retrieve the caller principal, is there any wrong configuration?
Thanks.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/826545#826545]
Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
[View Less]
11 years, 7 months