NoClassDefFoundError when deploying
Hello,
when deploying my .ear file I get a "NoClassDefFoundError: BuchungDetailsBean"
The BuchungDetailsBean is a JavaBean in a "office.war" file and is meant to be used in the session bean within a ejb-jar file. I already put a "class-path: Office.war" line in the ejb-jar's manifest.
import gk.office.util.*;
import java.rmi.RemoteException;
import javax.ejb.*;
public class BuchungControllerBean implements SessionBean {
private BuchungHome buchungHome;
public BuchungDetailsBean getBuchungDetails (String buchungId)
throws RemoteException, FinderException
Buchung buchung = (Buchung) buchungHome.findByPrimaryKey(buchungId);
BuchungDetailsBean buchg = new BuchungDetailsBean();
buchg.setId(buchung.getId());
Any ideas ?
Add the same classpath in APP-INF/manifest
Similar Messages
-
NoClassDefFoundError when deploying ear
Hello,
I am deploying an ear using MyEclipse. In the ear under the META-INF dir is the application.xml. The application.xml has a reference to the jar which has the class that is not found when deploying and the jar is in the ear.
<module>
<java>cdtpojo.jar</java>
</module>
Any ideas what I am doing wrong. This is being deployed to the 8.1 SP4 platform.
JoelHi werginz ,
did you copy the jar files under the app/lib dir and add them to ejb manifest file ?
----Anilkumar kari -
NoClassDefFoundError when deploying webservice calling BAPI
Hi,
I need to develop a java webservice which is calling a BAPI. I use DCs for that. One DC contains the JARs (JCO, ...) the other one my class which calls the BAPI (I generated the proxy classes in the same DC).
Everything looks fine but when I deploy my webservice I always get a NoClassDefFoundError for BAPI_..._Input. Can you tell me why it's not working and what is a solution for it? Honestly I don't understand why I get this error, as the BAPI_...Input is in the same DC.
Thanks a lot in advance.
Kind regards,
TimoHi Suresh,
there's not really a error stack trace as the error occurs when i'm testing the webservice using the testpage.
When testing the webservice I get the following response:
HTTP/1.1 500 Internal Server Error
Connection: close
Server: SAP J2EE Engine/7.00
Content-Type: text/xml; charset=UTF-8
Set-Cookie: <value is hidden>
Date: Fri, 20 Oct 2006 11:46:21 GMT
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>bapi_bupa_central_getdetail/Bapi_Bupa_Central_Getdetail_Input</faultstring><detail><ns1:java.lang.NoClassDefFoundError xmlns:ns1='http://sap-j2ee-engine/error'>bapi_bupa_central_getdetail/Bapi_Bupa_Central_Getdetail_Input</ns1:java.lang.NoClassDefFoundError></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
So, it looks like it's the bapi_bupa_central_getdetail/Bapi_Bupa_Central_Getdetail_Input which is missing.
Kind regards,
Timo -
Applet works in JDeveloper, but not when deployed to OC4J
I am working on an applet version of the BI Beans java client application. It works fine when running in JDeveloper (applet viewer), but fails when deployed to OC4J. The applet shows a red X, with a message in the status bar saying "Loading Java Applet Failed...". Contents of java console are as follows:
java.lang.NoClassDefFoundError: oracle/dss/selection/step/Step
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Any one have any ideas how to chase this one down?
Here is the message that JDeveloper shows when it runs the applet. I have gone thru this and ensured that all these references are selected in my .deploy settings:
C:\JDeveloper\jdk\bin\javaw.exe -ojvm -Xbootclasspath/a:C:\dev\jdev\Workspace1\TestClientApp\classes;
C:\JDeveloper\jdev\lib\ext\..\..\..\bibeans\lib\biaddinsrt.jar;
C:\JDeveloper\jdev\lib\ext\..\..\..\bibeans\lib\biamlocal.jar;
C:\JDeveloper\jdev\lib\ext\..\..\..\bibeans\lib\bicmn.jar;
C:\JDeveloper\jdev\lib\ext\..\..\..\bibeans\lib\bidataclt.jar;
C:\JDeveloper\jdev\lib\ext\..\..\..\bibeans\lib\bidatacmn.jar;
C:\JDeveloper\jdev\lib\ext\..\..\..\bibeans\lib\bidatasvr.jar;
C:\JDeveloper\jdev\lib\ext\..\..\..\bibeans\lib\biext.jar;
C:\JDeveloper\jdev\lib\ext\..\..\..\bibeans\lib\bipres.jar;
C:\JDeveloper\jdev\lib\ext\..\..\..\bibeans\lib\bidata-nls.zip;
C:\JDeveloper\jdev\lib\ext\..\..\..\bibeans\lib\bipres-nls.zip;
C:\JDeveloper\jdev\lib\ext\..\..\..\bibeans\lib\bicmn-nls.zip;
C:\JDeveloper\jdev\lib\ext\..\..\..\bibeans\lib\biaddins-nls.zip;
C:\JDeveloper\jdev\lib\ext\..\..\..\jlib\LW_PfjBean.jar;
C:\JDeveloper\jdev\lib\ext\..\..\..\jlib\share.jar;
C:\JDeveloper\jdev\lib\ext\..\..\..\jlib\jewt4.jar;
C:\JDeveloper\jdev\lib\ext\..\..\..\jlib\jewt4-nls.jar;
C:\JDeveloper\jdev\lib\ext\..\..\infobus\lib\infobus.jar;
C:\JDeveloper\BC4J\lib\bc4jmt.jar;C:\JDeveloper\BC4J\lib\collections.jar;
C:\JDeveloper\BC4J\lib\bc4jct.jar;
C:\JDeveloper\lib\xmlparserv2.jar;
C:\JDeveloper\jlib\jdev-cm.jar;
C:\JDeveloper\j2ee\home\lib\jndi.jar;
C:\JDeveloper\jlib\regexp.jar;
C:\JDeveloper\jlib\share.jar;
C:\JDeveloper\jlib\uix2.jar;
C:\JDeveloper\jdbc\lib\classes12.jar;
C:\JDeveloper\jdbc\lib\nls_charset12.jar;
C:\JDeveloper\j2ee\home\lib\ojsp.jar;
C:\JDeveloper\j2ee\home\jsp\lib\taglib\ojsputil.jar;
C:\JDeveloper\j2ee\home\oc4j.jar;
C:\JDeveloper\j2ee\home\lib\servlet.jar;
C:\JDeveloper\jdev\lib\ojc.jar;
C:\JDeveloper\jdev\lib\ext\..\..\..\bibeans\lib\olap_api_92.jar;
C:\JDeveloper\jdev\lib\jdev-rt.jar;
C:\JDeveloper\BC4J\lib\bc4jhtml.jar;
C:\JDeveloper\BC4J\lib\datatags.jar;
C:\JDeveloper\BC4J\lib\bc4juixtags.jar;
C:\JDeveloper\BC4J\lib\bc4j_jclient_common.jar
Any assistance would be appreciated.
s.l.i have the same problem
i cant load my applet on OC4J , i am wondering know how Oracle canot solve this problem -
NoClassDefFoundError during deployment & accessing EJBs in ear
Platform - Redhat Linux 7.2 weblogic6.0 ant 1.3 for compilation and creation of ear.
I get a NoClassDefFoundError when I try to access some of the EJBs in my deployed
ear file.
Previously, I faced a NoClassDefFoundError problem in deployment and I put the jar
containing
the classes that it was asking for, in the classpath in startWeblogic.sh.
The ear got deployed after that.
Error I am getting now...
2002-04-29 18-05-18 - bang - <INFO> - Type :Operation Groups
2002-04-29 18-05-18 - bang - <INFO> - SELECT member FROM s_access_group WHERE site
= ? AND facility
= ? AND type = ? AND name in('null')
2002-04-29 18-05-18 - bang - <DEBUG> - DB Connection closed
2002-04-29 18-05-18 - bang - <DEBUG> - DB Connection closed
2002-04-29 18-05-18 - bang - <ERROR> - Controller: createSessionForTheUser: Caught
Remote exception
while creating SessionMgrEJB
java.rmi.RemoteException: EJB Exception:; nested exception is:
java.lang.NoClassDefFoundError: com/seagate/edcs/server/system/sysmgr/GroupDetails
java.lang.NoClassDefFoundError: com/seagate/edcs/server/system/sysmgr/GroupDetails
at com.seagate.edcs.util.system.SecurityUtils.getMembersOfGroups(SecurityUtils.java:205)
at com.seagate.edcs.util.system.SecurityUtils.getGuestPrivileges(SecurityUtils.java:376)
at com.seagate.edcs.server.system.sessionmgr.SessionMgrEJB.ejbCreate(SessionMgrEJB.java:127)
I have done the same compilation and creation of ear and deployment in a Solaris
server, using the
same source code and build.xml ( ant build file) and ant properties file; never saw
any errors like this.
I unjared the ear lying in the solaris machine that I was using previously and the
ear that
I created now in the linux server, and saw a difference in the manifest files...
the manifest files remains same as what I decribe with the EJB source in the previous
(solaris)
case...
Manifest-Version: 1.0
Created-By: 1.3.0 (Sun Microsystems Inc.)
Class-Path: edcs2000_utility.jar edcsreportmgr.jar wipgrpmgr.jar resourcegrpmgr.jar
systemgrpmgr.jar
notificationmgr.jar role.jar user.jar
The manifest file in the ear created now in the linux machine is something like this;
different
from what I describe together with the EJB.
Manifest-Version: 1.0
Name: com/seagate/edcs/server/system/role/RoleEJBHomeImpl_WLStub.class
Name: com/seagate/edcs/server/system/role/ACLDetails.class
Name: WLGENERATED
Name: com/seagate/edcs/server/system/role/RolePK.class
Name: com/seagate/edcs/server/system/role/RoleEJBHomeImplAD.ser
Name: com/seagate/edcs/server/system/role/RoleEJBEOImpl_WLStub.class
Name: com/seagate/edcs/server/system/role/RoleEJBEOImpl.class
Name: META-INF/ejb-jar.xml
what might be the issue here ? Please do have a look and help!
Thanks in advance
Prabin.Hi Kevin,
Use remote EJB method calls. For details, look for "Parent application" topic in this forum or Servlet development guide in Oracle Documentation Library. I know, it does not seem to be the right source when looking for EJB documentation, however, it is.
Daniel. -
Gettind error when deploying XI module
Hi,
I am getting the following error when deploying XI module in J2EE Engine. can anyone help me to proceed. Thanks.
08/02/22 16:16:59 - Start updating EAR file...
08/02/22 16:16:59 - start-up mode is lazy
08/02/22 16:17:12 - EAR file updated successfully for 13047ms.
08/02/22 16:17:12 - Start deploying ...
08/02/22 16:18:27 - EAR file uploaded to server for 2656ms.
08/02/22 16:18:29 - ERROR: Not deployed. Deploy Service returned ERROR:
java.rmi.RemoteException: Cannot deploy application sap.com/SignEncrypt..
Reason: Exception during generation of components of application sap.com/SignEncrypt in container EJBContainer.; nested exception is:
com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Exception during generation of components of application sap.com/SignEncrypt in container EJBContainer.
at com.sap.engine.services.deploy.server.DeployServiceImpl.deploy(DeployServiceImpl.java:567)
at com.sap.engine.services.deploy.server.DeployServiceImplp4_Skel.dispatch(DeployServiceImplp4_Skel.java:1555)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)
at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)
at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Caused by: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Exception during generation of components of application sap.com/SignEncrypt in container EJBContainer.
at com.sap.engine.services.deploy.server.application.DeploymentTransaction.makeComponents(DeploymentTransaction.java:621)
at com.sap.engine.services.deploy.server.application.DeployUtilTransaction.commonBegin(DeployUtilTransaction.java:321)
at com.sap.engine.services.deploy.server.application.DeploymentTransaction.begin(DeploymentTransaction.java:307)
at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:292)
at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhases(ApplicationTransaction.java:326)
at com.sap.engine.services.deploy.server.DeployServiceImpl.makeGlobalTransaction(DeployServiceImpl.java:3184)
at com.sap.engine.services.deploy.server.DeployServiceImpl.deploy(DeployServiceImpl.java:552)
... 10 more
Caused by: java.lang.NoClassDefFoundError: Lcom/sap/aii/af/service/auditlog/AuditMessageKey;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:1522)
at java.lang.Class.getDeclaredFields(Class.java:1098)
at com.sap.engine.services.ejb.deploy.verifier.BeanClassCheck.check(BeanClassCheck.java:78)
at com.sap.engine.services.ejb.deploy.verifier.session.SessionBeanCheck.check(SessionBeanCheck.java:51)
at com.sap.engine.services.ejb.deploy.verifier.Verifier.checkBean(Verifier.java:82)
at com.sap.engine.services.ejb.deploy.verifier.Verifier.check(Verifier.java:46)
at com.sap.engine.services.ejb.deploy.DeployAdmin.generate(DeployAdmin.java:254)
at com.sap.engine.services.ejb.EJBAdmin.deploy(EJBAdmin.java:2161)
at com.sap.engine.services.deploy.server.application.DeploymentTransaction.makeComponents(DeploymentTransaction.java:606)Hi Indira.
As I can see in your log, you're getting the exception
Caused by: java.lang.NoClassDefFoundError: Lcom/sap/aii/af/service/auditlog/AuditMessageKey
May be you need to include aii_af_svc.jar (AuditLog classes are located into this JAR library) in your EAR archive.
Regards,
Gari. -
SDM failed when deploying a Web Dynpro application
SDM failed when deploying a Web Dynpro application - I get the following error message:
Sep 19, 2006 2:25:34 PM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
[001]Deployment aborted
Settings
SDM host : eix-blade-011
SDM port : 50118
URL to deploy : file:/D:/DOCUME1/AMRM1.AZI/LOCALS1/Temp/temp43621sap.comwelcome.ear
Deployment exception : Server eix-blade-011 did not accept login request as admin on port 50118. Details: ERROR: Could not establish connection to server eix-blade-011 at port 50118: eix-blade-011
Inner exception was :
Server eix-blade-011 did not accept login request as admin on port 50118. Details: ERROR: Could not establish connection to server eix-blade-011 at port 50118: eix-blade-011Amr Azim,
You must have logged in thru a dedicated connection to any server through say VPN before deploying.This way the sdm uses the same login as that of already establised connection.
So 'sign of' all connections to any servers before deploying and redeploy your application.Here you will be prompted to supply the sdm password and deployment shall proceed. -
ClassCastException when deploying jsf war on Weblogic 10.3.2
Hello everybody,
We 're having an issue when deploying jsf war on Weblogic 10.3.2
The war works fine on Tomcat 6.
When deploying on Weblogic we got the following exception:
java.lang.ClassCastException: weblogic.xml.jaxp.RegistryXMLReader cannot be cast to org.xml.sax.XMLReader
I've already put <prefer-web-inf-classes>true</prefer-web-inf-classes> in weblogic.xml
After "googling", people suggest to remove xml-apis jar from WEB-INF/lib, but doing so results in other exceptions.
Is there any fix for this issue? Please help it's been more than a month that we are crawling in the dark with this error.
Thanks in advance.Hello everybody,
We 're having an issue when deploying jsf war on Weblogic 10.3.2
The war works fine on Tomcat 6.
When deploying on Weblogic we got the following exception:
java.lang.ClassCastException: weblogic.xml.jaxp.RegistryXMLReader cannot be cast to org.xml.sax.XMLReader
I've already put <prefer-web-inf-classes>true</prefer-web-inf-classes> in weblogic.xml
After "googling", people suggest to remove xml-apis jar from WEB-INF/lib, but doing so results in other exceptions.
Is there any fix for this issue? Please help it's been more than a month that we are crawling in the dark with this error.
Thanks in advance. -
Problem with fonts in forms when deployed on web
Hi everybody out there! Please help me out. My problem is:
I have used developer server to deploy forms on web, but when a
form is shown on web, it takes some default settings for fonts
and colors instead of retaining the original colors and fonts
that i chose during creating forms. I want that forms retain
their original colors and fonts when deployed on web. How would
i do that ?? Someone told me to check the Registry.dat file but
i do not how to change the settings in registry.dat file. So
help me out and tell me how would i change color and font
settings for forms being shown on web by web app. server.
Thanking you in anticipation,
Cheema
nullHello Neeraj!
The problem is no resolved:) In the Visual Attribute Group I changed the Font Weight to Bold in the Property Palette.
Thanks a lot for showing interest for my problem.
Regards
Roar -
App Insights for web application not working when deployed to Dev server
App Insights is not sending telemetry data for ASP.NET MVC web *requests* (page views from the JS instrumentation are fine) when the app is deployed to the Dev or Test IIS servers. On local IIS express it works perfectly fine. I have
no idea how to troubleshoot this problem.
Bert Jackson- the AI.config file is both in the root of the site, and the /bin folder (which was confusing the other day). Both are correct.
- it looks like a local browser can go to https://dc.services.visualstudio.com (it results in a 403 since its just a GET to the root). During this test, I found that this server did NOT have the Root trust certificate (Baltimore cybertrust), which
would cause problems when using IE locally to browse the app; the javascript AI logging was not working, because it couldnt fetch the ai.0.js file). I got the proper root certificate installed on the server, but request logging still not working. I
dont believe the firewall is a problem.
- I've verified that all binaries are indeed deployed in to the bin folder on the server
- web.config does have the AI http module; I've verified via logging that the ApplicationInsightsWebTracking is loaded. However, I have custom Context/Telemetry initializers, and their Initialize() methods are *NOT* being called when deployed on the
server. I've tried both ways of registering the initializers; via code in the Application_Start() event and also in the ApplicationInsights.config file.
I don't know how to troubleshoot any further, to figure out if AppInsights is actually *trying* to send telemetry out and failing, or if its not actually even trying.
Bert Jackson -
Unable to load data / NullReferenceException only on certain tables when deployed
I have a LightSwitch app that works fine when being debugged locally. But it has a strange issue when deployed as a Cloud Service to Azure. I have two Silverlight grid controls on the page which display a red x and give the error, "Unable to load data.
Please check your network connection and try loading again."
Several other queries are running on this page and correctly pull data from other tables in the database. The queries that run correctly are tied to label or text box controls.
The queries that fail, return an HTTP Status code 500 (Internal error). If I try and pass the query to a constructor as an IVisualCollection,
and I wrap the call in a Try block,
the Inner Exception is "Object reference not set to an instance of an object." So, a Null Reference Exception. Checking for null before the constructor call and popping up a message box if the query was null as a means of debugging yielded nothing. I
create these helpers all over. Only two are causing an issue and only when deployed. In addition, running the query in the Management Portal also completes fine.
Try
'Check for nulls
If (Me.qQuoteByFirm Is Nothing) Then
Me.ShowMessageBox("qQuoteByFirm", "Error", MessageBoxOption.Ok)
End If
If (Me.qQuoteByFirm.Screen Is Nothing) Then
Me.ShowMessageBox("Screen", "Error", MessageBoxOption.Ok)
End If
If (New ModalWindowHelper(Me.qQuoteByFirm, "mwAddQuote", "Quote") Is Nothing) Then
Me.ShowMessageBox("Modal", "Error", MessageBoxOption.Ok)
End If
'Create helper
Me.HelperAddQuote = New ModalWindowHelper(Me.qQuoteByFirm, "mwAddQuote", "Quote")
Catch ex As Exception
Dim err As String = ""
For Each item In ex.Data
err = err & item.ToString()
Next
err = err & ex.InnerException.ToString() & vbCrLf & _
ex.Message.ToString() & vbCrLf & _
ex.StackTrace
Me.ShowMessageBox(err, "Error", MessageBoxOption.Ok)
End Try
'Constructor
Public Sub New(ByVal visualCollection As IVisualCollection, _
ByVal dialogName As String, _
Optional entityName As String = "")
_collection = visualCollection
_dialogName = dialogName
_entityName = If(entityName <> "", entityName, _collection.Details.GetModel.ElementType.Name)
_screen = _collection.Screen
End Sub
The actual construction of the queries does not seem to matter. I've tried several variations along with requesting the entire table. Same result. However, this only occurs on two specific tables. Grid controls displaying other tables on other screens work
properly.
Here's the weird part. If I comment out the call to the constructor, I can gain access to the gird control and add data to it even through the red box remains. If I refresh the grid control, the data disappears as if it wasn't saved or isn't there. But inspecting
the table in SQL Azure Management Portal shows that the data was properly populated in the table.
The app and the database are clearly connected and able to communicate fine. So why when reading from these two tables (but not writing to) are my grid controls throwing exceptions? Why does this only happen when deployed? What other techniques can I use to
get more information?I am not very familiar with Lightswtich. But 500 is a server side error. Do you manually code the server side, or does Lightswitch automatically generates the server side code? If you manually coded, then please try to catch exceptions in
your server side code. If the code is automatically generated, you may want to consult a Lightswitch forum on how to troubleshooting such issues. What's more, when you refresh the grid, what code are invoked? Try to check that piece of code and see if there're
any problems, such as you reload the grid with empty data. -
Error When Deploying a planning application
I've prepared a planning application in hyperion 9.3;
Validation is successful but when deploying the application deployment fails with the message "Action aborted. Please check the Job Status for results."
Job status shows:
===============================================================================
Started Time : Sunday, March 08, 2009 6:39:27 PM
Submitted Time : Sunday, March 08, 2009 6:39:27 PM
Last Updated Time : Sunday, March 08, 2009 6:39:29 PM
User Name : amjad
Process Name :
Thread : 0
Server : DimServer
Detail : Initiating Product Action...
Inspecting Deployment History...
Generating Headers and Callback Information...
Generating Application Data...
Preparing Product Request...
Posting Product Request...
Product Response:550...
Action aborted.
================================================================================
any suggestion?Hi,
If you are going to be using EPMA the first thing to do is to make sure you have installed all the patches for EPMA and Planning.
They are available from [metalink3|https://metalink3.oracle.com/od/faces/index.jspx] , planning is at patch 9.3.1.1.10 and EPMA has around 5 patches.
Cheers
John
http://john-goodwin.blogspot.com/ -
NoClassDefFoundError when trying to return a custom Object
Hi,
I'm trying to get some system memory info from a Windows machine using Java. I've written the C code and Java code and it all compiles fine. I can also use most of the methods in the two files. I have a problem with one method though. Its a method that is returning an object type that I created that mirrors a windows structure. Below is the code.
// Java Object to store the data
package agent.win32;
public class MemoryInfo{
int dwLength;
int dwMemoryLoad;
int dwTotalPhys;
int dwAvailPhys;
int dwTotalPageFile;
int dwAvailPageFile;
int dwTotalVirtual;
int dwAvailVirtual;
public int get_dwLength() { return dwLength; }
public int get_dwMemoryLoad() { return dwMemoryLoad; }
public int get_dwTotalPhys() { return dwTotalPhys; }
public int get_dwAvailPhys() { return dwAvailPhys; }
public int get_dwTotalPageFile() { return dwTotalPageFile; }
public int get_dwAvailPageFile() { return dwAvailPageFile; }
public int get_dwTotalVirtual() { return dwTotalVirtual; }
public int get_dwAvailVirtual() { return dwAvailVirtual; }
// Java Class that uses JNI
package agent.win32;
public class NIMSNT {
//Constructor
public NIMSNT(){};
static{
try{
System.loadLibrary("NIMSNT");
catch (java.lang.UnsatisfiedLinkError e) {
System.out.println (e);
* check psapi.dll and psapi functions
* return true if NT process can be enumerate
public static native boolean Initialize();
* Description:The EnumProcesses function retrieves the process identifier
* for each process object in the system
* return value:the list of process identifiers
* call psapi function EnumProcesses
public static native int[] EnumProcesses();
* Description:The OpenProcess function returns a handle to an existing process object.
* return value:If the function succeeds, the return value is an open handle to the specified process
* call kernel32 function OpenProcess
public static native int OpenProcess(int Pid);
* Description:The EnumProcessModules function retrieves a handle for each module in the specified process
* return value:the list of module handles
* call psapi function EnumProcessModules
public static native int[] EnumProcessModules(int hProcess);
* Description:The GetModuleFileNameEx function retrieves the fully qualified path for the specified module
* return value:the fully qualified path for the specified module
* call psapi function GetModuleFileNameEx
public static native String GetModuleFileName(int hProcess,int hModule);
* Description:The GetModuleBaseName function retrieves the base name of the specified module
* return value:the base name of the specified module
* call psapi function GetModuleBaseName
public static native String GetModuleBaseName(int hProcess,int hModule);
* Description:function closes an open object handle
* return value:true if succesfuly
* call kernel32 function CloseHandle
public static native boolean CloseHandle(int handle);
* Description:function gets system memory
* return value:String
public static native MemoryInfo GetSystemMemoryInfo();
// C Structure (defined in windows.h)
typedef struct _MEMORYSTATUS {
DWORD dwLength;
DWORD dwMemoryLoad;
SIZE_T dwTotalPhys;
SIZE_T dwAvailPhys;
SIZE_T dwTotalPageFile;
SIZE_T dwAvailPageFile;
SIZE_T dwTotalVirtual;
SIZE_T dwAvailVirtual;
} MEMORYSTATUS, *LPMEMORYSTATUS;
// C code
#include <windows.h>
#include <string.h>
#include "agent_win32_NIMSNT.h"
#define MaxProcessNumber 10000
/** Type Definitions **/
typedef BOOL (WINAPI *ENUMPROCESSES)(
DWORD * lpidProcess,
DWORD cb,
DWORD * cbNeeded
typedef BOOL (WINAPI *ENUMPROCESSMODULES)(
HANDLE hProcess,
HMODULE * lphModule,
DWORD cb,
LPDWORD lpcbNeeded
typedef DWORD (WINAPI *GETMODULEFILENAMEEXA)(
HANDLE hProcess,
HMODULE hModule,
LPTSTR lpstrFileName,
DWORD nSize
typedef DWORD (WINAPI *GETMODULEBASENAME)(
HANDLE hProcess,
HMODULE hModule,
LPTSTR lpstrFileName,
DWORD nSize
typedef struct _PROCESS_MEMORY_COUNTERS {
DWORD cb;
DWORD PageFaultCount;
DWORD PeakWorkingSetSize;
DWORD WorkingSetSize;
DWORD QuotaPeakPagedPoolUsage;
DWORD QuotaPagedPoolUsage;
DWORD QuotaPeakNonPagedPoolUsage;
DWORD QuotaNonPagedPoolUsage;
DWORD PagefileUsage;
DWORD PeakPagefileUsage;
} PROCESS_MEMORY_COUNTERS, *PPROCESS_MEMORY_COUNTERS;
typedef BOOL (WINAPI *GETPROCESSMEMORYINFO)(
HANDLE hProcess,
PPROCESS_MEMORY_COUNTERS ppsmenCounters,
DWORD cb
/** Global Variables **/
ENUMPROCESSES EnumProcesses;
ENUMPROCESSMODULES EnumProcessModules;
GETMODULEFILENAMEEXA GetModuleFileNameExA;
GETMODULEBASENAME GetModuleBaseName;
GETPROCESSMEMORYINFO GetProcessMemoryInfo;
/** DLL Entry **/
BOOL APIENTRY DllMain(HANDLE hInst, DWORD ul_reason_being_called, LPVOID lpReserved){
return TRUE;
* Class: nims4_agent_win32_NIMSNT
* Method: Initialize
* Signature: ()Z
JNIEXPORT jboolean JNICALL Java_agent_win32_NIMSNT_Initialize(JNIEnv * env,jclass clazz){
HANDLE hpsapi=LoadLibrary("PSAPI.DLL");
if (hpsapi==NULL) return FALSE;
EnumProcesses=(ENUMPROCESSES)GetProcAddress((HINSTANCE)hpsapi,"EnumProcesses");
GetModuleFileNameExA = (GETMODULEFILENAMEEXA)GetProcAddress((HINSTANCE)hpsapi, "GetModuleFileNameExA");
GetModuleBaseName = (GETMODULEBASENAME)GetProcAddress((HINSTANCE)hpsapi, "GetModuleBaseNameA");
EnumProcessModules = (ENUMPROCESSMODULES)GetProcAddress((HINSTANCE)hpsapi, "EnumProcessModules");
GetProcessMemoryInfo = (GETPROCESSMEMORYINFO)GetProcAddress((HINSTANCE)hpsapi, "GetProcessMemoryInfo");
if (
NULL == EnumProcesses ||
NULL == GetModuleFileName ||
NULL == GetModuleBaseName ||
NULL == EnumProcessModules )
return FALSE;
return TRUE;
* Class: nims4_agent_win32_NIMSNT
* Method: EnumProcesses
* Signature: ()[I
JNIEXPORT jintArray JNICALL Java_agent_win32_NIMSNT_EnumProcesses(JNIEnv * env, jclass clazz){
DWORD aPids[MaxProcessNumber];
DWORD cGot;
jintArray Pids=0;
if(EnumProcesses(aPids,sizeof(aPids),&cGot)){
cGot /= sizeof(aPids[0]);
Pids= (*env)->NewIntArray(env,cGot);
(*env)->SetIntArrayRegion(env,Pids,0,cGot,(jint*) aPids);
return Pids;
* Class: nims4_agent_win32_NIMSNT
* Method: OpenProcess
* Signature: (IZI)I
JNIEXPORT jint JNICALL Java_agent_win32_NIMSNT_OpenProcess (JNIEnv * env, jclass clazz,jint Pid){
return (jint) OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,FALSE,Pid);
* Class: nims4_agent_win32_NIMSNT
* Method: EnumProcessModules
* Signature: (I[I)[I
JNIEXPORT jintArray JNICALL Java_agent_win32_NIMSNT_EnumProcessModules (JNIEnv * env, jclass clazz, jint hProcess){
HMODULE hModule[MaxProcessNumber];
jintArray jModule=0;
DWORD cGot;
if (EnumProcessModules((HANDLE)hProcess,hModule,sizeof(hModule),&cGot)){
cGot/= sizeof(hModule[0]);
jModule= (*env)->NewIntArray(env,cGot);
(*env)->SetIntArrayRegion(env,jModule,0,cGot,(jint*)hModule);
return jModule;
* Class: nims4_agent_win32_NIMSNT
* Method: GetModuleFileName
* Signature: (II)Ljava/lang/String;
JNIEXPORT jstring JNICALL Java_agent_win32_NIMSNT_GetModuleFileName(JNIEnv * env, jclass clazz, jint hProcess, jint hModule){
jstring jName=0;
char FileName[MAX_PATH];
if(GetModuleFileNameExA((HANDLE)hProcess,(HMODULE)hModule,FileName,sizeof(FileName))!=0){
jName=(*env)->NewStringUTF(env,FileName);
return jName;
* Class: nims4_agent_win32_NIMSNT
* Method: GetModuleBaseName
* Signature: (II)Ljava/lang/String;
JNIEXPORT jstring JNICALL Java_agent_win32_NIMSNT_GetModuleBaseName(JNIEnv * env, jclass clazz, jint hProcess, jint hModule){
jstring jName=0;
char FileName[MAX_PATH];
if(GetModuleBaseName((HANDLE)hProcess,(HMODULE)hModule,FileName,sizeof(FileName))!=0){
jName=(*env)->NewStringUTF(env,FileName);
return jName;
* Class: nims4_agent_win32_NIMSNT
* Method: CloseHandle
* Signature: (I)Z
JNIEXPORT jboolean JNICALL Java_agent_win32_NIMSNT_CloseHandle(JNIEnv * env, jclass clazz, jint handle)
return CloseHandle((HANDLE) handle);
* Class: nims_agent_win32_NIMSNT
* Method: GetSystemMemoryInfo
* Signature: (I)Lagent/win32/MemoryInfo;
JNIEXPORT jobject JNICALL Java_agent_win32_NIMSNT_GetSystemMemoryInfo(JNIEnv * env, jclass clazz){
jfieldID jfield;
jobject jobj=0;
MEMORYSTATUS stat;
stat.dwLength = sizeof(stat);
GlobalMemoryStatus(&stat);
clazz=(*env)->FindClass(env,"agent.win32.NIMSMemoryInfo");
if (clazz==0) return 0;
jobj = (*env)->AllocObject (env,clazz);
//set NIMSMemoryInfo object field
// dwLength
jfield=(*env)->GetFieldID(env,clazz,"dwLength","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwLength);
// dwMemoryLoad
jfield=(*env)->GetFieldID(env,clazz,"dwMemoryLoad","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwMemoryLoad);
// dwTotalPhys
jfield=(*env)->GetFieldID(env,clazz,"dwTotalPhys","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwTotalPhys);
// dwAvailPhys
jfield=(*env)->GetFieldID(env,clazz,"dwAvailPhys","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwAvailPhys);
// dwTotalPageFile
jfield=(*env)->GetFieldID(env,clazz,"dwTotalPageFile","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwTotalPageFile);
// dwAvailPageFile
jfield=(*env)->GetFieldID(env,clazz,"dwAvailPageFile","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwAvailPageFile);
// dwTotalVirtual
jfield=(*env)->GetFieldID(env,clazz,"dwTotalVirtual","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwTotalVirtual);
// dwAvailVirtual
jfield=(*env)->GetFieldID(env,clazz,"dwAvailVirtual","I");
(*env)->SetIntField (env,jobj, jfield,stat.dwAvailVirtual);
return jobj;
};I can use all of the methods in the Java/C code except for the the last native method public static native MemoryInfo GetSystemMemoryInfo(); . I get a NoClassDefFoundError when I try to use this method. I have a feeling that I'm just doing something stupid.
Thanks in advance,
JohnYes, exactly. I changed the name of that class and forgot to change it in the c code. Thanks for the feedback.
Also, if anyone is using this code as an example, you need to change "agent.win32.MemoryInfo" to "agent/win32/MemoryInfo" in the c code. If it is left as "agent.win32.MemoryInfo" you will get a ClassCircularityError when trying to make multiple calls to the NIMSNT.GetSystemMemoryInfo();. -
Use Global Conditions when Deploying an Application to a User
Hi,
Use Global Conditions when Deploying an Application to a User:
I would like to deploy App-V Application with User centic in mind. The problem is that when the user login to a specefic typ of desktop the application shall be deployed. But if the use login on there primary device or some other
device with same SLA the Application shall not be deployed.
I think I can use Global Conditions to solve this. I have read about GC and it looks like I could greate a GC rule that deploy the software if the computer is in an AD-group or maybe becas all this computer starts with same prefix, sp maybe
if the computernamn starts with PC the application will get deployed.
The issue is that there is differant SLA on the computers that the User login to.
Or what mor can I do?
/SaiTechJust keep in mind this puts a load on AD, a Domain Controller can get tickled silly by these Global Conditions running from each of your Clients, depending on the scale of your environment it can have an impact. It's a great idea GC's, just need to consider
what load you are putting on the infra when they run.
Might not be an issue for\to you, worth nothing all the same.
Robert Marshall | This forum post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs -
Error when deploying a simple Entity bean (EJB3) on Glassfich or Sun AS
Hi,
After some problems when deploying complex EJB3 Entity bean on GlassFich with a MySQL connector, I have made a simple entity.
(test with Glassfish and Sun AS with same result)
With netbean 5.5 => New EJB Module
File->New->Persistence Unit (and use default values)
Persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="test" transaction-type="JTA">
<provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
<jta-data-source>jdbc/sample</jta-data-source>
<properties>
<property name="toplink.ddl-generation" value="create-tables"/>
</properties>
</persistence-unit>
</persistence>File->New->Entity Class
EntityTest.java
package test;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class EntityTest implements Serializable
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
/** Creates a new instance of EntityTest */
public EntityTest()
public Long getId()
return id;
public void setId(Long id)
this.id = id;
public String toString()
//TODO change toString() implementation to return a better display name
return "" + this.id;
}Build of project work fine but when I try to deploy (with the 2 servers), I have the error :
Exception occured in J2EEC Phase
com.sun.enterprise.deployment.backend.IASDeploymentException: Deployment Error -- null
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:790)
at java.util.HashMap$KeyIterator.next(HashMap.java:823)
at com.sun.enterprise.deployment.backend.EjbModuleDeployer.generatePolicy(EjbModuleDeployer.java:203)
at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:171)
at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:169)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:266)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:739)
at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:174)
at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:210)Yes, the problem is that the ejb-jar must contain at least one ejb component. It's a common misconception that Java Persistence API Entity classes are ejb components but they are NOT. The Java Persistence API was developed within the EJB 3.0 JSR and works very well with EJB but the entity classes themselves are not full-fledged ejb components.
--ken
Maybe you are looking for
-
How do I make a transpose/octave button for just one instrument in a split?
I work in mainstage 2.2.2 with patches that are using splits, and I want to make an octave button for just one instruments in a patch. Suggestions? (If I press the octave button in my keyboard, the whole split point moves, no good...) Benny
-
Multiple network card interface question
ok so i work for my college as a student worker in network operations. today they did a makeover on the dorm network and added in some traffic shaping. Instead of getting 8mb down im getting 1mb down. Well one of the admins went to lunch and had the
-
Maintain adjusted sound levels in quicktime pro
how do i maintain adjusted sound levels in quicktime pro 7 when i export for web release? it constantly returns to default levels.
-
Computer won't boot. Picture on screen strange
Just got my computer delivered with the mail today. Suspecting that there is a problem with the VGA card. The screen just shows a lot of different weird colours everywhere. Doesn't look healthy I can tell you. The D-Bracket shows: G R G G In the moth
-
I have gone to icloud and tried the play a sound. It will not work as it is saying that the phone is "offline" and it will make a sound when the phone goes online again. Please help me I'm desperate. Is there anyway to remotely change the settings